Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T4916: Rewrite IPsec peer authentication and psk migration #1757

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
192a31f
T4920: ospf: Fix `passive-interface default` option
vfreex Jan 7, 2023
e5f122b
Revert "strongSwan: upgrade scripts to work with package version 5.9.8"
c-po Jan 9, 2023
440300d
Revert "strongSwan: T4593: add charon-systemd runtime dependency"
c-po Jan 9, 2023
a3cbcfa
T4906: Fix show vpn ipsec connections data
sever-sever Jan 10, 2023
b0fcd03
container: T4880: include 'add'/'delete' in standard op-mode functions
jestabro Jan 9, 2023
850f81d
container: T4880: expose add_image/delete_image functions in op-mode
jestabro Jan 9, 2023
b2b6ce0
container: T4880: add REST API endpoint for add/delelete/show images
jestabro Jan 9, 2023
d56f4dd
opmode: T2546: add UnsupportedOperation to op mode errors
dmbaturin Jan 10, 2023
a7b83e6
webproxy: T4927: Changed restart to reload-or-restart in commit
aapostoliuk Jan 11, 2023
ecc8d76
container: T4880: fix name collision
jestabro Jan 11, 2023
88d9a28
opmode: T4564: add generate to the list of op mode functions
dmbaturin Jan 10, 2023
7c74c4a
T4918: op_mode interfaces: Fix show interfaces
roedie Jan 7, 2023
bba4b28
T4935: ospfv3: "not-advertise" and "advertise" conflict
vfreex Jan 12, 2023
a0cadbb
vyos.util: T4933: informative error for bad colon-separated lines
dmbaturin Jan 12, 2023
e8323ab
T4934: ospf: Fix inter-area route summarization
vfreex Jan 12, 2023
3ce293a
T4118: Add default value any for connection remote-id
sever-sever Jan 12, 2023
d1dbb41
T4911: op-mode: rewrite LLDP in standardised op-mode format
c-po Jan 12, 2023
67d6b11
ethernet: rps: T4928: adjust to Kernel ABI changes
c-po Jan 12, 2023
b6cb3b0
ethernet: rps: T4928: adjust to Kernel ABI changes #2
c-po Jan 13, 2023
b9c5db8
T4935: ospfv3: bugfix KeyError: 'range'
c-po Jan 13, 2023
a5a7ce4
ospf: T4934: bugfix AssertionError in smoketest
c-po Jan 13, 2023
ede8bab
smoketest: dhcpv6-relay: use setUpClass() over setUp()
c-po Jan 13, 2023
3ec580e
smoketest: T4387: cleanup veth interfaces used during test
c-po Jan 14, 2023
f956683
ospf: T4934: bugfix AssertionError in smoketest for area 10 network
c-po Jan 14, 2023
91f1434
smoketest: dhcpv6-relay: bugfix TypeError
c-po Jan 14, 2023
2fb4eff
op-mode: xml: improve help strings
c-po Jan 14, 2023
09d12b9
systemd: T2185: always place generated override files in /run
c-po Jan 14, 2023
9f3821b
ntp: T3008: migrate from ntpd to chrony
c-po Jan 13, 2023
c9da5bc
ntp: T3008: TypeError bugfix when calling rename()
c-po Jan 15, 2023
f21bd13
opmode: T4837: add family and table arguments for ShowRoute
dmbaturin Jan 12, 2023
e59fe7c
opmode: T4837: add VRF option for route summary
dmbaturin Jan 16, 2023
ca8cc37
T4916: Rewrite IPsec peer authentication and psk migration
sever-sever Jan 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions data/op-mode-standardized.json
Expand Up @@ -8,6 +8,7 @@
"dhcp.py",
"dns.py",
"interfaces.py",
"lldp.py",
"log.py",
"memory.py",
"nat.py",
Expand Down
58 changes: 58 additions & 0 deletions data/templates/chrony/chrony.conf.j2
@@ -0,0 +1,58 @@
### Autogenerated by ntp.py ###

# This would step the system clock if the adjustment is larger than 0.1 seconds,
# but only in the first three clock updates.
makestep 1.0 3

# The rtcsync directive enables a mode where the system time is periodically
# copied to the RTC and chronyd does not try to track its drift. This directive
# cannot be used with the rtcfile directive. On Linux, the RTC copy is performed
# by the kernel every 11 minutes.
rtcsync

# This directive specifies the maximum amount of memory that chronyd is allowed
# to allocate for logging of client accesses and the state that chronyd as an
# NTP server needs to support the interleaved mode for its clients.
clientloglimit 1048576

driftfile /run/chrony/drift
dumpdir /run/chrony
pidfile {{ config_file | replace('.conf', '.pid') }}

# Determine when will the next leap second occur and what is the current offset
leapsectz right/UTC

user {{ user }}

# NTP servers to reach out to
{% if server is vyos_defined %}
{% for server, config in server.items() %}
{% set association = 'server' %}
{% if config.pool is vyos_defined %}
{% set association = 'pool' %}
{% endif %}
{{ association }} {{ server | replace('_', '-') }} iburst {{ 'noselect' if config.noselect is vyos_defined }} {{ 'prefer' if config.prefer is vyos_defined }}
{% endfor %}
{% endif %}

# Allowed clients configuration
{% if allow_client.address is vyos_defined %}
{% for address in allow_client.address %}
allow {{ address }}
{% endfor %}
{% endif %}
deny all

{% if listen_address is vyos_defined or interface is vyos_defined %}
# NTP should listen on configured addresses only
{% if listen_address is vyos_defined %}
{% for address in listen_address %}
bindaddress {{ address }}
{% endfor %}
{% endif %}
{% if interface is vyos_defined %}
{% for ifname in interface %}
binddevice {{ ifname }}
{% endfor %}
{% endif %}
{% endif %}
Expand Up @@ -5,10 +5,13 @@ ConditionPathExists={{ config_file }}
After=vyos-router.service

[Service]
EnvironmentFile=
ExecStart=
ExecStart={{ vrf_command }}/usr/sbin/ntpd -g -p {{ config_file | replace('.conf', '.pid') }} -c {{ config_file }} -u ntp:ntp
ExecStart={{ vrf_command }}/usr/sbin/chronyd -F 1 -f {{ config_file }}
PIDFile=
PIDFile={{ config_file | replace('.conf', '.pid') }}
Restart=always
RestartSec=10
# Required for VRF support
ProtectControlGroups=No

10 changes: 6 additions & 4 deletions data/templates/frr/ospfd.frr.j2
Expand Up @@ -84,11 +84,13 @@ router ospf {{ 'vrf ' ~ vrf if vrf is vyos_defined }}
{% endfor %}
{% if area_config.range is vyos_defined %}
{% for range, range_config in area_config.range.items() %}
{% if range_config.cost is vyos_defined %}
area {{ area_id }} range {{ range }} cost {{ range_config.cost }}
{% endif %}
{% if range_config.not_advertise is vyos_defined %}
area {{ area_id }} range {{ range }} not-advertise
{% else %}
area {{ area_id }} range {{ range }}
{% endif %}
{% if range_config.cost is vyos_defined %}
area {{ area_id }} range {{ range }} cost {{ range_config.cost }}
{% endif %}
{% if range_config.substitute is vyos_defined %}
area {{ area_id }} range {{ range }} substitute {{ range_config.substitute }}
Expand Down Expand Up @@ -170,7 +172,7 @@ router ospf {{ 'vrf ' ~ vrf if vrf is vyos_defined }}
{% if parameters.router_id is vyos_defined %}
ospf router-id {{ parameters.router_id }}
{% endif %}
{% if passive_interface.default is vyos_defined %}
{% if passive_interface is vyos_defined('default') %}
passive-interface default
{% endif %}
{% if redistribute is vyos_defined %}
Expand Down
2 changes: 1 addition & 1 deletion data/templates/https/nginx.default.j2
Expand Up @@ -34,7 +34,7 @@ server {
ssl_protocols TLSv1.2 TLSv1.3;

# proxy settings for HTTP API, if enabled; 503, if not
location ~ /(retrieve|configure|config-file|image|generate|show|reset|docs|openapi.json|redoc|graphql) {
location ~ /(retrieve|configure|config-file|image|container-image|generate|show|reset|docs|openapi.json|redoc|graphql) {
{% if server.api %}
{% if server.api.socket %}
proxy_pass http://unix:/run/api.sock;
Expand Down
33 changes: 15 additions & 18 deletions data/templates/ipsec/swanctl.conf.j2
Expand Up @@ -58,23 +58,7 @@ secrets {
{% if site_to_site.peer is vyos_defined %}
{% for peer, peer_conf in site_to_site.peer.items() if peer not in dhcp_no_address and peer_conf.disable is not vyos_defined %}
{% set peer_name = peer.replace("@", "") | dot_colon_to_dash %}
{% if peer_conf.authentication.mode is vyos_defined('pre-shared-secret') %}
ike_{{ peer_name }} {
{% if peer_conf.local_address is vyos_defined %}
id-local = {{ peer_conf.local_address }} # dhcp:{{ peer_conf.dhcp_interface if 'dhcp_interface' in peer_conf else 'no' }}
{% endif %}
{% for address in peer_conf.remote_address %}
id-remote_{{ address | dot_colon_to_dash }} = {{ address }}
{% endfor %}
{% if peer_conf.authentication.local_id is vyos_defined %}
id-localid = {{ peer_conf.authentication.local_id }}
{% endif %}
{% if peer_conf.authentication.remote_id is vyos_defined %}
id-remoteid = {{ peer_conf.authentication.remote_id }}
{% endif %}
secret = "{{ peer_conf.authentication.pre_shared_secret }}"
}
{% elif peer_conf.authentication.mode is vyos_defined('x509') %}
{% if peer_conf.authentication.mode is vyos_defined('x509') %}
private_{{ peer_name }} {
file = {{ peer_conf.authentication.x509.certificate }}.pem
{% if peer_conf.authentication.x509.passphrase is vyos_defined %}
Expand All @@ -91,6 +75,20 @@ secrets {
{% endif %}
{% endfor %}
{% endif %}
{% if authentication.psk is vyos_defined %}
{% for psk, psk_config in authentication.psk.items() %}
ike-{{ psk }} {
{% if psk_config.id is vyos_defined %}
# ID's from auth psk <tag> id xxx
{% for id in psk_config.id %}
id-{{ id | dot_colon_to_dash }} = {{ id }}
{% endfor %}
{% endif %}
secret = "{{ psk_config.secret }}"
}
{% endfor %}
{% endif %}

{% if remote_access.connection is vyos_defined %}
{% for ra, ra_conf in remote_access.connection.items() if ra_conf.disable is not vyos_defined %}
{% if ra_conf.authentication.server_mode is vyos_defined('pre-shared-secret') %}
Expand Down Expand Up @@ -130,4 +128,3 @@ secrets {
{% endif %}
{% endif %}
}

4 changes: 0 additions & 4 deletions data/templates/ipsec/swanctl/peer.j2
Expand Up @@ -45,11 +45,7 @@
{% endif %}
}
remote {
{% if peer_conf.authentication.remote_id is vyos_defined %}
id = "{{ peer_conf.authentication.remote_id }}"
{% else %}
id = "{{ peer }}"
{% endif %}
auth = {{ 'psk' if peer_conf.authentication.mode == 'pre-shared-secret' else 'pubkey' }}
{% if peer_conf.authentication.mode == 'rsa' %}
pubkeys = {{ peer_conf.authentication.rsa.remote_key }}.pem
Expand Down
49 changes: 0 additions & 49 deletions data/templates/ntp/ntpd.conf.j2

This file was deleted.

2 changes: 1 addition & 1 deletion data/templates/telegraf/telegraf.j2
Expand Up @@ -102,7 +102,7 @@
dirs = ["/proc/sys/net/ipv4/netfilter","/proc/sys/net/netfilter"]
[[inputs.ethtool]]
interface_include = {{ interfaces_ethernet }}
[[inputs.ntpq]]
[[inputs.chrony]]
dns_lookup = true
[[inputs.internal]]
[[inputs.nstat]]
Expand Down
4 changes: 1 addition & 3 deletions debian/control
Expand Up @@ -39,7 +39,6 @@ Depends:
beep,
bmon,
bsdmainutils,
charon-systemd,
conntrack,
conntrackd,
conserver-client,
Expand Down Expand Up @@ -102,8 +101,7 @@ Depends:
nfct,
nftables (>= 0.9.3),
nginx-light,
ntp,
ntpdate,
chrony,
nvme-cli,
ocserv,
opennhrp,
Expand Down
2 changes: 1 addition & 1 deletion interface-definitions/include/version/ipsec-version.xml.i
@@ -1,3 +1,3 @@
<!-- include start from include/version/ipsec-version.xml.i -->
<syntaxVersion component='ipsec' version='10'></syntaxVersion>
<syntaxVersion component='ipsec' version='11'></syntaxVersion>
<!-- include end -->
2 changes: 1 addition & 1 deletion interface-definitions/include/version/ntp-version.xml.i
@@ -1,3 +1,3 @@
<!-- include start from include/version/ntp-version.xml.i -->
<syntaxVersion component='ntp' version='1'></syntaxVersion>
<syntaxVersion component='ntp' version='2'></syntaxVersion>
<!-- include end -->
25 changes: 14 additions & 11 deletions interface-definitions/ntp.xml.in
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!-- NTP configuration -->
<interfaceDefinition>
<node name="system">
<node name="service">
<children>
<node name="ntp" owner="${vyos_conf_scripts_dir}/ntp.py">
<properties>
Expand Down Expand Up @@ -43,12 +43,6 @@
<valueless/>
</properties>
</leafNode>
<leafNode name="preempt">
<properties>
<help>Specifies the association as preemptable rather than the default persistent</help>
<valueless/>
</properties>
</leafNode>
<leafNode name="prefer">
<properties>
<help>Marks the server as preferred</help>
Expand All @@ -57,24 +51,33 @@
</leafNode>
</children>
</tagNode>
<node name="allow-clients">
<node name="allow-client">
<properties>
<help>Network Time Protocol (NTP) server options</help>
<help>Specify NTP clients allowed to access the server</help>
</properties>
<children>
<leafNode name="address">
<properties>
<help>IP address</help>
<valueHelp>
<format>ipv4</format>
<description>Allowed IPv4 address</description>
</valueHelp>
<valueHelp>
<format>ipv4net</format>
<description>IP address and prefix length</description>
<description>Allowed IPv4 prefix</description>
</valueHelp>
<valueHelp>
<format>ipv6</format>
<description>Allowed IPv6 address</description>
</valueHelp>
<valueHelp>
<format>ipv6net</format>
<description>IPv6 address and prefix length</description>
<description>Allowed IPv6 prefix</description>
</valueHelp>
<multi/>
<constraint>
<validator name="ip-address"/>
<validator name="ip-prefix"/>
</constraint>
</properties>
Expand Down
35 changes: 34 additions & 1 deletion interface-definitions/vpn-ipsec.xml.in
Expand Up @@ -11,6 +11,39 @@
<priority>901</priority>
</properties>
<children>
<node name="authentication">
<properties>
<help>Authentication</help>
</properties>
<children>
<tagNode name="psk">
<properties>
<help>Pre-shared key name</help>
</properties>
<children>
<leafNode name="id">
<properties>
<help>ID for authentication</help>
<valueHelp>
<format>txt</format>
<description>ID used for authentication</description>
</valueHelp>
<multi/>
</properties>
</leafNode>
<leafNode name="secret">
<properties>
<help>IKE pre-shared secret key</help>
<valueHelp>
<format>txt</format>
<description>IKE pre-shared secret key</description>
</valueHelp>
</properties>
</leafNode>
</children>
</tagNode>
</children>
</node>
<leafNode name="disable-uniqreqids">
<properties>
<help>Disable requirement for unique IDs in the Security Database</help>
Expand Down Expand Up @@ -948,7 +981,6 @@
</constraint>
</properties>
</leafNode>
#include <include/ipsec/authentication-pre-shared-secret.xml.i>
<leafNode name="remote-id">
<properties>
<help>ID for remote authentication</help>
Expand All @@ -957,6 +989,7 @@
<description>ID used for peer authentication</description>
</valueHelp>
</properties>
<defaultValue>%any</defaultValue>
</leafNode>
<leafNode name="use-x509-id">
<properties>
Expand Down