-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Use override.conf files for systemd unit config #1596
base: trunk
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,91 @@ | ||
# Systemd Units | ||
|
||
This directory contains systemd unit definitions for running various components | ||
of the SSH No Ports suite. | ||
|
||
## sshnpd | ||
|
||
### Installation | ||
|
||
The `sshnpd.service` file should be placed in `/etc/systemd/system` (as root). | ||
|
||
Modify the `sshnpd.service` unit to use the appropriate host and client atSigns, | ||
(The boilerplate uses @device_atsign @manager_atsign) as well as the devicename. | ||
Also change the username and make sure that username running sshnpd has the | ||
.atkeys file in place at '~/.atsign/keys'. | ||
|
||
Run the following command to view full usage information of the sshnpd binary: | ||
```sh | ||
/usr/local/bin/sshnpd | ||
``` | ||
|
||
### Usage | ||
|
||
To enable the service: | ||
|
||
```sh | ||
sudo systemctl enable sshnpd.service | ||
``` | ||
|
||
The services will then start at the next reboot, or can be started immediately | ||
with: | ||
|
||
```sh | ||
sudo systemctl start sshnpd.service | ||
``` | ||
|
||
To view the realtime logs, use journalctl: | ||
|
||
```sh | ||
sudo journalctl -u sshnpd.service | ||
``` | ||
|
||
## srvd | ||
|
||
### Installation | ||
|
||
The `srvd.service` file should be placed in `/etc/systemd/system` (as root). | ||
|
||
Modify the `srvd.service` unit to use the appropriate atSign, | ||
(The boilerplate uses @atsign) as well as the internet address. | ||
Also change the username and make sure that username running srvd has the | ||
.atkeys file in place at '~/.atsign/keys'. | ||
|
||
Run the following command to view full usage information of the srvd binary: | ||
```sh | ||
/usr/local/bin/srvd | ||
``` | ||
|
||
### Usage | ||
|
||
To enable the service use: | ||
|
||
```sh | ||
sudo systemctl enable srvd.service | ||
``` | ||
|
||
The services will then start at the next reboot, or can be started immediately | ||
with: | ||
|
||
```sh | ||
sudo systemctl start srvd.service | ||
``` | ||
|
||
To view the realtime logs, use journalctl: | ||
|
||
```sh | ||
sudo journalctl -u srvd.service | ||
``` | ||
# Systemd Units | ||
|
||
This directory contains systemd unit definitions for running various | ||
components of the NoPorts suite. | ||
|
||
## sshnpd | ||
|
||
### Installation | ||
|
||
The `sshnpd.service` file should be placed in `/etc/systemd/system` (as root). | ||
|
||
The `sshnpd.service` unit `override.conf` can be modified by running: | ||
|
||
```sh | ||
sudo systemctl edit sshnpd | ||
``` | ||
|
||
It should be edited to use the appropriate host and client atSigns, (The | ||
boilerplate uses @device_atsign @manager_atsign) as well as the devicename. | ||
Also change the username and make sure that username running sshnpd has the | ||
.atkeys file in place at '~/.atsign/keys'. | ||
|
||
Run the following command to view full usage information of the sshnpd binary: | ||
```sh | ||
/usr/local/bin/sshnpd | ||
``` | ||
|
||
### Usage | ||
|
||
To enable the service: | ||
|
||
```sh | ||
sudo systemctl enable sshnpd | ||
``` | ||
|
||
The services will then start at the next reboot, or can be started immediately | ||
with: | ||
|
||
```sh | ||
sudo systemctl start sshnpd | ||
``` | ||
|
||
To view the realtime logs, use journalctl: | ||
|
||
```sh | ||
journalctl -u sshnpd -f | ||
``` | ||
|
||
## srvd | ||
|
||
### Installation | ||
|
||
The `srvd.service` file should be placed in `/etc/systemd/system` (as root). | ||
|
||
The `srvd.service` unit `override.conf` can be modified by running: | ||
|
||
```sh | ||
sudo systemctl edit ssrvd | ||
``` | ||
|
||
It should be edited to use the appropriate atSign, | ||
(The boilerplate uses @atsign) as well as the internet address. | ||
Also change the username and make sure that username running srvd has the | ||
.atkeys file in place at '~/.atsign/keys'. | ||
|
||
Run the following command to view full usage information of the srvd binary: | ||
|
||
```sh | ||
/usr/local/bin/srvd | ||
``` | ||
|
||
### Usage | ||
|
||
To enable the service use: | ||
|
||
```sh | ||
sudo systemctl enable srvd | ||
``` | ||
|
||
The services will then start at the next reboot, or can be started immediately | ||
with: | ||
|
||
```sh | ||
sudo systemctl start srvd | ||
``` | ||
|
||
To view the realtime logs, use journalctl: | ||
|
||
```sh | ||
journalctl -u srvd -f | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Configuration of srvd service | ||
# This override configuration is a template for the srvd service. | ||
# You can configure the service by editing the variables below. | ||
# This ovverride config covers the common configuration options for srvd. | ||
# To see all available options, run `srvd` with no arguments. | ||
|
||
[Service] | ||
|
||
# MANDATORY: User to run the daemon as | ||
User=<username> | ||
|
||
# MANDATORY: Srvd atSign | ||
Environment=atsign="@my_rvd" | ||
|
||
# MANDATORY: Public FQDN or IP address of the machine running the srvd | ||
Environment=internet_address="" | ||
|
||
# Any additional command line arguments for srvd | ||
Environment=additional_args="" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,6 @@ | |
Description=Ssh No Ports Daemon | ||
After=network-online.target | ||
|
||
# Uncomment the following line to make this unit fail if sshd isn't started first | ||
; Requisite=sshd.service | ||
|
||
# Uncomment the following line to make this unit auto-start sshd if it isn't started | ||
; Requires=sshd.service | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
|
||
|
@@ -16,36 +10,7 @@ Type=simple | |
Restart=always | ||
RestartSec=3 | ||
|
||
# Configuration of sshnpd service | ||
# This unit script is a template for the sshnpd background service. | ||
# You can configure the service by editing the variables below. | ||
# This service file covers the common configuration options for sshnpd. | ||
# To see all available options, run `sshnpd` with no arguments. | ||
|
||
# MANDATORY: User to run the daemon as | ||
User=<username> | ||
|
||
# MANDATORY: Manager/client address (atSign) | ||
Environment=manager_atsign="@example_client" | ||
|
||
# MANDATORY: Device address (atSign) | ||
Environment=device_atsign="@example_device" | ||
|
||
# OPTIONAL: Delegated access policy management | ||
Environment=delegate_policy="" | ||
|
||
# Device name | ||
Environment=device_name="default" | ||
|
||
# Comment if you don't want the daemon to update authorized_keys to include public keys sent by authorized manager atSigns | ||
Environment=s="-s" | ||
|
||
# Comment if you don't want the daemon to share various information with the manager atsign - e.g. username, version, etc - without the manager atSign needing to know this daemon's device name | ||
Environment=u="-u" | ||
|
||
# Comment to disable verbose logging | ||
Environment=v="-v" | ||
|
||
# The line below runs the sshnpd service, with the options set above. | ||
# You can edit this line to further customize the service to your needs. | ||
ExecStart=/usr/local/bin/sshnpd -a "$device_atsign" -m "$manager_atsign" -d "$device_name" "$delegate_policy" "$s" "$u" "$v" | ||
# The line below runs the sshnpd service, with the options set in | ||
# /etc/systemd/system/sshnpd.d/override.conf. | ||
# You can edit that config with: sudo systemctl edit sshnpd | ||
ExecStart=/usr/local/bin/sshnpd -a "$device_atsign" -m "$manager_atsign" -d "$device_name" "$delegate_policy" "$s" "$u" "$v" "$additional_args" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One thing I've been meaning to address, which may be suitable as part of this changeset is that when we use policy only the manager configuration will be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can change it to: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can also be done in a later PR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking this should actually be something like One option might be to wrap our command line inside a shell invocation, but I'm wary of creating a deeper process tree. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like the safest option is to allow sshnpd to try to pull those from the environment if they aren't explicitly passed. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Configuration of sshnpd service | ||
# This override configuration is a template for the sshnpd service. | ||
# You can configure the service by editing the variables below. | ||
# This service file covers the common configuration options for sshnpd. | ||
# To see all available options, run `sshnpd` with no arguments. | ||
|
||
[Unit] | ||
|
||
# Uncomment the following line to make this unit fail if sshd isn't started first | ||
; Requisite=sshd.service | ||
|
||
# Uncomment the following line to make this unit auto-start sshd if it isn't started | ||
; Requires=sshd.service | ||
|
||
[Service] | ||
|
||
# MANDATORY: User to run the daemon as | ||
User=<username> | ||
|
||
# MANDATORY: Manager (client) or policy manager address (atSign) | ||
Environment=manager_atsign="@example_client" | ||
|
||
# MANDATORY: Device address (atSign) | ||
Environment=device_atsign="@example_device" | ||
|
||
# OPTIONAL: Delegated access policy management | ||
Environment=delegate_policy="" | ||
|
||
# Device name | ||
Environment=device_name="default" | ||
|
||
# Comment if you don't want the daemon to update authorized_keys to include | ||
# public keys sent by authorized manager atSigns | ||
Environment=s="-s" | ||
|
||
# Comment to disable verbose logging | ||
Environment=v="-v" | ||
|
||
# Any additional command line arguments for sshnpd | ||
Environment=additional_args="" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been the focus of my testing for the past few days - making sure that we can migrate existing config into the new approach.