Wednesday, July 20, 2011

How to Encrypt Your Cisco VPN Pre-Shared Keys

If you are like me and you take the time to harden your network gear you have probably noticed that your VPN pre-shared keys stay in plain text even after applying password encryption. I never liked that. Why bother hardening your router when one of your most important credentials remain in clear text.

Here's what I mean:

VPN config before encryption:
******************************************************************

crypto isakmp policy 1
 encr 3des
 authentication pre-share
 group 2
crypto isakmp key S3cr3tK3y! address 0.0.0.0 0.0.0.0
crypto isakmp invalid-spi-recovery
******************************************************************

VPN config after encryption:
******************************************************************
crypto isakmp policy 1
 encr 3des
 authentication pre-share
 group 2
crypto isakmp key 6 V\OfYXeLVIdCaeS`HHQINQMBf\UDiG address 0.0.0.0 0.0.0.0

crypto isakmp invalid-spi-recovery
******************************************************************

Now when you look at your config, you can't see the actual key. It is very simple to configure. Here's how:

Go into "configure terminal"

key config-key password-encryption [master key]
password encryption aes

The "master key" is what the router will use to encrypt your pre-shared keys. If you do not enter this when you submit the rest of the command the router will prompt you.

The passwords are not actually encrypted until you enter the second command. After the passwords are encrypted they cannot be unencrypted on the router. You can change the master key if you want to by re-issuing the first command. The router will require you to enter the original key.

You can remove the master key by running:
no key config-key password-encryption

However, any current passwords will be rendered useless. Since the master key is no longer available the router cannot decrypt the password.

That's pretty much all there is to it. Now go out and harden your routers!

Here's a Cisco document on this procedure:
http://www.cisco.com/en/US/tech/tk583/tk372/technologies_configuration_example09186a00801f2336.shtml




3 comments:

  1. Great guide on how to encrypt pre-shared keys. Thank you very much

    ReplyDelete
  2. Great guide on how to encrypt pre-shared keys. Thank you very much

    ReplyDelete
  3. Great guide, also works the same way with Purevpn. I am using it for while now and quite satisfied.

    ReplyDelete