summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-06-26 09:24:53 +0200
committerChristian Poessinger <christian@poessinger.com>2021-06-26 09:24:53 +0200
commita6b526fd982605cfd984942ae879f7e8bb4638ff (patch)
treec03f9a9352d79e59f08c26a0c7a35e476badf185 /src
parent5303ec39f6f08ccf06f56ff6d5166fc572b2c735 (diff)
downloadvyos-1x-a6b526fd982605cfd984942ae879f7e8bb4638ff.tar.gz
vyos-1x-a6b526fd982605cfd984942ae879f7e8bb4638ff.zip
ipsec: T3643: us vyos.util.copy_file() over raw UNIX cp command
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/vpn_ipsec.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/conf_mode/vpn_ipsec.py b/src/conf_mode/vpn_ipsec.py
index fa5ce34ca..d598ff6da 100755
--- a/src/conf_mode/vpn_ipsec.py
+++ b/src/conf_mode/vpn_ipsec.py
@@ -31,6 +31,7 @@ from vyos.util import dict_search
from vyos.util import process_named_running
from vyos.util import run
from vyos.util import cidr_fit
+from vyos.util import copy_file
from vyos import ConfigError
from vyos import airbag
airbag.enable()
@@ -340,17 +341,17 @@ def generate(ipsec):
if peer_conf['authentication']['mode'] == 'x509':
cert_file = os.path.join(X509_PATH, peer_conf['authentication']['x509']['cert_file'])
- call(f'cp -f {cert_file} {CERT_PATH}')
+ copy_file(cert_file, CERT_PATH, True)
key_file = os.path.join(X509_PATH, peer_conf['authentication']['x509']['key']['file'])
- call(f'cp -f {key_file} {KEY_PATH}')
+ copy_file(key_file, X509_PATH, True)
ca_cert_file = os.path.join(X509_PATH, peer_conf['authentication']['x509']['ca_cert_file'])
- call(f'cp -f {ca_cert_file} {CA_PATH}')
+ copy_file(ca_cert_file, CA_PATH, True)
if 'crl_file' in peer_conf['authentication']['x509']:
crl_file = os.path.join(X509_PATH, peer_conf['authentication']['x509']['crl_file'])
- call(f'cp -f {crl_file} {CRL_PATH}')
+ copy_file(crl_file, CRL_PATH, True)
local_ip = ''
if 'local_address' in peer_conf: