summaryrefslogtreecommitdiff
path: root/smoketest/bin/vyos-configtest-pki
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-02-12 21:17:43 +0100
committerChristian Breunig <christian@breunig.cc>2024-02-12 21:21:02 +0100
commit4d76e9ef3e7773ed96c037108021c292675b101c (patch)
tree12128c82b95867663500ce1aef3b058fd69fb57a /smoketest/bin/vyos-configtest-pki
parent78820752b936e77d30f995498ff36487c5c6af87 (diff)
downloadvyos-1x-4d76e9ef3e7773ed96c037108021c292675b101c.tar.gz
vyos-1x-4d76e9ef3e7773ed96c037108021c292675b101c.zip
rpki: T6024: add migration scripts from file based keys to PKI subsystem
Diffstat (limited to 'smoketest/bin/vyos-configtest-pki')
-rwxr-xr-xsmoketest/bin/vyos-configtest-pki41
1 files changed, 40 insertions, 1 deletions
diff --git a/smoketest/bin/vyos-configtest-pki b/smoketest/bin/vyos-configtest-pki
index 2f8af0e61..e753193e9 100755
--- a/smoketest/bin/vyos-configtest-pki
+++ b/smoketest/bin/vyos-configtest-pki
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2022, VyOS maintainers and contributors
+# Copyright (C) 2022-2024, VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -23,6 +23,7 @@ from vyos.pki import create_dh_parameters
from vyos.pki import encode_certificate
from vyos.pki import encode_dh_parameters
from vyos.pki import encode_private_key
+from vyos.utils.file import write_file
subject = {'country': 'DE', 'state': 'BY', 'locality': 'Cloud', 'organization': 'VyOS', 'common_name': 'vyos'}
ca_subject = {'country': 'DE', 'state': 'BY', 'locality': 'Cloud', 'organization': 'VyOS', 'common_name': 'vyos CA'}
@@ -41,6 +42,40 @@ dh_pem = '/config/auth/ovpn_test_dh.pem'
s2s_key = '/config/auth/ovpn_test_site2site.key'
auth_key = '/config/auth/ovpn_test_tls_auth.key'
+rpki_ssh_priv_key = """
+-----BEGIN OPENSSH PRIVATE KEY-----
+b3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W1unF5FmgHY1AbbYRPIku+F9Nqig0tP0el vyos@vyos
+"""
+
def create_cert(subject, cert_path, key_path, sign_by=None, sign_by_key=None, ca=False, sub_ca=False):
priv_key = create_private_key('rsa', 2048)
cert_req = create_certificate_request(subject, priv_key)
@@ -98,3 +133,7 @@ if __name__ == '__main__':
# OpenVPN Auth Key
system(f'openvpn --genkey secret {auth_key}')
+
+ write_file('/config/id_rsa', rpki_ssh_priv_key.strip())
+ write_file('/config/id_rsa.pub', rpki_ssh_pub_key.strip())
+ write_file('/config/known-hosts-file', '')