This project provides a secure, automated script to upgrade SSH keys and configurations to post-quantum cryptography (PQC) algorithms for both servers and clients. The tool ensures your SSH connections are resistant to future quantum computing attacks.
Quantum computers, once fully realized, will have the power to break many of the encryption methods used today, including RSA and ECC. This could compromise:
- Sensitive data
- Encrypted communications
- Authentication systems
Post-Quantum Cryptography (PQC) uses algorithms designed to resist attacks from quantum computers, ensuring your data remains secure for years to come.
SSH (Secure Shell) is one of the most widely used protocols for secure remote access. Most SSH configurations rely on traditional encryption algorithms, such as RSA and ECDSA, which will eventually become vulnerable to quantum attacks. Upgrading to PQC algorithms, like ECDSA-p256+Kyber512, protects your SSH connections from future threats.
This script:
- Checks Compatibility: Ensures both server and client systems support PQC-capable OpenSSH.
- Installs OQS-Enabled OpenSSH: Automatically installs the required OpenSSH version to support PQC if not already installed.
- Backs Up Current Keys: Creates a secure backup of existing SSH keys and configurations.
- Updates the Client: Installs PQC-capable OpenSSH and generates PQC keys on the client.
- Upgrades the Server: Replaces the server’s SSH keys with PQC-compatible keys and updates its configuration.
- Tests Connections: Verifies that the new keys work for both client-to-server and server-to-client communication.
- Rolls Back if Necessary: Automatically restores old keys and configurations if an issue is detected during the process.
Before running the script, ensure the following requirements are met:
-
Python 3: Ensure Python 3 is installed on your system.
Check with:python3 --version
-
Dependencies: Install the required Python packages using the included
requirements.txt
file:pip install -r requirements.txt
requirements.txt
includes:paramiko==3.2.0
-
OQS-Enabled OpenSSH:
- The script will automatically install Open Quantum Safe OpenSSH on both the server and the client if it is not already installed.
- This ensures the system supports post-quantum cryptographic algorithms like ECDSA-p256+Kyber512.
-
Clone the Repository:
git clone https://github.com/alenperic/SSH-Post-Quantum-Cryptography-Upgrade-Script.git cd SSH-Post-Quantum-Cryptography-Upgrade-Script
-
Install Dependencies:
pip install -r requirements.txt
-
Run the Script: Execute the script to start the SSH upgrade process:
python3 update_pqc_ssh.py
-
Enter Details:
- When prompted, provide the IP address, username, and password for the client machine.
-
Observe the Process:
- The script will:
- Install OQS-enabled OpenSSH if missing.
- Test the connection to the client.
- Update the client’s SSH setup to support PQC.
- Backup and replace the server's SSH keys with PQC keys.
- Test connections using the new setup.
- The script will:
-
Verify the Results:
- If the script completes successfully, your SSH connections are now post-quantum ready.
- If any issues occur, the script will restore your original SSH keys and configurations.
Here’s what you can expect to see when running the script:
[INFO] OQS-enabled OpenSSH is not found. Installing...
[INFO] Successfully installed OQS-enabled OpenSSH.
[INFO] Successfully connected to client 192.168.1.100.
[INFO] Updating SSH on client machine...
[INFO] Backing up old SSH keys and configurations.
[INFO] Generating new post-quantum SSH keys.
[INFO] Adding new keys to authorized_keys.
[INFO] Testing new key connection to client.
[INFO] Successfully migrated to post-quantum cryptography!
-
NIST Post-Quantum Cryptography Project
Learn about NIST's ongoing efforts to standardize post-quantum cryptographic algorithms. -
Open Quantum Safe
Explore tools and libraries for post-quantum cryptography. -
Why Quantum Computers Threaten Encryption
Understand the implications of quantum computing on current cryptographic methods.
We welcome contributions to improve the script or enhance its functionality. Feel free to submit issues or pull requests on GitHub.
This project is licensed under the GNU License. See the LICENSE
file for details.