[PATCH openbmc 3/3] obmc-console: Add ssh endpoint

OpenBMC Patches openbmc-patches at stwcx.xyz
Thu Apr 14 16:30:35 AEST 2016


From: Jeremy Kerr <jk at ozlabs.org>

Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
---
 .../recipes-phosphor/obmc-console/obmc-console.bb    | 20 +++++++++++++++++++-
 .../obmc-console/obmc-console-ssh.socket             | 11 +++++++++++
 .../obmc-console/obmc-console-ssh at .service           | 11 +++++++++++
 3 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 meta-phosphor/common/recipes-phosphor/obmc-console/obmc-console/obmc-console-ssh.socket
 create mode 100644 meta-phosphor/common/recipes-phosphor/obmc-console/obmc-console/obmc-console-ssh at .service

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-console/obmc-console.bb b/meta-phosphor/common/recipes-phosphor/obmc-console/obmc-console.bb
index 75a1d84..e5553fe 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-console/obmc-console.bb
+++ b/meta-phosphor/common/recipes-phosphor/obmc-console/obmc-console.bb
@@ -10,12 +10,30 @@ inherit autotools
 TARGET_CFLAGS   += "-fpic -O2"
 
 SRC_URI += "git://github.com/openbmc/obmc-console"
-SRC_URI += "file://${PN}.conf"
+SRC_URI += "file://${PN}.conf \
+	    file://obmc-console-ssh.socket \
+	    file://obmc-console-ssh@.service"
+
 SRCREV = "2eacda524e98c7964e542e01aabf82360cf60344"
 
+FILES_${PN} += "${systemd_unitdir}/system/obmc-console-ssh at .service \
+		${systemd_unitdir}/system/obmc-console-ssh.socket"
+
+SYSTEMD_SERVICE_${PN} = "${BPN}.service ${BPN}-ssh.socket"
+
 do_install_append() {
         install -m 0755 -d ${D}${sysconfdir}
         install -m 0644 ${WORKDIR}/${PN}.conf ${D}${sysconfdir}/${PN}.conf
+
+	# add additional unit files for ssh-based console server
+	install -d ${D}${systemd_unitdir}/system
+	install -m 0644 ${WORKDIR}/obmc-console-ssh at .service ${D}${systemd_unitdir}/system
+	install -m 0644 ${WORKDIR}/obmc-console-ssh.socket ${D}${systemd_unitdir}/system
+	sed -i -e 's, at BASE_BINDIR@,${base_bindir},g' \
+		-e 's, at BINDIR@,${bindir},g' \
+		-e 's, at SBINDIR@,${sbindir},g' \
+		${D}${systemd_unitdir}/system/obmc-console-ssh at .service \
+		${D}${systemd_unitdir}/system/obmc-console-ssh.socket
 }
 
 S = "${WORKDIR}/git"
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-console/obmc-console/obmc-console-ssh.socket b/meta-phosphor/common/recipes-phosphor/obmc-console/obmc-console/obmc-console-ssh.socket
new file mode 100644
index 0000000..3fbfd99
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/obmc-console/obmc-console/obmc-console-ssh.socket
@@ -0,0 +1,11 @@
+[Unit]
+Description=OpenBMC console ssh server socket
+Conflicts=obmc-console-ssh.service
+Requires=obmc-console.service
+
+[Socket]
+ListenStream=2200
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-console/obmc-console/obmc-console-ssh at .service b/meta-phosphor/common/recipes-phosphor/obmc-console/obmc-console/obmc-console-ssh at .service
new file mode 100644
index 0000000..74d5a7a
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/obmc-console/obmc-console/obmc-console-ssh at .service
@@ -0,0 +1,11 @@
+[Unit]
+Description=OBMC console SSH Per-Connection Server
+Wants=obmc-console.service
+
+[Service]
+Environment="DROPBEAR_RSAKEY_DIR=/etc/dropbear"
+EnvironmentFile=-/etc/default/dropbear
+ExecStart=- at SBINDIR@/dropbear -i -r ${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key -c @BINDIR@/obmc-console-client $DROPBEAR_EXTRA_ARGS
+ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID
+StandardInput=socket
+KillMode=process
-- 
2.7.1




More information about the openbmc mailing list