openssh: don't overwrite sshd_config unconditionally
PATCH 1/1 openssh: don't overwrite sshd_config unconditionally
From: Nisha Parrakat <[email protected]>
The current implementation was overwriting the sshd_config and sshd assuming PAM is needed by default
openssh should use the default sshd_config packaged with the component if no distro specific needs are present and not overwrite the full sshd_config file
1. If PAM is enabled as a distro then enable the UsePAM option in sshd_config
2. Moved the file sshd to pam directory so that when pam is enabled, then replace the default from poky by installing the same
Signed-off-by Ranjitsinh Rathod <[email protected]>
Signed-off-by Ranjitsinh Rathod <[email protected]>
---
.../openssh/files/{ => pam}/sshd | 0
.../openssh/files/sshd_config | 118 ------------------
.../openssh/openssh_%.bbappend | 14 +++
3 files changed, 14 insertions(+), 118 deletions(-)
rename recipes-connectivity/openssh/files/{ => pam}/sshd (100%)
delete mode 100644 recipes-connectivity/openssh/files/sshd_configrecipes-connectivity/openssh/files/pam/sshd renamed from recipes-connectivity/openssh/files/sshd +0 -0
recipes-connectivity/openssh/files/sshd_config deleted +0 -118
118 lines not on this page · raw message
recipes-connectivity/openssh/openssh_%.bbappend +14 -0
@@ -1 +1,15 @@ require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)} + +# if pam feature is enabled in the distro then take sshd from the pam directory. +FILESEXTRAPATHS_prepend := "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${THISDIR}/files/pam:', '', d)}" + +do_install_append(){ + + if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then + # Make sure UsePAM entry is in the sshd_config file. + # If entry not present then append it. + grep -q 'UsePAM' "${D}/etc/ssh/sshd_config" && \ + sed -i 's/.*UsePAM.*/UsePAM yes/' "${D}/etc/ssh/sshd_config" || \ + echo 'UsePAM yes' >> "${D}/etc/ssh/sshd_config" + fi +}
Signature · 1 line
2.17.1