Fix wrong flag to prevent failure when selinux perm are correct.
This review[1] has a typo. The bash flag was incorrect. It was meant to be +e/-e to avoid trouble when grep failed. [1] https://review.openstack.org/#/q/Ib5873383632a1141c8dd3859b34ca29904020790 Change-Id: I39e42ff54fd7a461f7a03cfb8be17db92a35377e Related-Bug: #1736246
This commit is contained in:
parent
8f8fddb2a3
commit
e01745d3d8
|
@ -27,9 +27,9 @@ cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
|
|||
|
||||
if [ -e /usr/sbin/getenforce ]; then
|
||||
if [ "$(getenforce)" == "Enforcing" ]; then
|
||||
set +x
|
||||
set +e
|
||||
selinux_wrong_permission="$(find /root/.ssh/ -exec ls -lZ {} \; | grep -v 'ssh_home_t')"
|
||||
set -x
|
||||
set -e
|
||||
if [ -n "${selinux_wrong_permission}" ]; then
|
||||
semanage fcontext -a -t ssh_home_t '/root/.ssh(/.*)?'
|
||||
restorecon -R /root/.ssh/
|
||||
|
|
Loading…
Reference in New Issue