keygen: Change file permissions in private key

They were too open, and maybe someone will complain as the normal 'ssh'
command line tool does complain.
This commit is contained in:
Vishesh Handa
2019-05-29 14:37:04 +02:00
parent 2023f9cdaf
commit 2bcd609776

View File

@ -144,6 +144,7 @@ int gj_generate_ssh_keys(const char *private_key_path,
gj_log_internal("Failed to write private key to %s\n", private_key_path); gj_log_internal("Failed to write private key to %s\n", private_key_path);
goto cleanup; goto cleanup;
} }
chmod(private_key_path, 0600);
// Save public key // Save public key
ret = write_rsa_public_key(rsa, public_key_path, comment); ret = write_rsa_public_key(rsa, public_key_path, comment);