Comment 3 for bug 1904580

Revision history for this message
Alex Kavanagh (ajkavanagh) wrote :

This is very odd as the place where this is set up is using ssh-keygen (which does the right thing with permissions) with this bit of code:

def initialize_ssh_keys(user='root'):
    home_dir = pwd.getpwnam(user).pw_dir
    ssh_dir = os.path.join(home_dir, '.ssh')
    if not os.path.isdir(ssh_dir):
        os.mkdir(ssh_dir)

    priv_key = os.path.join(ssh_dir, 'id_rsa')
    if not os.path.isfile(priv_key):
        log('Generating new ssh key for user %s.' % user)
        cmd = ['ssh-keygen', '-q', '-N', '', '-t', 'rsa', '-b', '2048',
               '-f', priv_key]
        check_output(cmd)

I wonder how it is getting changed to 644?

We could put a change in to just always set the permissions to 600 in that function.

What's the provenance of the system in terms of what it was initially installed as? (i.e. has it been upgraded, charms upgraded, etc.) Thanks.