m (→SSH configuration)
|Line 32:||Line 32:|
'''then,''' add the following:
'''then,''' add the following:
Revision as of 17:45, 4 August 2011
Contact: #fedora-admin or email@example.com
Servers: All PHX2 and VPN Fedora machines
Purpose: Access via ssh to Fedora project machines.
This page will contain some useful instructions about how you can safely login into Fedora PHX2 machines successfully using a public key authentication. As of 2011-05-27, all machines require a SSH key to access. Password authentication will no longer work. Note that this SOP has nothing to do with actually gaining access to specific machines. For that you MUST be in the correct group for shell access to that machine. This SOP simply describes the process once you do have valid and appropriate shell access to a machine.
First of all: (on your local machine)
NOTE: This file needs to be chmod 600, or you will get a "Bad owner or permissions" error.
then, add the following:
Host *.phx2.fedoraproject.org *.fedoraproject.org fedorahosted.org *.fedorahosted.org fedorapeople.org User FAS_USERNAME # Add other machines to this line as desired. Host *.phx2.fedoraproject.org 10.5.125.* 10.5.126.* 10.5.127.* *.vpn.fedoraproject.org ProxyCommand ssh -W %h:%p bastion.fedoraproject.org
One slight annoyance with this method is that you must include the .phx2.fedoraproject.org part when you SSH to Fedora machines in order for the connection to be tunneled through bastion. If this is an issue, here are two possible ways to avoid it:
1. You can add aliases for each of the Fedora machines you login to by modifying the Host line:
Host *.phx2.fedoraproject.org 10.5.125.* 10.5.126.* 10.5.127.* *.vpn.fedoraproject.org puppet01 noc01 # list all hosts here
2. You can proxy everything through bastion by default and exclude hosts that you connect to directly:
# List all host you SSH to that are NOT Fedora machines # make sure to include bastion here as well! Host allyourlocalmachines bastion.fedoraproject.org ProxyCommand none Host * ProxyCommand ssh -W %h:%p bastion.fedoraproject.org
Keep in mind that if bastion ever goes down and you need to access things, you'll want to comment this section out.
SSH Agent forwarding
You should normally have:
For Fedora hosts (this is the default in OpenSSH). You can override this on a per-session basis by using '-A' with ssh. SSH agents could be misused if you connect to a compromised host with forwarding on (the attacker can use your agent to authenticate them to anything you have access to as long as you are logged in). Additionally, if you do need SSH agent forwarding (say for copying files between machines), you should remember to logout as soon as you are done to not leave your agent exposed.
- 'channel 0: open failed: administratively prohibited: open failed': If you receive this message for a machine proxied through bastion, then bastion was unable to connect to the host. This most likely means that tried to SSH to a nonexistent machine. You can debug this by trying to connect to that machine from bastion.
- if your local username is different from the one registered in FAS, please remember to set up a User variable (like above) where you specify your FAS username. If that's missing SSH will try to login by using your local username, thus it will fail.
- ssh -vv is very handy for debugging what sections are matching and what are not.
- If you get access denied several times in a row, please consult with #fedora-admin. If you try too many times with an invalid config your IP could be added to denyhosts.
- If you are running an OpenSSH version less than 5.4, then the -W option is not avaliable. In that case, use the following ProxyCommand line instead:
ProxyCommand ssh -q bastion.fedoraproject.org exec nc %h %p