Get a Pentest and security assessment of your IT network.

Cyber Security

IPSec Pre-Shared Key Rotation

TL;DR

Change your IPSec pre-shared key (PSK) regularly – at least every 90 days, but ideally more often. Automate this process where possible to reduce risk and administrative overhead.

Why Change Your PSK?

IPSec pre-shared keys are a common way to authenticate VPN connections. However, they’re vulnerable if compromised. A stolen or cracked key gives attackers full access to your network. Regular rotation limits the damage from such breaches.

How Often Should You Change It?

  1. 90 Days: This is a good baseline for many organisations, balancing security with practicality.
  2. More Frequently (e.g., Monthly): Recommended for high-security environments or if you suspect a compromise.
  3. Immediately: Change the key immediately if you believe it has been exposed.

Step-by-Step Key Rotation Guide

This guide assumes a typical IPSec configuration using common firewall/router interfaces. Specific steps will vary depending on your equipment.

1. Preparation

  1. Document Current Configuration: Record the current PSK, Phase 1 and Phase 2 settings (encryption algorithms, hash functions, etc.). This is vital for a smooth transition.
  2. Choose a Strong New Key: Generate a complex, random key. Aim for at least 20 characters with a mix of uppercase/lowercase letters, numbers, and symbols. Avoid dictionary words or easily guessable patterns.

2. Update the Primary Device

This is usually your main firewall or VPN gateway.

  1. Log in to the device’s web interface or CLI.
  2. Navigate to the IPSec configuration section. The exact location varies by vendor (e.g., Cisco ASA, Fortigate, Palo Alto Networks).
  3. Edit the pre-shared key setting for your VPN tunnel(s). Replace the old key with the new one.
  4. Save the changes.

Example (Cisco ASA CLI):

configure terminal
crypto ipsec ikev1 pre-shared-key address  key 

3. Update the Secondary Device(s)

Repeat step 2 on all other devices involved in the IPSec tunnel (e.g., remote firewalls, client VPN endpoints).

4. Testing and Verification

  1. Test Connectivity: Establish a new VPN connection using the updated key. Verify that data can flow through the tunnel successfully.
  2. Monitor Logs: Check the logs on both devices for any errors related to authentication or key exchange.
  3. Old Key Removal (Optional): After successful testing, consider removing the old key from the configuration if your device supports multiple keys and you want to enforce use of the new one.

5. Automation

Automating PSK rotation significantly improves security and reduces administrative burden.

  1. Scripting: Use scripting languages (e.g., Python, Bash) to update the key on multiple devices simultaneously.
  2. Centralized Management Tools: Many firewall vendors offer centralized management platforms that allow you to automate IPSec configuration changes across your entire network.

Important Considerations

  • Downtime: PSK rotation can briefly interrupt VPN connectivity. Schedule it during off-peak hours if possible.
  • Compatibility: Ensure that all devices involved in the IPSec tunnel support the new key length and encryption algorithms.
  • Cyber security Best Practices: Combine PSK rotation with other cyber security measures, such as multi-factor authentication (MFA) and intrusion detection systems (IDS).
Related posts
Cyber Security

Zip Codes & PII: Are They Personal Data?

Cyber Security

Zero-Day Vulnerabilities: User Defence Guide

Cyber Security

Zero Knowledge Voting with Trusted Server

Cyber Security

ZeroNet: 51% Attack Risks & Mitigation