mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Silence sshd messages during install
Fix for accidentally pushed commit c15ba1f9e8
During install we call sshd with no config file, sometimes leading to it
complaining about missing files or bad config options. Since we're just
looking for the return code to see if the options are correct, we can
discard these error messages.
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
@@ -1009,21 +1009,17 @@ if [ -f '/etc/ssh/sshd_config' -a $restore -ge 2 ]; then
|
||||
/^(AuthorizedKeysCommand(User|RunAs)|PubKeyAgentRunAs)[ \t]/ d
|
||||
' /etc/ssh/sshd_config >/etc/ssh/sshd_config.ipanew
|
||||
|
||||
# Prevent complaints about missing host keys by using the configured ones
|
||||
tmp_config=$(mktemp sshd_config.XXXXXX)
|
||||
sed -n '/^HostKey[ \t]/ p' /etc/ssh/sshd_config > $tmp_config
|
||||
|
||||
if /usr/sbin/sshd -t -f $tmp_config -o 'AuthorizedKeysCommand=/usr/bin/sss_ssh_authorizedkeys' -o 'AuthorizedKeysCommandUser=nobody'; then
|
||||
if /usr/sbin/sshd -t -f /dev/null -o 'AuthorizedKeysCommand=/usr/bin/sss_ssh_authorizedkeys' -o 'AuthorizedKeysCommandUser=nobody' 2>/dev/null; then
|
||||
sed -ri '
|
||||
s/^PubKeyAgent (.+) %u$/AuthorizedKeysCommand \1/
|
||||
s/^AuthorizedKeysCommand .*$/\0\nAuthorizedKeysCommandUser nobody/
|
||||
' /etc/ssh/sshd_config.ipanew
|
||||
elif /usr/sbin/sshd -t -f $tmp_config -o 'AuthorizedKeysCommand=/usr/bin/sss_ssh_authorizedkeys' -o 'AuthorizedKeysCommandRunAs=nobody'; then
|
||||
elif /usr/sbin/sshd -t -f /dev/null -o 'AuthorizedKeysCommand=/usr/bin/sss_ssh_authorizedkeys' -o 'AuthorizedKeysCommandRunAs=nobody' 2>/dev/null; then
|
||||
sed -ri '
|
||||
s/^PubKeyAgent (.+) %u$/AuthorizedKeysCommand \1/
|
||||
s/^AuthorizedKeysCommand .*$/\0\nAuthorizedKeysCommandRunAs nobody/
|
||||
' /etc/ssh/sshd_config.ipanew
|
||||
elif /usr/sbin/sshd -t -f $tmp_config -o 'PubKeyAgent=/usr/bin/sss_ssh_authorizedkeys %u' -o 'PubKeyAgentRunAs=nobody'; then
|
||||
elif /usr/sbin/sshd -t -f /dev/null -o 'PubKeyAgent=/usr/bin/sss_ssh_authorizedkeys %u' -o 'PubKeyAgentRunAs=nobody' 2>/dev/null; then
|
||||
sed -ri '
|
||||
s/^AuthorizedKeysCommand (.+)$/PubKeyAgent \1 %u/
|
||||
s/^PubKeyAgent .*$/\0\nPubKeyAgentRunAs nobody/
|
||||
|
||||
Reference in New Issue
Block a user