new file mode 100644
@@ -0,0 +1,2 @@
+[Socket]
+ExecStartPre=/sbin/restorecon /var/run/sshd
@@ -4,15 +4,21 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
SRC_URI += " \
file://50-selinux.conf \
+ file://var-run-sshd-restorecon.conf \
"
do_install:append() {
install -d ${D}${sysconfdir}/ssh/sshd_config.d
install -m 0644 ${UNPACKDIR}/50-selinux.conf \
${D}${sysconfdir}/ssh/sshd_config.d/50-selinux.conf
+
+ install -d ${D}${systemd_system_unitdir}/sshd.socket.d
+ install -m 0644 ${UNPACKDIR}/var-run-sshd-restorecon.conf \
+ ${D}${systemd_system_unitdir}/sshd.socket.d/var-run-sshd-restorecon.conf
}
FILES:${PN}-sshd:append = " ${sysconfdir}/ssh/sshd_config.d/50-selinux.conf"
+FILES:${PN}-sshd:append = " ${systemd_system_unitdir}/sshd.socket.d/var-run-sshd-restorecon.conf"
PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
PACKAGECONFIG[audit] = "--with-audit=linux,--without-audit,audit"
Since /var/run/sshd is in most deployments a tmpfs, we need to call restorecon to set the correct SELinux labels each time. Signed-off-by: Yannik Tannhaeuser <yannik.tannhaeuser@gmail.com> --- .../openssh/files/var-run-sshd-restorecon.conf | 2 ++ recipes-connectivity/openssh/openssh_selinux.inc | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 recipes-connectivity/openssh/files/var-run-sshd-restorecon.conf