Skip to content

Commit

Permalink
refactor: rename ssh services (#3548)
Browse files Browse the repository at this point in the history
Renames:

- `setup-ssh-account-keys` --> `setup-ssh-user-keys`
- `setup-ssh-keys` --> `generate-host-ssh-keys`
  • Loading branch information
andrewbattat authored Jan 22, 2025
1 parent 14ba37e commit a4dd638
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion ic-os/boundary-guestos/context/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ serve as a guide on how to add further actions.

=== ssh key generation

The `setup-ssh-keys` (and corresponding shell script) service performs one of
The `generate-host-ssh-keys` (and corresponding shell script) service performs one of
two things: If this is the first boot ever (on a newly installed system), it
generates ssh keys and stashes them away in a location that is preserved across
reboots and in the future upgrades.
Expand Down
8 changes: 4 additions & 4 deletions ic-os/boundary-guestos/docs/Boot.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ service are started in the IC-OS boot sequence:
- Config injection
- Set up ssh account keys
- Set up ssh user keys
- Generate network configuration
Expand Down Expand Up @@ -53,7 +53,7 @@ Relevant information can be found in the guestos link:../../guestos/docs/Boot.ad

== Set up ssh host keys

Service: `setup-ssh-keys.service`, script: `/opt/ic/bin/setup-ssh-keys.sh`,
Service: `generate-host-ssh-keys.service`, script: `/opt/ic/bin/generate-host-ssh-keys.sh`,
depends on `/boot/config` mount.

This checks if ssh host keys for the system exist in the `config` partition
Expand Down Expand Up @@ -83,9 +83,9 @@ USB stick" attached to the VM that contains a tar file with initial configuratio
for parts of the system (see link:ConfigStore{outfilesuffix}[config store] for a description). Required
files in the `config` partition as well as payload store are created.

== Set up ssh account keys
== Set up ssh user keys

Service: `setup-ssh-account-keys.services`, script `/opt/ic/bin/setup-ssh-account-keys.sh`.
Service: `setup-ssh-user-keys.services`, script `/opt/ic/bin/setup-ssh-user-keys.sh`.
Depends on `bootstrap-ic-node.service`.

The `authorized_keys` files for the role accounts are taken from the
Expand Down
8 changes: 4 additions & 4 deletions ic-os/components/boundary-guestos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ component_files = {
Label("boundary-guestos/etc/systemd/system/setup-ic-gateway.service"): "/etc/systemd/system/setup-ic-gateway.service",
Label("boundary-guestos/etc/systemd/system/setup-lvs.service"): "/etc/systemd/system/setup-lvs.service",
Label("boundary-guestos/etc/systemd/system/setup-nftables.service"): "/etc/systemd/system/setup-nftables.service",
Label("boundary-guestos/etc/systemd/system/setup-ssh-account-keys.service"): "/etc/systemd/system/setup-ssh-account-keys.service",
Label("boundary-guestos/etc/systemd/system/setup-ssh-keys.service"): "/etc/systemd/system/setup-ssh-keys.service",
Label("boundary-guestos/etc/systemd/system/setup-ssh-user-keys.service"): "/etc/systemd/system/setup-ssh-user-keys.service",
Label("boundary-guestos/etc/systemd/system/generate-host-ssh-keys.service"): "/etc/systemd/system/generate-host-ssh-keys.service",
Label("boundary-guestos/etc/systemd/system/setup-var-log.service"): "/etc/systemd/system/setup-var-log.service",
Label("boundary-guestos/etc/systemd/system/setup-vector.service"): "/etc/systemd/system/setup-vector.service",
Label("boundary-guestos/etc/systemd/system/setup-version-metric.service"): "/etc/systemd/system/setup-version-metric.service",
Expand Down Expand Up @@ -86,8 +86,8 @@ component_files = {
Label("boundary-guestos/opt/ic/bin/setup-ic-gateway.sh"): "/opt/ic/bin/setup-ic-gateway.sh",
Label("boundary-guestos/opt/ic/bin/setup-lvs.sh"): "/opt/ic/bin/setup-lvs.sh",
Label("boundary-guestos/opt/ic/bin/setup-nftables.sh"): "/opt/ic/bin/setup-nftables.sh",
Label("boundary-guestos/opt/ic/bin/setup-ssh-account-keys.sh"): "/opt/ic/bin/setup-ssh-account-keys.sh",
Label("boundary-guestos/opt/ic/bin/setup-ssh-keys.sh"): "/opt/ic/bin/setup-ssh-keys.sh",
Label("boundary-guestos/opt/ic/bin/setup-ssh-user-keys.sh"): "/opt/ic/bin/setup-ssh-user-keys.sh",
Label("boundary-guestos/opt/ic/bin/generate-host-ssh-keys.sh"): "/opt/ic/bin/generate-host-ssh-keys.sh",
Label("boundary-guestos/opt/ic/bin/setup-var-encryption.sh"): "/opt/ic/bin/setup-var-encryption.sh",
Label("boundary-guestos/opt/ic/bin/setup-var-log.sh"): "/opt/ic/bin/setup-var-log.sh",
Label("boundary-guestos/opt/ic/bin/setup-vector.sh"): "/opt/ic/bin/setup-vector.sh",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
Description=Bootstrap the IC node
Requires=var-log.mount
After=var-log.mount
Before=setup-ssh-account-keys.service
Before=setup-ssh-user-keys.service

[Install]
WantedBy=multi-user.target
RequiredBy=setup-ssh-account-keys.service
RequiredBy=setup-ssh-user-keys.service

[Service]
Type=oneshot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Before=ssh.service
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/opt/ic/bin/setup-ssh-keys.sh
ExecStart=/opt/ic/bin/generate-host-ssh-keys.sh

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Unit]
Description=Set up ssh account keys
Description=Set up ssh user keys
Before=ssh.service
# bootstrap-ic-node.service (if it exists) lists this service as a reverse dependency

Expand All @@ -9,7 +9,7 @@ WantedBy=multi-user.target
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/opt/ic/bin/setup-ssh-account-keys.sh
ExecStart=/opt/ic/bin/setup-ssh-user-keys.sh

# All services that networking depends on log their outputs to the console
# and are piped to the host terminal if the verbose flag is enabled.
Expand Down
8 changes: 4 additions & 4 deletions ic-os/components/guestos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ component_files = {

# ssh
Label("ssh/provision-ssh-keys.sh"): "/opt/ic/bin/provision-ssh-keys.sh",
Label("ssh/setup-ssh-keys/setup-ssh-keys.sh"): "/opt/ic/bin/setup-ssh-keys.sh",
Label("ssh/setup-ssh-keys/setup-ssh-keys.service"): "/etc/systemd/system/setup-ssh-keys.service",
Label("ssh/setup-ssh-account-keys/setup-ssh-account-keys.sh"): "/opt/ic/bin/setup-ssh-account-keys.sh",
Label("ssh/setup-ssh-account-keys/setup-ssh-account-keys.service"): "/etc/systemd/system/setup-ssh-account-keys.service",
Label("ssh/generate-host-ssh-keys/generate-host-ssh-keys.sh"): "/opt/ic/bin/generate-host-ssh-keys.sh",
Label("ssh/generate-host-ssh-keys/generate-host-ssh-keys.service"): "/etc/systemd/system/generate-host-ssh-keys.service",
Label("ssh/setup-ssh-user-keys/setup-ssh-user-keys.sh"): "/opt/ic/bin/setup-ssh-user-keys.sh",
Label("ssh/setup-ssh-user-keys/setup-ssh-user-keys.service"): "/etc/systemd/system/setup-ssh-user-keys.service",
Label("ssh/read-ssh-keys.sh"): "/opt/ic/bin/read-ssh-keys.sh",

# upgrade
Expand Down
8 changes: 4 additions & 4 deletions ic-os/components/hostos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ component_files = {
Label("networking/hosts"): "/etc/hosts",

# ssh
Label("ssh/setup-ssh-keys/setup-ssh-keys.sh"): "/opt/ic/bin/setup-ssh-keys.sh",
Label("ssh/setup-ssh-keys/setup-ssh-keys.service"): "/etc/systemd/system/setup-ssh-keys.service",
Label("ssh/setup-ssh-account-keys/setup-ssh-account-keys.sh"): "/opt/ic/bin/setup-ssh-account-keys.sh",
Label("ssh/setup-ssh-account-keys/setup-ssh-account-keys.service"): "/etc/systemd/system/setup-ssh-account-keys.service",
Label("ssh/generate-host-ssh-keys/generate-host-ssh-keys.sh"): "/opt/ic/bin/generate-host-ssh-keys.sh",
Label("ssh/generate-host-ssh-keys/generate-host-ssh-keys.service"): "/etc/systemd/system/generate-host-ssh-keys.service",
Label("ssh/setup-ssh-user-keys/setup-ssh-user-keys.sh"): "/opt/ic/bin/setup-ssh-user-keys.sh",
Label("ssh/setup-ssh-user-keys/setup-ssh-user-keys.service"): "/etc/systemd/system/setup-ssh-user-keys.service",
Label("ssh/deploy-updated-ssh-account-keys/deploy-updated-ssh-account-keys.sh"): "/opt/ic/bin/deploy-updated-ssh-account-keys.sh",
Label("ssh/deploy-updated-ssh-account-keys/deploy-updated-ssh-account-keys.service"): "/etc/systemd/system/deploy-updated-ssh-account-keys.service",

Expand Down
2 changes: 1 addition & 1 deletion ic-os/components/init/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ serve as a guide on how to add further actions.

== ssh key generation

The +ssh/setup-ssh-keys+ (and corresponding shell script) service performs one of
The +ssh/generate-host-ssh-keys+ (and corresponding shell script) service performs one of
two things: If this is the first boot ever (on a newly installed system), it
generates ssh keys and stashes them away in a location that is preserved across
upgrades. On first boot after an upgrade, it integrates the keys from their
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Requires=var-lib-ic-crypto.mount
After=var-lib-ic-crypto.mount
Requires=var-lib-ic-backup.mount
After=var-lib-ic-backup.mount
Before=setup-ssh-account-keys.service
Before=setup-ssh-user-keys.service

[Install]
WantedBy=multi-user.target
RequiredBy=setup-ssh-account-keys.service
RequiredBy=setup-ssh-user-keys.service

[Service]
Type=oneshot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[Unit]
Description=Update ssh account keys
Before=setup-ssh-account-keys.service
Before=setup-ssh-user-keys.service

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/opt/ic/bin/deploy-updated-ssh-account-keys.sh

[Install]
RequiredBy=setup-ssh-account-keys.service
RequiredBy=setup-ssh-user-keys.service
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Before=ssh.service
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/opt/ic/bin/setup-ssh-keys.sh
ExecStart=/opt/ic/bin/generate-host-ssh-keys.sh

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Unit]
Description=Set up ssh account keys
Description=Set up ssh user keys
Before=ssh.service
# bootstrap-ic-node.service (if it exists) lists this service as a reverse dependency

Expand All @@ -9,7 +9,7 @@ WantedBy=multi-user.target
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/opt/ic/bin/setup-ssh-account-keys.sh
ExecStart=/opt/ic/bin/setup-ssh-user-keys.sh

# All services that networking depends on log their outputs to the console
# and are piped to the host terminal if the verbose flag is enabled.
Expand Down
8 changes: 4 additions & 4 deletions ic-os/guestos/docs/Boot.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ service are started in the IC-OS boot sequence:
- IC node config injection
- Set up ssh account keys
- Set up ssh user keys
- Generate network configuration
Expand Down Expand Up @@ -111,7 +111,7 @@ system will set up its own +/var+ filesystem correctly again.

== Set up ssh host keys

Service: +setup-ssh-keys.service+, script: +/opt/ic/bin/setup-ssh-keys.sh+,
Service: +generate-host-ssh-keys.service+, script: +/opt/ic/bin/generate-host-ssh-keys.sh+,
depends on +/boot/config+ mount.

This checks if ssh host keys for the system exist in the +config+ partition
Expand Down Expand Up @@ -179,9 +179,9 @@ Changes the keys held in the +config+ partition for the +backup+ and +readonly+
is a work-around due to not having a key management solution that updated keys are
deployed via system upgrades.

== Set up ssh account keys
== Set up ssh user keys

Service: +setup-ssh-account-keys.services+, script +/opt/ic/bin/setup-ssh-account-keys.sh+.
Service: +setup-ssh-user-keys.services+, script +/opt/ic/bin/setup-ssh-user-keys.sh+.
Depends on +bootstrap-ic-node.service+.

The +authorized_keys+ files for the role accounts are taken from the
Expand Down

0 comments on commit a4dd638

Please sign in to comment.