These days I'm reading this Facebook engineering article Scalable and secure access with SSH. Most of the article makes sense to me but I am not experienced enough to understand the paragraph about bastion hosts:

Security domains

... In our infrastructure, engineers don't have direct SSH access to production systems, enforced by network firewalls. Instead, we use a bastion host to reach production. Engineers can authenticate to those bastion hosts only from trusted networks. These hosts use centralized LDAP and Kerberos installations to share account information, and they require two-factor authentication to protect against password leakage. Once users are properly authenticated and authorized, a background process contacts our internal CA to request a signed SSH certificate. That certificate contains all principals allowed for that specific engineer. From the bastion host, having obtained the appropriate certificate, engineers can SSH into production machines as either root or other lower privileged users. This way, we make sure that no engineer has more access than he or she requires.

We do not place SSH certificates on laptops because it is difficult to control everything that individual employees run on them. Even though they are centrally managed, laptops are more prone to vulnerabilities than the bastion servers. Therefore, we do not trust them with SSH private keys.

Unfortunately, the article doesn't explain further how the engineers log in the bastion hosts and where the SSH keys are stored. According to the paragraph, it seems to me that the engineers log in a bastion host first (from their own laptops), then after the certificate is obtained and put on the bastion host, the engineers will be able to log into the production machines from the bastion host.

The second paragraph says they "do not place SSH certificates on laptops" which suggests that they seem to have a way to prevent the SSH certificates from being copied to engineers' personal laptops. However, being a security novice myself, I have hard time imagining how they can prevent this from happening. Particularly, if the engineers log in the bastion hosts via SSH, it looks like a simply scp or rsync can copy the SSH certificates back to the personal laptops.

Any ideas how it can be implemented?

My other ideas are:

  • Maybe the engineers do not log into the bastion hosts via SSH but via some other protocols that can prevent such copy operations. Is this possible?
  • Maybe the bastion hosts have some special firewall rules that prevent such copy attempts?
  • 1
    You've made a few leaps in logic here and jumping to conclusions and misinterpreting what the article is saying. They do not say that the certs cannot be copied to the laptop. They say that they do not place SSH certs on the laptops.
    – schroeder
    Commented Oct 7, 2022 at 23:05
  • 2
    Related: security.stackexchange.com/questions/62577/…
    – mti2935
    Commented Oct 8, 2022 at 1:49

1 Answer 1


Often, when an admin wants SSH access to a server, they create a client cert, store it on the device (e.g. the admin/engineer's laptop) and access the server using a direct network connection from the laptop to the server and using the cert as authentication.

Facebook is saying that they have gone a step further and added PAM (Privileged Access Management) by cycling the certs and a bastion host to prevent a direct connection to the servers from arbitrary connections.

The only way to reach the production server is from the bastion hosts. So, putting a cert on the laptop would do nothing since the laptop cannot connect to the server.

They also generate new certs for the user when they connect to the bastion host. That way the admin is always using new certs and any old certs that may have been compromised are dead, so even if the cert is copied out, it would be useless.

So, all this has nothing to do with preventing the copying of certs. The article is explaining why they use a bastion host process and how they manage their certs.

Note that all of this is in the article you linked.

  • Thanks for the answer! Now I see the difference between "cannot" and "do not". Do you mind explaining a bit further that how PAM can help prevent direct connections from arbitrary computers? Or could that be a firewall configuration (that they only whitelist the hosts that can be connected to the production servers and all others are banned)?
    – yaobin
    Commented Oct 10, 2022 at 0:00
  • 1
    PAM cannot prevent direct connections... Please read the details again. The bastion host prevents direct connections ... As for how to prevent direct connections, that's a pure networking question, yes. But it's not about whitelisting certain hosts.
    – schroeder
    Commented Oct 10, 2022 at 6:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .