summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2023-01-04 19:58:59 +0100
committerChristian Poessinger <christian@poessinger.com>2023-01-04 19:58:59 +0100
commit87cc636bd2baf576a2a5ece7a4f8318eb4f69c2e (patch)
tree91141bcd84687d1e6af08ea6ed6b5f6fea8b168d
parent7763de6c4b93d3372ab3f4572d9fa6b7536102b3 (diff)
downloadvyos-1x-87cc636bd2baf576a2a5ece7a4f8318eb4f69c2e.tar.gz
vyos-1x-87cc636bd2baf576a2a5ece7a4f8318eb4f69c2e.zip
ssh: T2651: add source-interface support ssh-client
-rw-r--r--data/templates/system/ssh_config.j23
-rw-r--r--interface-definitions/system-option.xml.in1
-rwxr-xr-xsrc/conf_mode/system-option.py5
3 files changed, 8 insertions, 1 deletions
diff --git a/data/templates/system/ssh_config.j2 b/data/templates/system/ssh_config.j2
index 1449f95b1..d3ede0971 100644
--- a/data/templates/system/ssh_config.j2
+++ b/data/templates/system/ssh_config.j2
@@ -1,3 +1,6 @@
{% if ssh_client.source_address is vyos_defined %}
BindAddress {{ ssh_client.source_address }}
{% endif %}
+{% if ssh_client.source_interface is vyos_defined %}
+BindInterface {{ ssh_client.source_interface }}
+{% endif %}
diff --git a/interface-definitions/system-option.xml.in b/interface-definitions/system-option.xml.in
index a9fed81fe..bb15e467e 100644
--- a/interface-definitions/system-option.xml.in
+++ b/interface-definitions/system-option.xml.in
@@ -121,6 +121,7 @@
</properties>
<children>
#include <include/source-address-ipv4-ipv6.xml.i>
+ #include <include/source-interface.xml.i>
</children>
</node>
<leafNode name="startup-beep">
diff --git a/src/conf_mode/system-option.py b/src/conf_mode/system-option.py
index 85fc6a83f..ceac3dc16 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,6 +22,7 @@ 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.util import is_systemd_service_running
@@ -70,6 +71,8 @@ def verify(options):
if 'source_address' in config:
if not is_addr_assigned(config['source_address']):
raise ConfigError('No interface with give address specified!')
+ if 'source_interface' in config:
+ verify_source_interface(config)
return None