diff options
author | Christian Breunig <christian@breunig.cc> | 2024-12-12 16:12:43 +0100 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2024-12-16 22:24:50 +0100 |
commit | a8da54f50df5d60b18a8cdf0ea63c71f82faf14e (patch) | |
tree | 145b62b0c6836ac67cb20325a9b099056d6ae90c | |
parent | 76b74d62b607961f08bd0284a9dbc5427ba48e1d (diff) | |
download | vyos-1x-a8da54f50df5d60b18a8cdf0ea63c71f82faf14e.tar.gz vyos-1x-a8da54f50df5d60b18a8cdf0ea63c71f82faf14e.zip |
rpki: T6746: FRRender needs to calculate SSH key path
-rw-r--r-- | python/vyos/configdict.py | 5 | ||||
-rwxr-xr-x | src/conf_mode/protocols_rpki.py | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index fb6365060..cbcbf9f72 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -944,6 +944,11 @@ def get_frrender_dict(conf, argv=None) -> dict: rpki = conf.get_config_dict(rpki_cli_path, key_mangling=('-', '_'), get_first_key=True, with_pki=True, with_recursive_defaults=True) + rpki_ssh_key_base = '/run/frr/id_rpki' + for cache, cache_config in rpki.get('cache',{}).items(): + if 'ssh' in cache_config: + cache_config['ssh']['public_key_file'] = f'{rpki_ssh_key_base}_{cache}.pub' + cache_config['ssh']['private_key_file'] = f'{rpki_ssh_key_base}_{cache}' dict.update({'rpki' : rpki}) elif conf.exists_effective(rpki_cli_path): dict.update({'rpki' : {'deleted' : ''}}) diff --git a/src/conf_mode/protocols_rpki.py b/src/conf_mode/protocols_rpki.py index d3f515feb..4aefbe36c 100755 --- a/src/conf_mode/protocols_rpki.py +++ b/src/conf_mode/protocols_rpki.py @@ -26,6 +26,7 @@ from vyos.frrender import FRRender from vyos.pki import wrap_openssh_public_key from vyos.pki import wrap_openssh_private_key from vyos.utils.dict import dict_search_args +from vyos.utils.process import is_systemd_service_running from vyos.utils.file import write_file from vyos import ConfigError from vyos import airbag @@ -94,12 +95,12 @@ def generate(config_dict): write_file(cache_config['ssh']['public_key_file'], wrap_openssh_public_key(public_key_data, public_key_type)) write_file(cache_config['ssh']['private_key_file'], wrap_openssh_private_key(private_key_data)) - if config_dict and 'frrender_cls' not in config_dict: + if config_dict and not is_systemd_service_running('vyos-configd.service'): FRRender().generate(config_dict) return None def apply(config_dict): - if config_dict and 'frrender_cls' not in config_dict: + if config_dict and not is_systemd_service_running('vyos-configd.service'): FRRender().apply() return None |