summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Lipton <blipton@redhat.com>2016-08-11 15:39:35 +0200
committerMartin Basti <mbasti@redhat.com>2016-08-16 12:17:05 +0200
commit58d28b741022d06d7050db66997fd5d527b99bc1 (patch)
treee9a8da91fee8b537a4ac9c60a8a682ca29765776
parentb92b1d7d7f34cfc45f218d56160d2e502648cf51 (diff)
Silence sshd messages during install
Fix for accidentally pushed commit c15ba1f9e8c7d236586d46271fce7c3950b509da 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>
-rw-r--r--freeipa.spec.in10
1 files changed, 3 insertions, 7 deletions
diff --git a/freeipa.spec.in b/freeipa.spec.in
index 78ab8ca58..ea580a20a 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.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/