diff options
author | Mike Frysinger <vapier@gentoo.org> | 2018-06-20 17:34:49 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2018-06-20 22:25:39 -0400 |
commit | 3b9f17df19b6c64674257cf039d647ed6a2b99aa (patch) | |
tree | b8b1d9527bb9d591df6697c8b49cba1c9f581396 | |
parent | sys-apps/xinetd: switch to upstream systemd service unit (diff) | |
download | gentoo-3b9f17df19b6c64674257cf039d647ed6a2b99aa.tar.gz gentoo-3b9f17df19b6c64674257cf039d647ed6a2b99aa.tar.bz2 gentoo-3b9f17df19b6c64674257cf039d647ed6a2b99aa.zip |
net-misc/openssh: move ssh{,d}_config tweaks to a sep func
No functional changes here. Should make managing src_install easier
as all the sshd_config/ssh_config changes are kept separate.
-rw-r--r-- | net-misc/openssh/openssh-7.7_p1-r101.ebuild | 44 | ||||
-rw-r--r-- | net-misc/openssh/openssh-7.7_p1-r5.ebuild | 44 |
2 files changed, 52 insertions, 36 deletions
diff --git a/net-misc/openssh/openssh-7.7_p1-r101.ebuild b/net-misc/openssh/openssh-7.7_p1-r101.ebuild index 69618e6b249c..d330358e032d 100644 --- a/net-misc/openssh/openssh-7.7_p1-r101.ebuild +++ b/net-misc/openssh/openssh-7.7_p1-r101.ebuild @@ -328,40 +328,48 @@ src_test() { [[ ${#failed[@]} -gt 0 ]] && die "Some tests failed: ${failed[*]}" } -src_install() { - emake install-nokeys DESTDIR="${D}" - fperms 600 /etc/ssh/sshd_config - dobin contrib/ssh-copy-id - newinitd "${FILESDIR}"/sshd.rc6.5 sshd - newconfd "${FILESDIR}"/sshd-r1.confd sshd - - newpamd "${FILESDIR}"/sshd.pam_include.2 sshd - if use pam ; then - sed -i \ - -e "/^#UsePAM /s:.*:UsePAM yes:" \ - -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \ - -e "/^#PrintMotd /s:.*:PrintMotd no:" \ - -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \ - "${ED%/}"/etc/ssh/sshd_config || die - fi - - # Gentoo tweaks to default config files +# Gentoo tweaks to default config files. +tweak_ssh_configs() { + # First the server config. cat <<-EOF >> "${ED%/}"/etc/ssh/sshd_config # Allow client to pass locale environment variables #367017 AcceptEnv LANG LC_* EOF + + # Then the client config. cat <<-EOF >> "${ED%/}"/etc/ssh/ssh_config # Send locale environment variables #367017 SendEnv LANG LC_* EOF + if use pam ; then + sed -i \ + -e "/^#UsePAM /s:.*:UsePAM yes:" \ + -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \ + -e "/^#PrintMotd /s:.*:PrintMotd no:" \ + -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \ + "${ED%/}"/etc/ssh/sshd_config || die + fi + if use livecd ; then sed -i \ -e '/^#PermitRootLogin/c# Allow root login with password on livecds.\nPermitRootLogin Yes' \ "${ED%/}"/etc/ssh/sshd_config || die fi +} + +src_install() { + emake install-nokeys DESTDIR="${D}" + fperms 600 /etc/ssh/sshd_config + dobin contrib/ssh-copy-id + newinitd "${FILESDIR}"/sshd.rc6.5 sshd + newconfd "${FILESDIR}"/sshd-r1.confd sshd + + newpamd "${FILESDIR}"/sshd.pam_include.2 sshd + + tweak_ssh_configs if use ldap && [[ -n ${LDAP_PATCH} ]] ; then insinto /etc/openldap/schema/ diff --git a/net-misc/openssh/openssh-7.7_p1-r5.ebuild b/net-misc/openssh/openssh-7.7_p1-r5.ebuild index 8ce813c89ca3..cadc21098354 100644 --- a/net-misc/openssh/openssh-7.7_p1-r5.ebuild +++ b/net-misc/openssh/openssh-7.7_p1-r5.ebuild @@ -328,40 +328,48 @@ src_test() { [[ ${#failed[@]} -gt 0 ]] && die "Some tests failed: ${failed[*]}" } -src_install() { - emake install-nokeys DESTDIR="${D}" - fperms 600 /etc/ssh/sshd_config - dobin contrib/ssh-copy-id - newinitd "${FILESDIR}"/sshd.rc6.5 sshd - newconfd "${FILESDIR}"/sshd-r1.confd sshd - - newpamd "${FILESDIR}"/sshd.pam_include.2 sshd - if use pam ; then - sed -i \ - -e "/^#UsePAM /s:.*:UsePAM yes:" \ - -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \ - -e "/^#PrintMotd /s:.*:PrintMotd no:" \ - -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \ - "${ED%/}"/etc/ssh/sshd_config || die - fi - - # Gentoo tweaks to default config files +# Gentoo tweaks to default config files. +tweak_ssh_configs() { + # First the server config. cat <<-EOF >> "${ED%/}"/etc/ssh/sshd_config # Allow client to pass locale environment variables #367017 AcceptEnv LANG LC_* EOF + + # Then the client config. cat <<-EOF >> "${ED%/}"/etc/ssh/ssh_config # Send locale environment variables #367017 SendEnv LANG LC_* EOF + if use pam ; then + sed -i \ + -e "/^#UsePAM /s:.*:UsePAM yes:" \ + -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \ + -e "/^#PrintMotd /s:.*:PrintMotd no:" \ + -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \ + "${ED%/}"/etc/ssh/sshd_config || die + fi + if use livecd ; then sed -i \ -e '/^#PermitRootLogin/c# Allow root login with password on livecds.\nPermitRootLogin Yes' \ "${ED%/}"/etc/ssh/sshd_config || die fi +} + +src_install() { + emake install-nokeys DESTDIR="${D}" + fperms 600 /etc/ssh/sshd_config + dobin contrib/ssh-copy-id + newinitd "${FILESDIR}"/sshd.rc6.5 sshd + newconfd "${FILESDIR}"/sshd-r1.confd sshd + + newpamd "${FILESDIR}"/sshd.pam_include.2 sshd + + tweak_ssh_configs if use ldap && [[ -n ${LDAP_PATCH} ]] ; then insinto /etc/openldap/schema/ |