Is it possible to a rogue employee to just login in a company server
and steal the private keys used to secure SSL connections?
Yes, except when it's hard, or when it's impossible.
Is it as easy as copying a file?
This is where the gradation comes in. There are a wide variety of security levels, some of which I'll describe here from easy to hard:
In the easiest case, yes, the private key is a simple text (PEM) file, and may not even have proper file protections*
Or the key file might be stored with restrictive permissions. Now the employee not only needs to be on the server, he needs to have the appropriate (Administrator or application) privileges to copy the key.
The key file might be password protected but automated. This usually just means that in addition to the key file, the employee needs to find the config file with the password stored in it and steal that too. (See also "java keystore changeit"...)
The key file might be password protected and the key entered at runtime by a human operator. In this case, the password cannot simply be stolen from the system. Of course, your employee might be an operator... Also, in practical terms, very few servers are run to require human intervention upon restart.
If I recall correctly, IIS used to be able to import the key into a keystore that was not exportable by users, but would allow use by services. Such things can generally be worked around with enough privileges.
Finally, if a Hardware Security Module (HSM) is used, that is designed to protect the keys even from the Operating System itself, to allow their use via cryptographic operations without exposing the keys to the computer hardware and software. In this case, the employee will probably find the key impossible to steal.
Here, I want to know how easy is to an insider get the private keys.
It's going to depend on the site, but in general, my experience has been that most sites store the key with nothing more than file permissions to protect it. The general sense is "Well, if someone breaks into the server, they've already gotten everything, and we'll need to issue a new key anyway when we recover." Of course, this ignores
- the gap between compromise and discovery, and
- the potential use of a private key to quietly read traffic in the meantime.
The shift towards ephemeral TLS ciphers is slowly closing that second gap, rendering the private key far less useful (snooping is often more valuable than impersonation; impersonation can be achieved in other (possibly simpler) ways).
*C'mon, guys, don't pretend you haven't seen a dozen poorly secured Apache configurations where the keys were left world readable.
cert2.getPrivateKey()
if a certificate is accompanied by a private key.