Always set PermitRootLogin
for sshd_config
it was only being set if the setting existed
This commit is contained in:
parent
38b99cd817
commit
4af428db78
|
@ -71,11 +71,15 @@ def configure(allow_root=False):
|
||||||
Configure the OpenSSH service
|
Configure the OpenSSH service
|
||||||
"""
|
"""
|
||||||
path = '/etc/ssh/sshd_config'
|
path = '/etc/ssh/sshd_config'
|
||||||
value = 'without-password' if allow_root else 'no'
|
|
||||||
sed(path, r'^PermitRootLogin\s+.*', 'PermitRootLogin {}'.format(value), use_sudo=True)
|
entry = 'PermitRootLogin {}'.format('without-password' if allow_root else 'no')
|
||||||
|
sed(path, r'^PermitRootLogin\s+.*', entry, use_sudo=True)
|
||||||
|
append(path, entry, use_sudo=True)
|
||||||
|
|
||||||
entry = 'PasswordAuthentication no'
|
entry = 'PasswordAuthentication no'
|
||||||
sed(path, r'^PasswordAuthentication\s+.*', entry, use_sudo=True)
|
sed(path, r'^PasswordAuthentication\s+.*', entry, use_sudo=True)
|
||||||
append(path, entry, use_sudo=True)
|
append(path, entry, use_sudo=True)
|
||||||
|
|
||||||
restart()
|
restart()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue