fix ^PermitRootLogin regex

fix issue https://github.com/andsens/bootstrap-vz/issues/218
This commit is contained in:
Alexandre Derumier 2015-05-08 09:11:14 +02:00
parent e556366c19
commit 02c333c8c8

View file

@ -59,7 +59,7 @@ class EnableRootLogin(Task):
sshdconfig_path = os.path.join(info.root, 'etc/ssh/sshd_config')
if os.path.exists(sshdconfig_path):
from bootstrapvz.common.tools import sed_i
sed_i(sshdconfig_path, 'PermitRootLogin .*', 'PermitRootLogin yes')
sed_i(sshdconfig_path, '^PermitRootLogin .*', 'PermitRootLogin yes')
else:
import logging
logging.getLogger(__name__).warn('The OpenSSH server has not been installed, '
@ -75,7 +75,7 @@ class DisableRootLogin(Task):
sshdconfig_path = os.path.join(info.root, 'etc/ssh/sshd_config')
if os.path.exists(sshdconfig_path):
from bootstrapvz.common.tools import sed_i
sed_i(sshdconfig_path, 'PermitRootLogin .*', 'PermitRootLogin no')
sed_i(sshdconfig_path, '^PermitRootLogin .*', 'PermitRootLogin no')
else:
import logging
logging.getLogger(__name__).warn('The OpenSSH server has not been installed, '