aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2021-02-18 12:22:37 +0100
committerGuilhem Moulin <guilhem@fripost.org>2021-02-20 20:16:34 +0100
commit57afbf387cf812945ad14cd03570b0746fc4c865 (patch)
tree97131d771115348d7b5a45fc8df02b9a3456bb9e /tests
parent3e49ef22ba3fbbe4e73bc4ad151770603ffa5ef1 (diff)
Document spawning a remote lacme-accountd(1) instance.
And add a test case for this.
Diffstat (limited to 'tests')
-rw-r--r--tests/accountd-remote33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/accountd-remote b/tests/accountd-remote
new file mode 100644
index 0000000..71bb8e2
--- /dev/null
+++ b/tests/accountd-remote
@@ -0,0 +1,33 @@
+# Remote accountd server process
+
+adduser --disabled-password --shell /bin/sh \
+ --home /home/lacme-account \
+ --gecos "lacme account user" \
+ --quiet lacme-account
+
+chown lacme-account: /etc/lacme/account.key
+
+DEBIAN_FRONTEND="noninteractive" apt install -y --no-install-recommends \
+ openssh-client openssh-server
+ssh-keygen -N "" -f ~root/.ssh/id_rsa
+
+install -olacme-account -glacme-account -dm0700 ~lacme-account/.ssh
+install -olacme-account -glacme-account -m0644 ~root/.ssh/id_rsa.pub ~lacme-account/.ssh/authorized_keys
+{ echo -n "[127.0.0.1]:2222 "; cat /etc/ssh/ssh_host_rsa_key.pub; } >~root/.ssh/known_hosts
+
+cat >/etc/ssh/sshd_config <<-EOF
+ Port 2222
+ ListenAddress 127.0.0.1
+ ChallengeResponseAuthentication no
+ PasswordAuthentication no
+ UsePAM yes
+EOF
+install -oroot -groot -dm0755 /run/sshd
+/usr/sbin/sshd
+
+sed -ri 's|^#?command\s*=.*/lacme-accountd$|command = ssh -Tp2222 -llacme-account 127.0.0.1 lacme-accountd|' /etc/lacme/lacme.conf
+sed -ri 's|^#?config\s*=.*|config = /etc/lacme/lacme-accountd.conf|' /etc/lacme/lacme.conf
+lacme newOrder --debug 2>"$STDERR" || fail # intentionally use --debug, ssh should tunnel stdin + stdout + stderr
+test /etc/lacme/simpletest.rsa.crt -nt /etc/lacme/simpletest.rsa.key
+
+# vim: set filetype=sh :