Fix wrong path in ssh selinux issue detection.

I also make sure that if grep fail it doesn't make the whole
installation fails.

Change-Id: Ib5873383632a1141c8dd3859b34ca29904020790
Closes-Bug: #1736246
This commit is contained in:
Sofer Athlan-Guyot 2017-12-06 07:54:19 +01:00
parent 758e8caee0
commit 3bea7d156d
1 changed files with 3 additions and 1 deletions

View File

@ -27,7 +27,9 @@ cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
if [ -e /usr/sbin/getenforce ]; then
if [ "$(getenforce)" == "Enforcing" ]; then
selinux_wrong_permission="$(find /home/.ssh/ -exec ls -lZ {} \; | grep -v 'ssh_home_t')"
set +x
selinux_wrong_permission="$(find /root/.ssh/ -exec ls -lZ {} \; | grep -v 'ssh_home_t')"
set -x
if [ -n "${selinux_wrong_permission}" ]; then
semanage fcontext -a -t ssh_home_t '/root/.ssh(/.*)?'
restorecon -R /root/.ssh/