ssh and savannah
Short version
Set up your ssh key by typing in a terminal window on your local machine:
ssh-keygen
Then copy the contents of the resulting file ~/.ssh/id_rsa.pub into
the form at https://savannah.gnu.org/my/admin/editsshkeys.php
(after logging in to the savannah web interface).
Debugging
If you just registered your ssh key a few minutes ago, please wait for an hour and try again. Many tasks are implemented by hourly cron jobs that scan for queued tasks every hour.
GPG keys are not used for Savannah operations. We suggest you upload a GPG key because it is used by the FSF for file uploads elsewhere. But for version control repository access you have to create and register an ssh key.
SSH access is allowed for registered members who are a member of at least one project. If you are not a member of any project then you will need to use anonymous https access.
Third: you can test whether the problem is with your ssh setup or something on Savannah by running:
ssh cvs.savannah.gnu.org
If you get the following message:
You tried to execute:
Sorry, you are not allowed to execute that command.
Connection to cvs.savannah.gnu.org closed.
Then things are working okay for you. That illustrates that the login was successful and the access security on the server prevented the action.
If you fail an ssh login too many times in a short period of time then your IP address may be banned for a short time. Currently this is implemented by fail2ban using the default six failures in one minute bans your IP for ten minutes. This is only a temporary ban for ten minutes to rate limit hostile attacks. Wait ten minutes and try again.
Detailed version
Usually, if you can't access your version control (= VC, that is, cvs, svn, git, etc.) trees or your download area, it means your ssh access is not correctly configured. The remedy is to create a ssh key and/or register it properly.
If you're not member of any project, no account will created on the system - you will have your web account, but not system access. A system account will be created after you become a member of at least one project.
First, you need to create the ssh key. Typically, this is done by running the terminal command:
ssh-keygen
The public key will be created in the file ~/.ssh/id_rsa.pub by
default. It will ask you for a passphrase. This passphrase is used
to encrypt your private key. Only you knowing this passphrase will be
able to decrypt your private key and therefore only you will be able
to use your private key. When using ssh for version control your
passphrase is used locally by ssh. Savannah is NOT sent this
passphrase. The passphrase decrypts your local ssh key which is used
to authenticate your identity to the ssh daemon on Savannah. Your
Savannah web password is not used for version control access. Only
ssh is used for authenticated access for version control.
You must register your public key on the "My Account Configuration: Change Authorized Keys" page (https://savannah.gnu.org/my/admin/editsshkeys.php). After submitting, verify that the number of keys is what you expected.
You can register several public keys, which is often needed when you connect to Savannah from different computers. You can delete them when you do not use that key pair anymore.
Wait for the next cron job (worst case: 1 hour).
Q: RSA or DSA?
We recommend using only RSA keys, not DSA.
Full details are at Jim's page. In short, on a system whose OpenSSL library has a weak pseudo-random number generator or PRNG (such as the one that shipped with Debian Etch in 2007-2008), DSA private keys can be easily deduced by an attacker that sniffed enough of your traffic.
This issue is not officially documented by the OpenSSH project, but the following posts in Debian mailing lists tend to confirm it:
- http://lists.debian.org/debian-devel/2008/05/msg00341.html
- http://lists.debian.org/debian-devel-announce/2008/05/msg00004.html
DSA keys are silently disabled on Alioth (prefixed by
#DISABLED ON ALIOTH, use RSA keys instead#). Not sure about other
Debian official services.
Remembering your passphrase
The ssh-agent program can remember your passphrase during your
graphical X session (e.g., during your Gnome or KDE session).
ssh-agent may be already started for you (that's the case for most
distros). Check its present using:
$ ssh-add -l
2048 e4:ff:b0:0c:ec:93:66:29:49:7e:04:2b:fd:ba:bf:d9 $HOME/.ssh/id_rsa (RSA)
If it says:
Could not open a connection to your authentication agent.
Then your ssh-agent is not configured properly. Fix that first.
Once ssh-agent is started, you need to register your password using
ssh-add:
$ ssh-add
Enter passphrase for /home/me/.ssh/id_rsa:
# or:
$ ssh-add ~/.ssh/myotherkey
Enter passphrase for ~/.ssh/myotherkey:
After that, ssh will not ask for your passphrase anymore.
Verifying host fingerprints
If you get a warning about a fingerprint change, you can check the host fingerprint you have stored with for example:
$ ssh-keygen -l -F git.savannah.gnu.org
Your ~/.ssh/known_hosts file may have hostnames either plain or
hashed. The newer default is hashed and the hostname will display as
in the above. If plain then the hostname will display plainly instead
of hashed. The md5 hash the important part.
The keys currently in use on vcs.savannah.gnu.org are the following, reported in all of the many various formats.
1024 80:5a:b0:0c:ec:93:66:29:49:7e:04:2b:fd:ba:2c:d5 (RSA)
256 65:b8:1c:2f:82:7c:0e:39:e1:4a:63:f2:13:10:e8:9c (ECDSA)
256 14:7b:c8:98:dd:06:08:97:8c:00:9d:d2:ae:85:c8:82 (ED25519)
1024 SHA256:FYkx0iik+iBeCLRzvUyUSTRT98TEBBJoYuQsTXbyGL8 (RSA)
256 SHA256:qRLLJ4w/GAeiDyYnbx4yWJbZXwGiYYxgNty7lAfUyuM (ECDSA)
256 SHA256:o/oI4CKKcWc4cZvDFEdmOXsE3tiPP8bWa04h4bQjtV4 (ED25519)
Here are samples of ~/known_hosts file entries that would be created
upon TOFU (Trust On First Use) by ssh when connecting to the version
control system server. Here I a giving an example without
HashKnownHosts set because showing the hash here would not be useful
for an example. The HOSTNAME.or.HASH.here is meant as a generic
holder for that field because your system will have something
different there and there are too many possible host names to document
all of them.
HOSTNAME.or.HASH.here ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAzFQovi+67xa+wymRz9u3plx0ntQnELBoNU4SCl3RkwSFZkrZsRTC0fTpOKatQNs1r/BLFoVt21oVFwIXVevGQwB+Lf0Z+5w9qwVAQNu/YUAFHBPTqBze4wYK/gSWqQOLoj7rOhZk0xtAS6USqcfKdzMdRWgeuZ550P6gSzEHfv0=
HOSTNAME.or.HASH.here ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBP9c1Z2f4OHxymvLxqxQ/hY1g0ol0/iiXUrVFGZBBq4h5gD05c7Gw9rRrcrvF9XvumBvOghOQzDSZZLRWvFGocA=
HOSTNAME.or.HASH.here ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMnMLHxGS/b6Su98mL/J58FkpEJY/X1mONqhPBuFX5sJ
On the server-side (for Savannah Hackers):
root@vcs-noshell:/# ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key
1024 80:5a:b0:0c:ec:93:66:29:49:7e:04:2b:fd:ba:2c:d5 /etc/ssh/ssh_host_rsa_key.pub
Detailed troubleshooting
Lots more details of above and other less usual cases follow.
This following section is mostly about using ssh for cvs access and hasn't been updated for the many more recently added version control systems such as bzr, hg and git. The concepts are all the same however even if the details for other systems might be different.
If, when (for example) you try to use cvs, you're rejected with
Permission denied, that means that your key is not recognized. It could be a matter of time (cron job) or, generally, it means that your key is not a correct ssh2 key (the key registration page contains a sample key for you to compare). If you think you have done everything correctly, use the support manager (https://savannah.gnu.org/support/?group=administration) or write to savannah-help-public@gnu.org explaining your problem, providing copy/paste from the errors messages. It would also be good to provide the output from the following commands:ssh -v yourlogin@cvs.savannah.gnu.org # ssh connection ssh-keygen -lf ~/.ssh/id_rsa.pub # your key fingerprint cvs -t -d:ext:yourlogin@cvs.savannah.gnu.org/cvsroot/yourproject co yourproject
(Or whatever VC command, if you're not using cvs.)
Another reason for rejection as above can be that you failed to set the
CVS_RSHenvironment variable tossh, as in:export CVS_RSH=ssh # Bourne-compatible shells setenv CVS_RSH ssh # C shellsWithout this, cvs will be trying to use rsh instead of ssh for the connection, and rsh is not allowed (it's insecure by design).
Another problem can arise when you are trying to connect from behind a broken NAT router. During session setup, after the password has been given, OpenSSH sets the TOS (type of service) field in the IP datagram. Some broken routers are known to choke on this. This type of broken router is thankfully very infrequently seen these days. The effect is that your session hangs indefinitely after you gave your password. Here is the example output from such an ssh session:
user@localhost:~$ ssh -vvv {user-name}@cvs.savannah.gnu.org OpenSSH_4.7p1 Debian-8ubuntu1.2, OpenSSL 0.9.8g 19 Oct 2007 debug1: Reading configuration data /etc/ssh/ssh_config [...] Enter passphrase for key '{homedir}/.ssh/id_rsa': debug1: read PEM private key done: type RSA debug1: Authentication succeeded (publickey). [...] debug2: fd 5 setting TCP_NODELAY debug2: callback done debug2: channel 0: open confirm rwindow 0 rmax 32768
and from here on the session hangs.
The fix is to make ssh send all its traffic via netcat, because netcat won't set the TOS field. For this to work, you need to have netcat installed. You can test this by entering at the command line:
user@localhost:~$ which ncand if you get a path back, like:
/bin/ncthen you probably have netcat installed. For the very cautious, you could also issue:
user@localhost:~$ nc -hand look at the upcoming help text. If you don't have netcat, you can find it at http://netcat.sourceforge.net/. You may also want to try the packaging system which comes with your operating system distribution.
Once you found that you have netcat installed, issue the following command to test whether the netcat route solves your problem:
ssh -o "ProxyCommand nc %h %p" {user-name}@cvs.savannah.gnu.orgwhere {user-name} is your savannah login name. For a successfull login, you should get an output similar to this (with no hanging, i.e. you get a prompt afterwards):
user@localhost:~$ ssh -o "ProxyCommand nc %h %p" {user-name}@cvs.savannah.gnu.org Enter passphrase for key '{home-dir}/.ssh/id_rsa': Last login: {datetime} from {ip-adr} You tried to execute: Sorry, you are not allowed to execute that command. Connection to cvs.savannah.gnu.org closed. user@localhost:~$If you find that your login works via the netcat route, then you can make it permanent by adding a directive to the ssh config file '\~/.ssh/config' (or, if that file doesn't exist, create it):
ProxyCommand nc %h %pHere's an example ssh config file in a user's home folder (/home/user/.ssh/config):
# This is the ssh client user configuration file. See # ssh_config(5) for more information. This file provides defaults for # this user, and the values can be changed on the command line. # # Configuration data is parsed as follows: # 1. command line options # 2. user-specific file # 3. system-wide file # Any configuration value is only changed the first time it is set. # Thus, host-specific definitions should be at the beginning of the # configuration file, and defaults at the end. # # Directive to overcome TOS issue with our NAT router. During session setup, # OpenSSH sets the TOS (type of service) field after the user has submitted # the password. Some routers are known to choke on this, with the result # that the session hangs during buildup. As workaround we send our traffic # via netcat which doesn't set the TOS field. ProxyCommand nc %h %pIt's advisable to put the comments as well, otherwise six months later you may find yourself wondering what that directive is all about??
You could also add this directive to your global ssh config file (/etc/ssh/ssh_config), but this change would be system wide, and not all users on your system may appreciate that change.
- I have several SSH keys, how do I get the SSH client to select the appropriate one?
You can use 'ssh-agent' and 'ssh-add' to remember your key and passphrase. Then the SSH client will try all the remembered keys.
You can explicitly specify the key to use in your '\~/.ssh/config':
Host cvs.*gnu.org IdentityFile ~/.ssh/id_rsa_savannahYou can also use a wrapper script:
echo <<EOF > ~/bin/ssh_savannah #!/bin/bash /usr/bin/ssh -i ~/.ssh/id_rsa_savannah $* EOF export CVS_RSH=~/bin/ssh_savannah
My key has several lines, how do I enter it? We only support free implementations of SSH, such as http://www.openssh.org/. If your public key is several lines long, and begins with
---- BEGIN SSH2 PUBLIC KEY ----, then you are using a proprietary version that we do not support.When you try to use cvs, it will reports the authenticity of host subversions.gnu.org cannot be established, RSA key fingerprint is
80:5a:b0:0c:ec:93:66:29:49:7e:04:2b:fd:ba:2c:d5. Why RSA here and not DSA? This is the RSA fingerprint of the Savannah site-wide server key. It is used to verify that the site you are connecting to is well GNU Savannah, and not a fake website. It is totally different from your SSH key.What about
authorized_keys?authorized_keysis maintained on the server side, at Savannah. This is done automatically, based on the public keys you upload to the web interface. (Savannah admin info: specifically, in/etc/ssh/authorized_keys/USERNAME on the subhosts; a cron jobsv_authorized_keysruns on each vm.)