summaryrefslogtreecommitdiff
path: root/src/systemd
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-06-18 23:04:46 +0200
committerChristian Poessinger <christian@poessinger.com>2020-06-18 23:04:48 +0200
commite59da2923cbbb21258cc9769b6a152d6af78abe6 (patch)
tree3a54084962628c6faf15299daab3067586453625 /src/systemd
parent067ddcf27ac1fbc33cee710ae66a85b0368a26d9 (diff)
downloadvyos-1x-e59da2923cbbb21258cc9769b6a152d6af78abe6.tar.gz
vyos-1x-e59da2923cbbb21258cc9769b6a152d6af78abe6.zip
console-server: T2490: add SSH support
A user can define a port under the SSH node per device. WHen connecting to that port and authenticating using regular credentials we will immediately drop to the serial console. This is the same as executing "connect serial-proxy <name>".
Diffstat (limited to 'src/systemd')
-rw-r--r--src/systemd/dropbear@.service14
-rw-r--r--src/systemd/dropbearkey.service11
2 files changed, 25 insertions, 0 deletions
diff --git a/src/systemd/dropbear@.service b/src/systemd/dropbear@.service
new file mode 100644
index 000000000..a4df6ad41
--- /dev/null
+++ b/src/systemd/dropbear@.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Dropbear SSH per-connection server
+Requires=dropbearkey.service
+Wants=conserver-server.service
+After=mongodb.service
+After=dropbearkey.service vyos-router.service conserver-server.service
+
+[Service]
+Type=forking
+ExecStartPre=/usr/bin/bash -c '/usr/bin/systemctl set-environment PORT=$(cli-shell-api returnValue service serial-proxy device "%I" ssh port)'
+ExecStart=-/usr/sbin/dropbear -w -j -k -r /etc/dropbear/dropbear_rsa_host_key -c "/usr/bin/console %I" -P /run/conserver/dropbear.%I.pid -p ${PORT}
+PIDFile=/run/conserver/dropbear.%I.pid
+KillMode=process
+
diff --git a/src/systemd/dropbearkey.service b/src/systemd/dropbearkey.service
new file mode 100644
index 000000000..770641c8b
--- /dev/null
+++ b/src/systemd/dropbearkey.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Dropbear SSH Key Generation
+ConditionPathExists=|!/etc/dropbear/dropbear_rsa_host_key
+
+[Service]
+ExecStart=/usr/bin/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
+