diff options
Diffstat (limited to 'data')
29 files changed, 289 insertions, 90 deletions
| diff --git a/data/config-mode-dependencies/vyos-1x.json b/data/config-mode-dependencies/vyos-1x.json index 7506a0908..ccfc022f4 100644 --- a/data/config-mode-dependencies/vyos-1x.json +++ b/data/config-mode-dependencies/vyos-1x.json @@ -34,6 +34,7 @@          "ipsec": ["vpn_ipsec"],          "openconnect": ["vpn_openconnect"],          "rpki": ["protocols_rpki"], +        "ssh": ["service_ssh"],          "sstp": ["vpn_sstp"],          "sstpc": ["interfaces_sstpc"],          "stunnel": ["service_stunnel"] @@ -73,6 +74,9 @@      "system_ipv6": {          "sysctl": ["system_sysctl"]      }, +    "system_login": { +        "ssh": ["service_ssh"] +    },      "system_option": {          "ip_ipv6": ["system_ip", "system_ipv6"],          "sysctl": ["system_sysctl"] diff --git a/data/config.boot.default b/data/config.boot.default index db5d11ea1..02f56da8f 100644 --- a/data/config.boot.default +++ b/data/config.boot.default @@ -40,6 +40,9 @@ system {              }          }      } +    option { +        reboot-on-upgrade-failure 5 +    }      syslog {          local {              facility all { diff --git a/data/templates/aws/override_aws_gwlbtun.conf.j2 b/data/templates/aws/override_aws_gwlbtun.conf.j2 index 4c566d852..e7e60dc95 100644 --- a/data/templates/aws/override_aws_gwlbtun.conf.j2 +++ b/data/templates/aws/override_aws_gwlbtun.conf.j2 @@ -30,7 +30,7 @@ After=vyos-router.service  [Service]  EnvironmentFile= -ExecStart=/usr/bin/gwlbtun {{ args | join(' ') }} -CapabilityBoundingSet=CAP_NET_ADMIN +ExecStart=/usr/sbin/gwlbtun {{ args | join(' ') }} +CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW  Restart=always  RestartSec=10 diff --git a/data/templates/conntrack/sysctl.conf.j2 b/data/templates/conntrack/sysctl.conf.j2 index cd6c34ede..8d934db9c 100644 --- a/data/templates/conntrack/sysctl.conf.j2 +++ b/data/templates/conntrack/sysctl.conf.j2 @@ -1,10 +1,11 @@  # Autogenerated by system_conntrack.py  {# all values have defaults - thus no checking required #} +net.netfilter.nf_conntrack_buckets = {{ hash_size }}  net.netfilter.nf_conntrack_expect_max = {{ expect_table_size }}  net.netfilter.nf_conntrack_max = {{ table_size }}  net.ipv4.tcp_max_syn_backlog = {{ tcp.half_open_connections }}  net.netfilter.nf_conntrack_tcp_loose = {{ '1' if tcp.loose is vyos_defined('enable') else '0' }}  net.netfilter.nf_conntrack_tcp_max_retrans = {{ tcp.max_retrans }}  net.netfilter.nf_conntrack_acct = {{ '1' if flow_accounting is vyos_defined else '0' }} -net.netfilter.nf_conntrack_timestamp = {{ '1' if log.timestamp is vyos_defined else '0' }}
\ No newline at end of file +net.netfilter.nf_conntrack_timestamp = {{ '1' if log.timestamp is vyos_defined else '0' }} diff --git a/data/templates/conntrack/vyos_nf_conntrack.conf.j2 b/data/templates/conntrack/vyos_nf_conntrack.conf.j2 deleted file mode 100644 index 1b12fec5f..000000000 --- a/data/templates/conntrack/vyos_nf_conntrack.conf.j2 +++ /dev/null @@ -1,2 +0,0 @@ -# Autogenerated by system_conntrack.py -options nf_conntrack hashsize={{ hash_size }} diff --git a/data/templates/container/containers.conf.j2 b/data/templates/container/containers.conf.j2 index c8b54dfbb..414c3e849 100644 --- a/data/templates/container/containers.conf.j2 +++ b/data/templates/container/containers.conf.j2 @@ -170,10 +170,6 @@ default_sysctls = [  #  #label = true -# Logging driver for the container. Available options: k8s-file and journald. -# -#log_driver = "k8s-file" -  # Maximum size allowed for the container log file. Negative numbers indicate  # that no size limit is imposed. If positive, it must be >= 8192 to match or  # exceed conmon's read buffer. The file is truncated and re-opened so the diff --git a/data/templates/dhcp-client/ipv6.override.conf.j2 b/data/templates/dhcp-client/ipv6.override.conf.j2 index b0c0e0544..d270a55fc 100644 --- a/data/templates/dhcp-client/ipv6.override.conf.j2 +++ b/data/templates/dhcp-client/ipv6.override.conf.j2 @@ -4,6 +4,9 @@  [Unit]  ConditionPathExists={{ dhcp6_client_dir }}/dhcp6c.%i.conf +{% if ifname.startswith('pppoe') %} +After=ppp@{{ ifname }}.service +{% endif %}  [Service]  ExecStart= diff --git a/data/templates/dhcp-server/kea-ctrl-agent.conf.j2 b/data/templates/dhcp-server/kea-ctrl-agent.conf.j2 deleted file mode 100644 index b37cf4798..000000000 --- a/data/templates/dhcp-server/kea-ctrl-agent.conf.j2 +++ /dev/null @@ -1,14 +0,0 @@ -{ -    "Control-agent": { -{% if high_availability is vyos_defined %} -        "http-host": "{{ high_availability.source_address }}", -        "http-port": 647, -        "control-sockets": { -            "dhcp4": { -                "socket-type": "unix", -                "socket-name": "/run/kea/dhcp4-ctrl-socket" -            } -        } -{% endif %} -    } -} diff --git a/data/templates/dhcp-server/kea-dhcp-ddns.conf.j2 b/data/templates/dhcp-server/kea-dhcp-ddns.conf.j2 new file mode 100644 index 000000000..7b0394a88 --- /dev/null +++ b/data/templates/dhcp-server/kea-dhcp-ddns.conf.j2 @@ -0,0 +1,30 @@ +{ +    "DhcpDdns": { +        "ip-address": "127.0.0.1", +        "port": 53001, +        "control-socket": { +            "socket-type": "unix", +            "socket-name": "/run/kea/kea-ddns-ctrl-socket" +        }, +        "tsig-keys": {{ dynamic_dns_update | kea_dynamic_dns_update_tsig_key_json }}, +        "forward-ddns" : { +            "ddns-domains": {{ dynamic_dns_update | kea_dynamic_dns_update_domains('forward_domain') }} +        }, +        "reverse-ddns" : { +            "ddns-domains": {{ dynamic_dns_update | kea_dynamic_dns_update_domains('reverse_domain') }} +        }, +        "loggers": [ +            { +                "name": "kea-dhcp-ddns", +                "output_options": [ +                    { +                        "output": "stdout", +                        "pattern": "%-5p %m\n" +                    } +                ], +                "severity": "INFO", +                "debuglevel": 0 +            } +        ] +    } +} diff --git a/data/templates/dhcp-server/kea-dhcp4.conf.j2 b/data/templates/dhcp-server/kea-dhcp4.conf.j2 index 2e10d58e0..d08ca0eaa 100644 --- a/data/templates/dhcp-server/kea-dhcp4.conf.j2 +++ b/data/templates/dhcp-server/kea-dhcp4.conf.j2 @@ -25,20 +25,6 @@          },          "option-def": [              { -                "name": "rfc3442-static-route", -                "code": 121, -                "type": "record", -                "array": true, -                "record-types": "uint8,uint8,uint8,uint8,uint8,uint8,uint8" -            }, -            { -                "name": "windows-static-route", -                "code": 249, -                "type": "record", -                "array": true, -                "record-types": "uint8,uint8,uint8,uint8,uint8,uint8,uint8" -            }, -            {                  "name": "wpad-url",                  "code": 252,                  "type": "string" @@ -50,6 +36,19 @@                  "space": "ubnt"              }          ], +{% if dynamic_dns_update is vyos_defined %} +        "dhcp-ddns": { +            "enable-updates": true, +            "server-ip": "127.0.0.1", +            "server-port": 53001, +            "sender-ip": "", +            "sender-port": 0, +            "max-queue-size": 1024, +            "ncr-protocol": "UDP", +            "ncr-format": "JSON" +        }, +        {{ dynamic_dns_update | kea_dynamic_dns_update_main_json }} +{% endif %}          "hooks-libraries": [  {% if high_availability is vyos_defined %}              { @@ -69,6 +68,16 @@              },  {% endif %}              { +                "library": "/usr/lib/{{ machine }}-linux-gnu/kea/hooks/libdhcp_ping_check.so", +                "parameters": { +                    "enable-ping-check" : false, +                    "min-ping-requests" : 1, +                    "reply-timeout" : 100, +                    "ping-cltt-secs" : 60, +                    "ping-channel-threads" : 0 +                } +            }, +            {                  "library": "/usr/lib/{{ machine }}-linux-gnu/kea/hooks/libdhcp_lease_cmds.so",                  "parameters": {}              } diff --git a/data/templates/firewall/nftables-defines.j2 b/data/templates/firewall/nftables-defines.j2 index 3147b4c37..c4b6b7eba 100644 --- a/data/templates/firewall/nftables-defines.j2 +++ b/data/templates/firewall/nftables-defines.j2 @@ -44,6 +44,15 @@      }  {%         endfor %}  {%     endif %} +{%     if group.remote_group is vyos_defined and is_l3 and is_ipv6 %} +{%         for name, name_config in group.remote_group.items() %} +    set R6_{{ name }} { +        type {{ ip_type }} +        flags interval +        auto-merge +    } +{%         endfor %} +{%     endif %}  {%     if group.mac_group is vyos_defined %}  {%         for group_name, group_conf in group.mac_group.items() %}  {%             set includes = group_conf.include if group_conf.include is vyos_defined else [] %} @@ -102,7 +111,7 @@          flags interval          auto-merge  {%             if group_conf.interface is vyos_defined or includes %} -        elements = { {{ group_conf.interface | nft_nested_group(includes, group.interface_group, 'interface') | join(",") }} } +        elements = { {{ group_conf.interface | nft_nested_group(includes, group.interface_group, 'interface') | quoted_join(",") }} }  {%             endif %}      }  {%         endfor %} diff --git a/data/templates/firewall/nftables-geoip-update.j2 b/data/templates/firewall/nftables-geoip-update.j2 index 832ccc3e9..d8f80d1f5 100644 --- a/data/templates/firewall/nftables-geoip-update.j2 +++ b/data/templates/firewall/nftables-geoip-update.j2 @@ -31,3 +31,36 @@ table ip6 vyos_filter {  {%     endfor %}  }  {% endif %} + + +{% if ipv4_sets_policy is vyos_defined %} +{%     for setname, ip_list in ipv4_sets_policy.items() %} +flush set ip vyos_mangle {{ setname }} +{%     endfor %} + +table ip vyos_mangle { +{%     for setname, ip_list in ipv4_sets_policy.items() %} +    set {{ setname }} { +        type ipv4_addr +        flags interval +        elements = { {{ ','.join(ip_list) }} } +    } +{%     endfor %} +} +{% endif %} + +{% if ipv6_sets_policy is vyos_defined %} +{%     for setname, ip_list in ipv6_sets_policy.items() %} +flush set ip6 vyos_mangle {{ setname }} +{%     endfor %} + +table ip6 vyos_mangle { +{%     for setname, ip_list in ipv6_sets_policy.items() %} +    set {{ setname }} { +        type ipv6_addr +        flags interval +        elements = { {{ ','.join(ip_list) }} } +    } +{%     endfor %} +} +{% endif %} diff --git a/data/templates/firewall/nftables-policy.j2 b/data/templates/firewall/nftables-policy.j2 index 9e28899b0..00d0e8a62 100644 --- a/data/templates/firewall/nftables-policy.j2 +++ b/data/templates/firewall/nftables-policy.j2 @@ -33,6 +33,15 @@ table ip vyos_mangle {  {%         endif %}      }  {%     endfor %} + +{%     if geoip_updated.name is vyos_defined %} +{%         for setname in geoip_updated.name %} +    set {{ setname }} { +        type ipv4_addr +        flags interval +    } +{%         endfor %} +{%     endif %}  {% endif %}  {{ group_tmpl.groups(firewall_group, False, True) }} @@ -65,6 +74,14 @@ table ip6 vyos_mangle {  {%         endif %}      }  {%     endfor %} +{%     if geoip_updated.ipv6_name is vyos_defined %} +{%         for setname in geoip_updated.ipv6_name %} +    set {{ setname }} { +        type ipv6_addr +        flags interval +    } +{%         endfor %} +{%     endif %}  {% endif %}  {{ group_tmpl.groups(firewall_group, True, True) }} diff --git a/data/templates/firewall/nftables-zone.j2 b/data/templates/firewall/nftables-zone.j2 index 645a38706..66f7e0b1c 100644 --- a/data/templates/firewall/nftables-zone.j2 +++ b/data/templates/firewall/nftables-zone.j2 @@ -9,11 +9,11 @@  {% for zone_name, zone_conf in zone.items() %}  {%     if 'local_zone' not in zone_conf %}  {%         if 'interface' in zone_conf.member %} -        oifname { {{ zone_conf.member.interface | join(',') }} } counter jump VZONE_{{ zone_name }} +        oifname { {{ zone_conf.member.interface | quoted_join(',') }} } counter jump VZONE_{{ zone_name }}  {%         endif %}  {%         if 'vrf' in zone_conf.member %}  {%             for vrf_name in zone_conf.member.vrf %} -        oifname { {{ zone_conf['vrf_interfaces'][vrf_name] }} } counter jump VZONE_{{ zone_name }} +        oifname { "{{ zone_conf['vrf_interfaces'][vrf_name] }}" } counter jump VZONE_{{ zone_name }}  {%             endfor %}  {%         endif %}  {%     endif %} @@ -49,12 +49,12 @@  {%             for from_zone, from_conf in zone_conf.from.items() if from_conf.firewall[fw_name] is vyos_defined %}  {%                 if 'interface' in zone[from_zone].member %} -        iifname { {{ zone[from_zone].member.interface | join(",") }} } counter jump NAME{{ suffix }}_{{ from_conf.firewall[fw_name] }} -        iifname { {{ zone[from_zone].member.interface | join(",") }} } counter return +        iifname { {{ zone[from_zone].member.interface | quoted_join(",") }} } counter jump NAME{{ suffix }}_{{ from_conf.firewall[fw_name] }} +        iifname { {{ zone[from_zone].member.interface | quoted_join(",") }} } counter return  {%                 endif %}  {%                 if 'vrf' in zone[from_zone].member %} -        iifname { {{ zone[from_zone].member.vrf | join(",") }} } counter jump NAME{{ suffix }}_{{ from_conf.firewall[fw_name] }} -        iifname { {{ zone[from_zone].member.vrf | join(",") }} } counter return +        iifname { {{ zone[from_zone].member.vrf | quoted_join(",") }} } counter jump NAME{{ suffix }}_{{ from_conf.firewall[fw_name] }} +        iifname { {{ zone[from_zone].member.vrf | quoted_join(",") }} } counter return  {%                 endif %}  {%             endfor %}  {%         endif %} @@ -65,13 +65,13 @@  {%         if zone_conf.from_local is vyos_defined %}  {%             for from_zone, from_conf in zone_conf.from_local.items() if from_conf.firewall[fw_name] is vyos_defined %}  {%                 if 'interface' in zone[from_zone].member %} -        oifname { {{ zone[from_zone].member.interface | join(",") }} } counter jump NAME{{ suffix }}_{{ from_conf.firewall[fw_name] }} -        oifname { {{ zone[from_zone].member.interface | join(",") }} } counter return +        oifname { {{ zone[from_zone].member.interface | quoted_join(",") }} } counter jump NAME{{ suffix }}_{{ from_conf.firewall[fw_name] }} +        oifname { {{ zone[from_zone].member.interface | quoted_join(",") }} } counter return  {%                 endif %}  {%                 if 'vrf' in zone[from_zone].member %}  {%                     for vrf_name in zone[from_zone].member.vrf %} -        oifname { {{ zone[from_zone]['vrf_interfaces'][vrf_name] }} } counter jump NAME{{ suffix }}_{{ from_conf.firewall[fw_name] }} -        oifname { {{ zone[from_zone]['vrf_interfaces'][vrf_name] }} } counter return +        oifname { "{{ zone[from_zone]['vrf_interfaces'][vrf_name] }}" } counter jump NAME{{ suffix }}_{{ from_conf.firewall[fw_name] }} +        oifname { "{{ zone[from_zone]['vrf_interfaces'][vrf_name] }}" } counter return  {%                     endfor %}  {%                 endif %}  {%             endfor %} @@ -81,29 +81,29 @@  {%     else %}      chain VZONE_{{ zone_name }} {  {%         if 'interface' in zone_conf.member %} -        iifname { {{ zone_conf.member.interface | join(",") }} } counter {{ zone_conf | nft_intra_zone_action(ipv6) }} +        iifname { {{ zone_conf.member.interface | quoted_join(",") }} } counter {{ zone_conf | nft_intra_zone_action(ipv6) }}  {%         endif %}  {%         if 'vrf' in zone_conf.member %} -        iifname { {{ zone_conf.member.vrf | join(",") }} } counter {{ zone_conf | nft_intra_zone_action(ipv6) }} +        iifname { {{ zone_conf.member.vrf | quoted_join(",") }} } counter {{ zone_conf | nft_intra_zone_action(ipv6) }}  {%         endif %}  {%         if zone_conf.intra_zone_filtering is vyos_defined %}  {%             if 'interface' in zone_conf.member %} -        iifname { {{ zone_conf.member.interface | join(",") }} } counter return +        iifname { {{ zone_conf.member.interface | quoted_join(",") }} } counter return  {%             endif %}  {%             if 'vrf' in zone_conf.member %} -        iifname { {{ zone_conf.member.vrf | join(",") }} } counter return +        iifname { {{ zone_conf.member.vrf | quoted_join(",") }} } counter return  {%             endif %}  {%         endif %}  {%         if zone_conf.from is vyos_defined %}  {%             for from_zone, from_conf in zone_conf.from.items() if from_conf.firewall[fw_name] is vyos_defined %}  {%                 if zone[from_zone].local_zone is not defined %}  {%                     if 'interface' in zone[from_zone].member %} -        iifname { {{ zone[from_zone].member.interface | join(",") }} } counter jump NAME{{ suffix }}_{{ from_conf.firewall[fw_name] }} -        iifname { {{ zone[from_zone].member.interface | join(",") }} } counter return +        iifname { {{ zone[from_zone].member.interface | quoted_join(",") }} } counter jump NAME{{ suffix }}_{{ from_conf.firewall[fw_name] }} +        iifname { {{ zone[from_zone].member.interface | quoted_join(",") }} } counter return  {%                     endif %}  {%                     if 'vrf' in zone[from_zone].member %} -        iifname { {{ zone[from_zone].member.vrf | join(",") }} } counter jump NAME{{ suffix }}_{{ from_conf.firewall[fw_name] }} -        iifname { {{ zone[from_zone].member.vrf | join(",") }} } counter return +        iifname { {{ zone[from_zone].member.vrf | quoted_join(",") }} } counter jump NAME{{ suffix }}_{{ from_conf.firewall[fw_name] }} +        iifname { {{ zone[from_zone].member.vrf | quoted_join(",") }} } counter return  {%                     endif %}  {%                 endif %}  {%             endfor %} diff --git a/data/templates/firewall/nftables.j2 b/data/templates/firewall/nftables.j2 index 67473da8e..39ef72059 100755 --- a/data/templates/firewall/nftables.j2 +++ b/data/templates/firewall/nftables.j2 @@ -47,7 +47,7 @@ table ip vyos_filter {      chain VYOS_FORWARD_{{ prior }} {          type filter hook forward priority {{ prior }}; policy accept;  {%             if global_options.state_policy is vyos_defined %} -        jump VYOS_STATE_POLICY +        jump VYOS_STATE_POLICY_FORWARD  {%             endif %}  {%             if conf.rule is vyos_defined %}  {%                 for rule_id, rule_conf in conf.rule.items() if rule_conf.disable is not vyos_defined %} @@ -180,6 +180,22 @@ table ip vyos_filter {  {%     endif %}          return      } + +    chain VYOS_STATE_POLICY_FORWARD { +{%     if global_options.state_policy.offload is vyos_defined %} +        counter flow add @VYOS_FLOWTABLE_{{ global_options.state_policy.offload.offload_target }} +{%     endif %} +{%     if global_options.state_policy.established is vyos_defined %} +        {{ global_options.state_policy.established | nft_state_policy('established') }} +{%     endif %} +{%     if global_options.state_policy.invalid is vyos_defined %} +        {{ global_options.state_policy.invalid | nft_state_policy('invalid') }} +{%     endif %} +{%     if global_options.state_policy.related is vyos_defined %} +        {{ global_options.state_policy.related | nft_state_policy('related') }} +{%     endif %} +        return +    }  {% endif %}  } @@ -200,7 +216,7 @@ table ip6 vyos_filter {      chain VYOS_IPV6_FORWARD_{{ prior }} {          type filter hook forward priority {{ prior }}; policy accept;  {%             if global_options.state_policy is vyos_defined %} -        jump VYOS_STATE_POLICY6 +        jump VYOS_STATE_POLICY6_FORWARD  {%             endif %}  {%             if conf.rule is vyos_defined %}  {%                 for rule_id, rule_conf in conf.rule.items() if rule_conf.disable is not vyos_defined %} @@ -331,6 +347,22 @@ table ip6 vyos_filter {  {%     endif %}          return      } + +    chain VYOS_STATE_POLICY6_FORWARD { +{%     if global_options.state_policy.offload is vyos_defined %} +        counter flow add @VYOS_FLOWTABLE_{{ global_options.state_policy.offload.offload_target }} +{%     endif %} +{%     if global_options.state_policy.established is vyos_defined %} +        {{ global_options.state_policy.established | nft_state_policy('established') }} +{%     endif %} +{%     if global_options.state_policy.invalid is vyos_defined %} +        {{ global_options.state_policy.invalid | nft_state_policy('invalid') }} +{%     endif %} +{%     if global_options.state_policy.related is vyos_defined %} +        {{ global_options.state_policy.related | nft_state_policy('related') }} +{%     endif %} +        return +    }  {% endif %}  } @@ -378,11 +410,11 @@ table bridge vyos_filter {  {%         for prior, conf in bridge.output.items() %}      chain VYOS_OUTPUT_{{ prior }} {          type filter hook output priority {{ prior }}; policy accept; -{%             if global_options.apply_to_bridged_traffic is vyos_defined %} -{%                 if 'invalid_connections' in global_options.apply_to_bridged_traffic %} -        ct state invalid udp sport 67 udp dport 68 counter accept -        ct state invalid ether type arp counter accept -        ct state invalid ether type 0x8864 counter accept +{%             if global_options.apply_to_bridged_traffic.accept_invalid is vyos_defined %} +{%                 if 'ethernet_type' in global_options.apply_to_bridged_traffic.accept_invalid %} +{%                     for ether_type in global_options.apply_to_bridged_traffic.accept_invalid.ethernet_type %} +        {{ ether_type | nft_accept_invalid() }} +{%                     endfor %}  {%                 endif %}  {%             endif %}  {%             if global_options.state_policy is vyos_defined %} diff --git a/data/templates/frr/bgpd.frr.j2 b/data/templates/frr/bgpd.frr.j2 index b89f15be1..e5a75090f 100644 --- a/data/templates/frr/bgpd.frr.j2 +++ b/data/templates/frr/bgpd.frr.j2 @@ -98,6 +98,8 @@  {% endif %}  {% if config.enforce_first_as is vyos_defined %}   neighbor {{ neighbor }} enforce-first-as +{% else %} + no neighbor {{ neighbor }} enforce-first-as  {% endif %}  {% if config.strict_capability_match is vyos_defined %}   neighbor {{ neighbor }} strict-capability-match @@ -636,6 +638,9 @@ bgp route-reflector allow-outbound-policy  {% if parameters.no_fast_external_failover is vyos_defined %}   no bgp fast-external-failover  {% endif %} +{% if parameters.no_ipv6_auto_ra is vyos_defined %} + no bgp ipv6-auto-ra +{% endif %}  {% if parameters.no_suppress_duplicates is vyos_defined %}   no bgp suppress-duplicates  {% endif %} diff --git a/data/templates/frr/daemons.frr.tmpl b/data/templates/frr/daemons.frr.tmpl index 835dc382b..afd888122 100644 --- a/data/templates/frr/daemons.frr.tmpl +++ b/data/templates/frr/daemons.frr.tmpl @@ -4,7 +4,6 @@  # Note: The following FRR-services must be kept disabled because they are replaced by other packages in VyOS:  #  # pimd   Replaced by package igmpproxy. -# nhrpd  Replaced by package opennhrp.  # pbrd   Replaced by PBR in nftables.  # vrrpd  Replaced by package keepalived.  # diff --git a/data/templates/frr/ospfd.frr.j2 b/data/templates/frr/ospfd.frr.j2 index bc2c74b10..79824fb64 100644 --- a/data/templates/frr/ospfd.frr.j2 +++ b/data/templates/frr/ospfd.frr.j2 @@ -82,7 +82,7 @@ router ospf {{ 'vrf ' ~ vrf if vrf is vyos_defined }}  {%     for area_id, area_config in area.items() %}  {%         if area_config.area_type is vyos_defined %}  {%             for type, type_config in area_config.area_type.items() if type != 'normal' %} - area {{ area_id }} {{ type }} {{ 'no-summary' if type_config.no_summary is vyos_defined }} + area {{ area_id }} {{ type }} {{ 'translate-' + type_config.translate if type_config.translate is vyos_defined }} {{ 'no-summary' if type_config.no_summary is vyos_defined }}  {%                 if type_config.default_cost is vyos_defined %}   area {{ area_id }} default-cost {{ type_config.default_cost }}  {%                 endif %} diff --git a/data/templates/frr/rpki.frr.j2 b/data/templates/frr/rpki.frr.j2 index edf0ccaa2..e35f99766 100644 --- a/data/templates/frr/rpki.frr.j2 +++ b/data/templates/frr/rpki.frr.j2 @@ -1,8 +1,8 @@ -! +{% macro rpki_config(rpki) %}  {# as FRR does not support deleting the entire rpki section we leave it in place even when it's empty #}  rpki -{% if cache is vyos_defined %} -{%     for peer, peer_config in cache.items() %} +{% if rpki.cache is vyos_defined %} +{%     for peer, peer_config in rpki.cache.items() %}  {#         port is mandatory and preference uses a default value #}  {%         if peer_config.ssh.username is vyos_defined %}   rpki cache ssh {{ peer | replace('_', '-') }} {{ peer_config.port }} {{ peer_config.ssh.username }} {{ peer_config.ssh.private_key_file }} {{ peer_config.ssh.public_key_file }}{{ ' source ' ~ peer_config.source_address if peer_config.source_address is vyos_defined }} preference {{ peer_config.preference }} @@ -11,14 +11,24 @@ rpki  {%         endif %}  {%     endfor %}  {% endif %} -{% if expire_interval is vyos_defined %} - rpki expire_interval {{ expire_interval }} +{% if rpki.expire_interval is vyos_defined %} + rpki expire_interval {{ rpki.expire_interval }}  {% endif %} -{% if polling_period is vyos_defined %} - rpki polling_period {{ polling_period }} +{% if rpki.polling_period is vyos_defined %} + rpki polling_period {{ rpki.polling_period }}  {% endif %} -{% if retry_interval is vyos_defined %} - rpki retry_interval {{ retry_interval }} +{% if rpki.retry_interval is vyos_defined %} + rpki retry_interval {{ rpki.retry_interval }}  {% endif %}  exit +{# j2lint: disable=jinja-statements-delimeter #} +{%- endmacro -%} +! +{% if rpki.vrf is vyos_defined %} +vrf {{ rpki.vrf }} + {{ rpki_config(rpki) | indent(width=1) }} +exit-vrf +{% else %} +{{ rpki_config(rpki) }} +{% endif %}  ! diff --git a/data/templates/frr/zebra.route-map.frr.j2 b/data/templates/frr/zebra.route-map.frr.j2 index 70a810f43..0d6d01930 100644 --- a/data/templates/frr/zebra.route-map.frr.j2 +++ b/data/templates/frr/zebra.route-map.frr.j2 @@ -1,6 +1,12 @@  !  {{ 'no ' if disable_forwarding is vyos_defined }}{{ afi }} forwarding  ! +{% if import_table is vyos_defined %} +{%     for table_num, table_config in import_table.items() %} +ip import-table {{ table_num }} {{ 'distance ' ~ table_config.distance if table_config.distance is vyos_defined }} {{ 'route-map ' ~ table_config.route_map if table_config.route_map is vyos_defined }} +{%     endfor %} +{% endif %} +!  {% if nht.no_resolve_via_default is vyos_defined %}  no {{ afi }} nht resolve-via-default  {% endif %} diff --git a/data/templates/https/nginx.default.j2 b/data/templates/https/nginx.default.j2 index 692ccbff7..47280c9f0 100644 --- a/data/templates/https/nginx.default.j2 +++ b/data/templates/https/nginx.default.j2 @@ -48,7 +48,7 @@ server {      ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK';      # proxy settings for HTTP API, if enabled; 503, if not -    location ~ ^/(retrieve|configure|config-file|image|import-pki|container-image|generate|show|reboot|reset|poweroff|traceroute|info|docs|openapi.json|redoc|graphql) { +    location ~ ^/(retrieve|configure|config-file|image|import-pki|container-image|generate|show|reboot|reset|poweroff|traceroute|info|docs|openapi.json|redoc|graphql|renew) {  {% if api is vyos_defined %}          proxy_pass http://unix:/run/api.sock;          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/data/templates/ipsec/swanctl/peer.j2 b/data/templates/ipsec/swanctl/peer.j2 index 3a9af2c94..cf0865c88 100644 --- a/data/templates/ipsec/swanctl/peer.j2 +++ b/data/templates/ipsec/swanctl/peer.j2 @@ -68,8 +68,19 @@                  rekey_packets = 0                  rekey_time = 0s  {%     endif %} -                local_ts = 0.0.0.0/0,::/0 -                remote_ts = 0.0.0.0/0,::/0 +{#     set default traffic-selectors #} +{%     set local_ts = '0.0.0.0/0,::/0' %} +{%     set remote_ts = '0.0.0.0/0,::/0' %} +{%     if peer_conf.vti.traffic_selector is vyos_defined %} +{%         if peer_conf.vti.traffic_selector.local is vyos_defined and peer_conf.vti.traffic_selector.local.prefix is vyos_defined %} +{%             set local_ts = peer_conf.vti.traffic_selector.local.prefix | join(',') %} +{%         endif %} +{%         if peer_conf.vti.traffic_selector.remote is vyos_defined and peer_conf.vti.traffic_selector.remote.prefix is vyos_defined %} +{%             set remote_ts = peer_conf.vti.traffic_selector.remote.prefix | join(',') %} +{%         endif %} +{%     endif %} +                local_ts = {{ local_ts }} +                remote_ts = {{ remote_ts }}                  updown = "/etc/ipsec.d/vti-up-down {{ peer_conf.vti.bind }}"  {#              The key defaults to 0 and will match any policies which similarly do not have a lookup key configuration. #}  {#              Thus we simply shift the key by one to also support a vti0 interface #} diff --git a/data/templates/load-balancing/haproxy.cfg.j2 b/data/templates/load-balancing/haproxy.cfg.j2 index 70ea5d2b0..62934c612 100644 --- a/data/templates/load-balancing/haproxy.cfg.j2 +++ b/data/templates/load-balancing/haproxy.cfg.j2 @@ -50,9 +50,29 @@ defaults      errorfile 503 /etc/haproxy/errors/503.http      errorfile 504 /etc/haproxy/errors/504.http +# Default ACME backend +backend buildin_acme_certbot +    server localhost 127.0.0.1:{{ get_default_port('certbot_haproxy') }} +  # Frontend  {% if service is vyos_defined %}  {%     for front, front_config in service.items() %} +{%         if front_config.redirect_http_to_https is vyos_defined %} +{%             set certbot_backend_name = 'certbot_' ~ front ~ '_backend' %} +frontend {{ front }}-http +    mode http +{%             if front_config.listen_address is vyos_defined %} +{%                 for address in front_config.listen_address %} +    bind {{ address | bracketize_ipv6 }}:80 +{%                 endfor %} +{%             else %} +    bind [::]:80 v4v6 +{%             endif %} +    acl acme_acl path_beg /.well-known/acme-challenge/ +    use_backend buildin_acme_certbot if acme_acl +    redirect scheme https code 301 if !acme_acl +{%         endif %} +  frontend {{ front }}  {%         set ssl_front = [] %}  {%         if front_config.ssl.certificate is vyos_defined and front_config.ssl.certificate is iterable %} @@ -68,9 +88,6 @@ frontend {{ front }}  {%         else %}      bind [::]:{{ front_config.port }} v4v6 {{ ssl_directive }} {{ ssl_front | join(' ') }}  {%         endif %} -{%         if front_config.redirect_http_to_https is vyos_defined %} -    http-request redirect scheme https unless { ssl_fc } -{%         endif %}  {%         if front_config.logging is vyos_defined %}  {%             for facility, facility_config in front_config.logging.facility.items() %}      log /dev/log {{ facility }} {{ facility_config.level }} @@ -237,6 +254,5 @@ backend {{ back }}  {%         if back_config.timeout.server is vyos_defined %}      timeout server {{ back_config.timeout.server }}s  {%         endif %} -  {%     endfor %}  {% endif %} diff --git a/data/templates/load-balancing/nftables-wlb.j2 b/data/templates/load-balancing/nftables-wlb.j2 index b3d7c3376..8afd0c162 100644 --- a/data/templates/load-balancing/nftables-wlb.j2 +++ b/data/templates/load-balancing/nftables-wlb.j2 @@ -9,7 +9,7 @@ table ip vyos_wanloadbalance {  {% for ifname, health_conf in interface_health.items() if health_state[ifname].if_addr %}  {%     if disable_source_nat is not vyos_defined %}  {%         set state = health_state[ifname] %} -        ct mark {{ state.mark }} counter snat to {{ state.if_addr }} +        ct mark {{ state.mark }} oifname {{ ifname }} counter snat to {{ state.if_addr }}  {%     endif %}  {% endfor %}      } diff --git a/data/templates/login/authorized_keys.j2 b/data/templates/login/authorized_keys.j2 index 695b66abe..5b15f066a 100644 --- a/data/templates/login/authorized_keys.j2 +++ b/data/templates/login/authorized_keys.j2 @@ -1,5 +1,4 @@  ### Automatically generated by system_login.py ### -  {% if authentication.public_keys is vyos_defined %}  {%     for key, key_options in authentication.public_keys.items() %}  {# The whitespace after options is wisely chosen #} diff --git a/data/templates/login/authorized_principals.j2 b/data/templates/login/authorized_principals.j2 new file mode 100644 index 000000000..16525e808 --- /dev/null +++ b/data/templates/login/authorized_principals.j2 @@ -0,0 +1,4 @@ +### Automatically generated by system_login.py ### +{% if authentication.principal is vyos_defined %} +{{ '\n'.join(authentication.principal) }} +{% endif %} diff --git a/data/templates/prometheus/node_exporter.service.j2 b/data/templates/prometheus/node_exporter.service.j2 index 135439bd6..9a943cd75 100644 --- a/data/templates/prometheus/node_exporter.service.j2 +++ b/data/templates/prometheus/node_exporter.service.j2 @@ -9,6 +9,11 @@ After=network.target  User=node_exporter  {% endif %}  ExecStart={{ vrf_command }}/usr/sbin/node_exporter \ +{% if collectors is vyos_defined %} +{%     if collectors.textfile is vyos_defined %} +        --collector.textfile.directory=/run/node_exporter/collector \ +{%     endif %} +{% endif %}  {% if listen_address is vyos_defined %}  {%     for address in listen_address %}          --web.listen-address={{ address }}:{{ port }} @@ -16,10 +21,6 @@ ExecStart={{ vrf_command }}/usr/sbin/node_exporter \  {% else %}          --web.listen-address=:{{ port }}  {% endif %} -{% if collectors is vyos_defined %} -{%     if collectors.textfile is vyos_defined %} -        --collector.textfile.directory=/run/node_exporter/collector -{%     endif %} -{% endif %} +  [Install]  WantedBy=multi-user.target diff --git a/data/templates/router-advert/radvd.conf.j2 b/data/templates/router-advert/radvd.conf.j2 index a83bd03ac..34f8e1f6d 100644 --- a/data/templates/router-advert/radvd.conf.j2 +++ b/data/templates/router-advert/radvd.conf.j2 @@ -57,6 +57,21 @@ interface {{ iface }} {      };  {%             endfor %}  {%         endif %} +{%         if iface_config.prefix is vyos_defined and "::/64" in iface_config.prefix %} +{%             if iface_config.auto_ignore is vyos_defined or iface_config.prefix | count > 1 %} +    autoignoreprefixes { +{%                 if iface_config.auto_ignore is vyos_defined %} +{%                     for auto_ignore_prefix in (iface_config.auto_ignore + iface_config.prefix | list) | reject("eq", "::/64") | unique %} +        {{ auto_ignore_prefix }}; +{%                     endfor %} +{%                 else %} +{%                     for auto_ignore_prefix in iface_config.prefix | reject("eq", "::/64") %} +        {{ auto_ignore_prefix }}; +{%                     endfor %} +{%                 endif %} +    }; +{%             endif %} +{%         endif %}  {%         if iface_config.prefix is vyos_defined %}  {%             for prefix, prefix_options in iface_config.prefix.items() %}      prefix {{ prefix }} { diff --git a/data/templates/ssh/sshd_config.j2 b/data/templates/ssh/sshd_config.j2 index 7e44efae8..1315bf2cb 100644 --- a/data/templates/ssh/sshd_config.j2 +++ b/data/templates/ssh/sshd_config.j2 @@ -111,6 +111,18 @@ ClientAliveInterval {{ client_keepalive_interval }}  RekeyLimit {{ rekey.data }}M {{ rekey.time + 'M' if rekey.time is vyos_defined }}  {% endif %} -{% if trusted_user_ca_key is vyos_defined %} -TrustedUserCAKeys /etc/ssh/trusted_user_ca_key +{% if trusted_user_ca is vyos_defined %} +# Specifies a file containing public keys of certificate authorities that are +# trusted to sign user certificates for authentication +TrustedUserCAKeys {{ get_default_config_file('sshd_user_ca') }} + +# The default is "none", i.e. not to use a principals file - in this case, the +# username of the user must appear in a certificate's principals list for it +# to be accepted. ".ssh/authorized_principals" means a per-user configuration, +# relative to $HOME. +{%     set filename = 'none' %} +{%     if has_principals is vyos_defined %} +{%         set filename = '.ssh/authorized_principals' %} +{%     endif %} +AuthorizedPrincipalsFile {{ filename }}  {% endif %} | 
