Skip to content

Commit

Permalink
op-mode: T6377: must call pki.py helper as root to work with ACME cer…
Browse files Browse the repository at this point in the history
…tificates

This fixes the error:

vyos@vyos:~$ show pki certificate
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/vyos/config.py", line 111, in config_dict_mangle_acme
    tmp = read_file(f'{vyos_certbot_dir}/live/{name}/cert.pem')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/utils/file.py", line 44, in read_file
    raise e
  File "/usr/lib/python3/dist-packages/vyos/utils/file.py", line 38, in read_file
    with open(fname, 'r') as f:
         ^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/config/auth/letsencrypt/live/vyos/cert.pem'

(cherry picked from commit 65fba1c)
  • Loading branch information
c-po authored and mergify[bot] committed May 26, 2024
1 parent 4a9befb commit 9f02740
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions op-mode-definitions/pki.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@
<properties>
<help>Show x509 CA certificates</help>
</properties>
<command>${vyos_op_scripts_dir}/pki.py --action show --ca "all"</command>
<command>sudo ${vyos_op_scripts_dir}/pki.py --action show --ca "all"</command>
</leafNode>
<tagNode name="ca">
<properties>
Expand All @@ -504,21 +504,21 @@
<path>pki ca</path>
</completionHelp>
</properties>
<command>${vyos_op_scripts_dir}/pki.py --action show --ca "$4"</command>
<command>sudo ${vyos_op_scripts_dir}/pki.py --action show --ca "$4"</command>
<children>
<leafNode name="pem">
<properties>
<help>Show x509 CA certificate in PEM format</help>
</properties>
<command>${vyos_op_scripts_dir}/pki.py --action show --ca "$4" --pem</command>
<command>sudo ${vyos_op_scripts_dir}/pki.py --action show --ca "$4" --pem</command>
</leafNode>
</children>
</tagNode>
<leafNode name="certificate">
<properties>
<help>Show x509 certificates</help>
</properties>
<command>${vyos_op_scripts_dir}/pki.py --action show --certificate "all"</command>
<command>sudo ${vyos_op_scripts_dir}/pki.py --action show --certificate "all"</command>
</leafNode>
<tagNode name="certificate">
<properties>
Expand All @@ -527,7 +527,7 @@
<path>pki certificate</path>
</completionHelp>
</properties>
<command>${vyos_op_scripts_dir}/pki.py --action show --certificate "$4"</command>
<command>sudo ${vyos_op_scripts_dir}/pki.py --action show --certificate "$4"</command>
<children>
<leafNode name="pem">
<properties>
Expand All @@ -542,7 +542,7 @@
<list>sha256 sha384 sha512</list>
</completionHelp>
</properties>
<command>${vyos_op_scripts_dir}/pki.py --action show --certificate "$4" --fingerprint "$6"</command>
<command>sudo ${vyos_op_scripts_dir}/pki.py --action show --certificate "$4" --fingerprint "$6"</command>
</tagNode>
</children>
</tagNode>
Expand Down

0 comments on commit 9f02740

Please sign in to comment.