fix: gitea_ci needs a login shell

deploy-metrics failed on the metrics host with

  This account is currently not available.

which is /usr/sbin/nologin refusing 'ssh gitea_ci@host <command>' after
the key has already authenticated.

The --shell /usr/sbin/nologin came in with the rest of the provisioning
block copied from lair/mail. It had never surfaced because gitea_ci
already existed with /bin/bash on every host touched so far -- bob,
benjy, oolon, slartibartfast all have bash. The metrics host is the
first account this script actually created, so it is the first to have
the bug.

Creates with /bin/bash and repairs an existing nologin account, since
otherwise a re-run leaves the host permanently undeployable. Applied to
all three roles, not just the one that failed.

Note lair/mail carries the same line and would hit this on any genuinely
new host.
This commit is contained in:
Rob Thijssen
2026-08-31 18:51:54 +03:00
parent 2c896ed618
commit 76fd8073c0
2 changed files with 42 additions and 3 deletions
+9
View File
@@ -52,6 +52,15 @@ without re-measuring:
- Node Prometheus is on **9615**, not 9616. Upstream's `MINING.md` parameter
table is wrong about this; the running binary is the authority.
## `gitea_ci` needs a real shell
Create it with `/bin/bash`, never `/usr/sbin/nologin`. The deploy runs
`ssh gitea_ci@host <command>`; a nologin shell authenticates the key and then
refuses the command with "This account is currently not available". Every
pre-existing `gitea_ci` on the fleet has bash — `infra-setup.sh` repairs one that
does not, because a host provisioned with nologin can never be deployed to and
the failure looks like an auth problem rather than a shell one.
## Hardening knobs that are load-bearing
`RestrictAddressFamilies` on the node **must** include `AF_NETLINK`. libp2p calls
+33 -3
View File
@@ -80,13 +80,23 @@ provision_node() {
ssh "${ADMIN_USER}@${host}" "sudo bash -seu -- '$(cat "$PUBKEY")'" <<'REMOTE'
PUBKEY="$1"
# /bin/bash, NOT nologin. The deploy runs `ssh gitea_ci@host <command>`, and
# a nologin shell refuses that with "This account is currently not
# available": the key authenticates, then the command cannot run. Every
# pre-existing gitea_ci on this fleet has bash, so a nologin one is a bug —
# repair it rather than leaving a host that can never be deployed to.
if ! getent passwd gitea_ci >/dev/null; then
useradd --system --create-home --home-dir /var/lib/gitea_ci \
--shell /usr/sbin/nologin gitea_ci
--shell /bin/bash gitea_ci
echo " + created gitea_ci"
else
echo " = gitea_ci already present"
fi
cur=$(getent passwd gitea_ci | cut -d: -f7)
if [ "$cur" != /bin/bash ]; then
usermod -s /bin/bash gitea_ci
echo " ~ gitea_ci shell was ${cur} — set to /bin/bash so ssh commands can run"
fi
install -d -o gitea_ci -g gitea_ci -m 0700 /var/lib/gitea_ci/.ssh
ak=/var/lib/gitea_ci/.ssh/authorized_keys
@@ -143,13 +153,23 @@ provision_miner() {
ssh "${ADMIN_USER}@${host}" "sudo bash -seu -- '$(cat "$PUBKEY")'" <<'REMOTE'
PUBKEY="$1"
# /bin/bash, NOT nologin. The deploy runs `ssh gitea_ci@host <command>`, and
# a nologin shell refuses that with "This account is currently not
# available": the key authenticates, then the command cannot run. Every
# pre-existing gitea_ci on this fleet has bash, so a nologin one is a bug —
# repair it rather than leaving a host that can never be deployed to.
if ! getent passwd gitea_ci >/dev/null; then
useradd --system --create-home --home-dir /var/lib/gitea_ci \
--shell /usr/sbin/nologin gitea_ci
--shell /bin/bash gitea_ci
echo " + created gitea_ci"
else
echo " = gitea_ci already present"
fi
cur=$(getent passwd gitea_ci | cut -d: -f7)
if [ "$cur" != /bin/bash ]; then
usermod -s /bin/bash gitea_ci
echo " ~ gitea_ci shell was ${cur} — set to /bin/bash so ssh commands can run"
fi
install -d -o gitea_ci -g gitea_ci -m 0700 /var/lib/gitea_ci/.ssh
ak=/var/lib/gitea_ci/.ssh/authorized_keys
@@ -219,13 +239,23 @@ provision_metrics() {
ssh "${ADMIN_USER}@${host}" "sudo bash -seu -- '$(cat "$PUBKEY")'" <<'REMOTE'
PUBKEY="$1"
# /bin/bash, NOT nologin. The deploy runs `ssh gitea_ci@host <command>`, and
# a nologin shell refuses that with "This account is currently not
# available": the key authenticates, then the command cannot run. Every
# pre-existing gitea_ci on this fleet has bash, so a nologin one is a bug —
# repair it rather than leaving a host that can never be deployed to.
if ! getent passwd gitea_ci >/dev/null; then
useradd --system --create-home --home-dir /var/lib/gitea_ci \
--shell /usr/sbin/nologin gitea_ci
--shell /bin/bash gitea_ci
echo " + created gitea_ci"
else
echo " = gitea_ci already present"
fi
cur=$(getent passwd gitea_ci | cut -d: -f7)
if [ "$cur" != /bin/bash ]; then
usermod -s /bin/bash gitea_ci
echo " ~ gitea_ci shell was ${cur} — set to /bin/bash so ssh commands can run"
fi
install -d -o gitea_ci -g gitea_ci -m 0700 /var/lib/gitea_ci/.ssh
ak=/var/lib/gitea_ci/.ssh/authorized_keys
touch "$ak"