summaryrefslogtreecommitdiff
path: root/src/conf_mode/system-option.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@poessinger.com>2023-01-08 20:02:12 +0100
committerGitHub <noreply@github.com>2023-01-08 20:02:12 +0100
commit5a6c0c4d61112e1ac08a334ab7e68c07342fd679 (patch)
treed0507ce9a85915c493dc8524a246e8d7d42911aa /src/conf_mode/system-option.py
parentde1fa852c38b8eff22cf0c1a34abd13379c0705c (diff)
parent9ebf4db1296a0df870a47a32e3f0a66f8da16266 (diff)
downloadvyos-1x-5a6c0c4d61112e1ac08a334ab7e68c07342fd679.tar.gz
vyos-1x-5a6c0c4d61112e1ac08a334ab7e68c07342fd679.zip
Merge pull request #1743 from c-po/t2651-ssh-client
T4922: T4922: ssh-client backports for equuleus
Diffstat (limited to 'src/conf_mode/system-option.py')
-rwxr-xr-xsrc/conf_mode/system-option.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/conf_mode/system-option.py b/src/conf_mode/system-option.py
index ddb91aeaf..a112c2b6f 100755
--- a/src/conf_mode/system-option.py
+++ b/src/conf_mode/system-option.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2019-2020 VyOS maintainers and contributors
+# Copyright (C) 2019-2022 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
@@ -22,16 +22,18 @@ from time import sleep
from vyos.config import Config
from vyos.configdict import dict_merge
+from vyos.configverify import verify_source_interface
from vyos.template import render
from vyos.util import cmd
from vyos.validate import is_addr_assigned
+from vyos.validate import is_intf_addr_assigned
from vyos.xml import defaults
from vyos import ConfigError
from vyos import airbag
airbag.enable()
curlrc_config = r'/etc/curlrc'
-ssh_config = r'/etc/ssh/ssh_config'
+ssh_config = r'/etc/ssh/ssh_config.d/91-vyos-ssh-client-options.conf'
systemd_action_file = '/lib/systemd/system/ctrl-alt-del.target'
def get_config(config=None):
@@ -67,8 +69,17 @@ def verify(options):
if 'ssh_client' in options:
config = options['ssh_client']
if 'source_address' in config:
+ address = config['source_address']
if not is_addr_assigned(config['source_address']):
- raise ConfigError('No interface with give address specified!')
+ raise ConfigError('No interface with address "{address}" configured!')
+
+ if 'source_interface' in config:
+ verify_source_interface(config)
+ if 'source_address' in config:
+ address = config['source_address']
+ interface = config['source_interface']
+ if not is_intf_addr_assigned(interface, address):
+ raise ConfigError(f'Address "{address}" not assigned on interface "{interface}"!')
return None