r-lib / credentials

Tools for Managing SSH and Git Credentials
https://docs.ropensci.org/credentials
Other
72 stars 5 forks source link

`id_rsa` permissions #17

Closed rundel closed 3 years ago

rundel commented 3 years ago

I was just trying out credentials::ssh_setup_github() and everything seems to work until I try to clone (this is in a clean container with no .ssh folder) where I get the following:

~$ git clone git@github.com:rundel/test-private.git
Cloning into 'test-private'...
Warning: Permanently added the RSA host key for IP address '140.82.112.4' to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/home/guest/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/home/guest/.ssh/id_rsa": bad permissions
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

the ssh keys are generated with -rw-r--r-- default permissions on this system.

~$ ls -la .ssh
total 20
drwxr-xr-x 2 guest users 4096 Jul 23 18:25 .
drwxrwxr-x 8 guest users 4096 Jul 23 18:29 ..
-rw-r--r-- 1 guest users 1744 Jul 23 18:26 id_rsa
-rw-r--r-- 1 guest users  381 Jul 23 18:23 id_rsa.pub
-rw-r--r-- 1 guest users 2210 Jul 23 18:29 known_hosts

would it be possible to have the creation process remove the group and other permissions automatically?

jeroen commented 3 years ago

Thanks! Should be fixed now.

rundel commented 3 years ago

Thanks for the quick fix - is there any chance of a pushing to cran in the near future? (I realize 1.3.0 just went up) We'd like to push this onto containers for students for the coming term (mid august) and relying on dev versions usually results in some push back from the IT people.

jeroen commented 3 years ago

Sure, I'll 🚀 it to cran

jeroen commented 3 years ago

OK it's on cran.