diff options
author | Paul Lettington <paul@plett.co.uk> | 2021-09-03 23:39:22 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-09-07 09:38:09 +0200 |
commit | d9f20383323a9dbebcef4d4393f692dff716700c (patch) | |
tree | 31208174910a0dcca38d0899d156a5fae715329e | |
parent | e1422069475db45060bc3f1da523de855c8be341 (diff) | |
download | vyos-1x-d9f20383323a9dbebcef4d4393f692dff716700c.tar.gz vyos-1x-d9f20383323a9dbebcef4d4393f692dff716700c.zip |
login: T971 allow quoting in public-keys options
This patch allows the use of `"` in ssh public-key options which
unlocks the ability to set the `from` option in a way that sshd will
accept to limit what hosts a user can connect from.
(cherry picked from commit 6b52387190f8213e7e02060e894c6ddd4fb7cb3d)
-rwxr-xr-x | src/conf_mode/system-login.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/conf_mode/system-login.py b/src/conf_mode/system-login.py index 78830931d..8aa43dd32 100755 --- a/src/conf_mode/system-login.py +++ b/src/conf_mode/system-login.py @@ -246,7 +246,9 @@ def apply(login): # XXX: Should we deny using root at all? home_dir = getpwnam(user).pw_dir render(f'{home_dir}/.ssh/authorized_keys', 'login/authorized_keys.tmpl', - user_config, permission=0o600, user=user, group='users') + user_config, permission=0o600, + formater=lambda _: _.replace(""", '"'), + user=user, group='users') except Exception as e: raise ConfigError(f'Adding user "{user}" raised exception: "{e}"') |