# HG changeset patch # User Mads Kiilerich # Date 2019-12-29 01:43:18 # Node ID 74b7aa45c1e15e239d1999b206f003f74033f750 # Parent ba6418fde72f286a95f207fb14eeeee2ac788a55 ssh: add WARNING comment as first line in .authorized_keys managed by Kallithea diff --git a/kallithea/model/ssh_key.py b/kallithea/model/ssh_key.py --- a/kallithea/model/ssh_key.py +++ b/kallithea/model/ssh_key.py @@ -129,6 +129,7 @@ class SshKeyModel(object): fh, tmp_authorized_keys = tempfile.mkstemp('.authorized_keys', dir=os.path.dirname(authorized_keys)) with os.fdopen(fh, 'w') as f: + f.write("# WARNING: This .ssh/authorized_keys file is managed by Kallithea. Manual editing or adding new entries will make Kallithea back off.\n") for key in UserSshKeys.query().join(UserSshKeys.user).filter(User.active == True): f.write(ssh.authorized_keys_line(kallithea_cli_path, config['__file__'], key)) os.chmod(tmp_authorized_keys, stat.S_IRUSR | stat.S_IWUSR)