diff options
Diffstat (limited to 'interface-definitions')
34 files changed, 1695 insertions, 75 deletions
diff --git a/interface-definitions/firewall.xml.in b/interface-definitions/firewall.xml.in index 1f3c14208..78a48a522 100644 --- a/interface-definitions/firewall.xml.in +++ b/interface-definitions/firewall.xml.in @@ -1,6 +1,6 @@  <?xml version="1.0"?>  <interfaceDefinition> -  <node name="nfirewall" owner="${vyos_conf_scripts_dir}/firewall.py"> +  <node name="firewall" owner="${vyos_conf_scripts_dir}/firewall.py">      <properties>        <priority>199</priority>        <help>Firewall</help> @@ -24,6 +24,7 @@              <regex>^(enable|disable)$</regex>            </constraint>          </properties> +        <defaultValue>enable</defaultValue>        </leafNode>        <leafNode name="broadcast-ping">          <properties> @@ -43,6 +44,7 @@              <regex>^(enable|disable)$</regex>            </constraint>          </properties> +        <defaultValue>disable</defaultValue>        </leafNode>        <leafNode name="config-trap">          <properties> @@ -62,6 +64,7 @@              <regex>^(enable|disable)$</regex>            </constraint>          </properties> +        <defaultValue>disable</defaultValue>        </leafNode>        <node name="group">          <properties> @@ -203,6 +206,7 @@              <regex>^(enable|disable)$</regex>            </constraint>          </properties> +        <defaultValue>disable</defaultValue>        </leafNode>        <tagNode name="ipv6-name">          <properties> @@ -233,7 +237,7 @@                  </properties>                  <children>                    #include <include/firewall/address-ipv6.xml.i> -                  #include <include/firewall/source-destination-group.xml.i> +                  #include <include/firewall/source-destination-group-ipv6.xml.i>                    #include <include/firewall/port.xml.i>                  </children>                </node> @@ -243,7 +247,7 @@                  </properties>                  <children>                    #include <include/firewall/address-ipv6.xml.i> -                  #include <include/firewall/source-destination-group.xml.i> +                  #include <include/firewall/source-destination-group-ipv6.xml.i>                    #include <include/firewall/port.xml.i>                  </children>                </node> @@ -300,7 +304,7 @@                      <properties>                        <help>ICMP type-name</help>                        <completionHelp> -                        <list>any echo-reply pong destination-unreachable network-unreachable host-unreachable protocol-unreachable port-unreachable fragmentation-needed source-route-failed network-unknown host-unknown network-prohibited host-prohibited TOS-network-unreachable TOS-host-unreachable communication-prohibited host-precedence-violation precedence-cutoff source-quench redirect network-redirect host-redirect TOS-network-redirect TOS host-redirect echo-request ping router-advertisement router-solicitation time-exceeded ttl-exceeded ttl-zero-during-transit ttl-zero-during-reassembly parameter-problem ip-header-bad required-option-missing timestamp-request timestamp-reply address-mask-request address-mask-reply</list> +                        <list>any echo-reply pong destination-unreachable network-unreachable host-unreachable protocol-unreachable port-unreachable fragmentation-needed source-route-failed network-unknown host-unknown network-prohibited host-prohibited TOS-network-unreachable TOS-host-unreachable communication-prohibited host-precedence-violation precedence-cutoff source-quench redirect network-redirect host-redirect TOS-network-redirect TOS host-redirect echo-request ping router-advertisement router-solicitation time-exceeded ttl-exceeded ttl-zero-during-transit ttl-zero-during-reassembly parameter-problem ip-header-bad required-option-missing timestamp-request timestamp-reply address-mask-request address-mask-reply packet-too-big</list>                        </completionHelp>                        <valueHelp>                          <format>any</format> @@ -462,63 +466,18 @@                          <format>address-mask-reply</format>                          <description>ICMP type/code name</description>                        </valueHelp> +                      <valueHelp> +                        <format>packet-too-big</format> +                        <description>ICMP type/code name</description> +                      </valueHelp>                        <constraint> -                        <regex>^(any|echo-reply|pong|destination-unreachable|network-unreachable|host-unreachable|protocol-unreachable|port-unreachable|fragmentation-needed|source-route-failed|network-unknown|host-unknown|network-prohibited|host-prohibited|TOS-network-unreachable|TOS-host-unreachable|communication-prohibited|host-precedence-violation|precedence-cutoff|source-quench|redirect|network-redirect|host-redirect|TOS-network-redirect|TOS host-redirect|echo-request|ping|router-advertisement|router-solicitation|time-exceeded|ttl-exceeded|ttl-zero-during-transit|ttl-zero-during-reassembly|parameter-problem|ip-header-bad|required-option-missing|timestamp-request|timestamp-reply|address-mask-request|address-mask-reply)$</regex> +                        <regex>^(any|echo-reply|pong|destination-unreachable|network-unreachable|host-unreachable|protocol-unreachable|port-unreachable|fragmentation-needed|source-route-failed|network-unknown|host-unknown|network-prohibited|host-prohibited|TOS-network-unreachable|TOS-host-unreachable|communication-prohibited|host-precedence-violation|precedence-cutoff|source-quench|redirect|network-redirect|host-redirect|TOS-network-redirect|TOS host-redirect|echo-request|ping|router-advertisement|router-solicitation|time-exceeded|ttl-exceeded|ttl-zero-during-transit|ttl-zero-during-reassembly|parameter-problem|ip-header-bad|required-option-missing|timestamp-request|timestamp-reply|address-mask-request|address-mask-reply|packet-too-big)$</regex>                          <validator name="numeric" argument="--range 0-255"/>                        </constraint>                      </properties>                    </leafNode>                  </children>                </node> -              <node name="p2p"> -                <properties> -                  <help>P2P application packets</help> -                </properties> -                <children> -                  <leafNode name="all"> -                    <properties> -                      <help>AppleJuice/BitTorrent/Direct Connect/eDonkey/eMule/Gnutella/KaZaA application packets</help> -                      <valueless/> -                    </properties> -                  </leafNode> -                  <leafNode name="applejuice"> -                    <properties> -                      <help>AppleJuice application packets</help> -                      <valueless/> -                    </properties> -                  </leafNode> -                  <leafNode name="bittorrent"> -                    <properties> -                      <help>BitTorrent application packets</help> -                      <valueless/> -                    </properties> -                  </leafNode> -                  <leafNode name="directconnect"> -                    <properties> -                      <help>Direct Connect application packets</help> -                      <valueless/> -                    </properties> -                  </leafNode> -                  <leafNode name="edonkey"> -                    <properties> -                      <help>eDonkey/eMule application packets</help> -                      <valueless/> -                    </properties> -                  </leafNode> -                  <leafNode name="gnutella"> -                    <properties> -                      <help>Gnutella application packets</help> -                      <valueless/> -                    </properties> -                  </leafNode> -                  <leafNode name="kazaa"> -                    <properties> -                      <help>KaZaA application packets</help> -                      <valueless/> -                    </properties> -                  </leafNode> -                </children> -              </node>              </children>            </tagNode>          </children> @@ -541,6 +500,7 @@              <regex>^(enable|disable)$</regex>            </constraint>          </properties> +        <defaultValue>disable</defaultValue>        </leafNode>        <leafNode name="ipv6-src-route">          <properties> @@ -560,6 +520,7 @@              <regex>^(enable|disable)$</regex>            </constraint>          </properties> +        <defaultValue>disable</defaultValue>        </leafNode>        <leafNode name="log-martians">          <properties> @@ -579,6 +540,7 @@              <regex>^(enable|disable)$</regex>            </constraint>          </properties> +        <defaultValue>enable</defaultValue>        </leafNode>        <tagNode name="name">          <properties> @@ -678,6 +640,7 @@              <regex>^(enable|disable)$</regex>            </constraint>          </properties> +        <defaultValue>disable</defaultValue>        </leafNode>        <leafNode name="send-redirects">          <properties> @@ -697,6 +660,7 @@              <regex>^(enable|disable)$</regex>            </constraint>          </properties> +        <defaultValue>enable</defaultValue>        </leafNode>        <leafNode name="source-validation">          <properties> @@ -720,6 +684,7 @@              <regex>^(strict|loose|disable)$</regex>            </constraint>          </properties> +        <defaultValue>disable</defaultValue>        </leafNode>        <node name="state-policy">          <properties> @@ -773,6 +738,7 @@              <regex>^(enable|disable)$</regex>            </constraint>          </properties> +        <defaultValue>enable</defaultValue>        </leafNode>        <leafNode name="twa-hazards-protection">          <properties> @@ -792,6 +758,7 @@              <regex>^(enable|disable)$</regex>            </constraint>          </properties> +        <defaultValue>disable</defaultValue>        </leafNode>      </children>    </node> diff --git a/interface-definitions/include/firewall/action.xml.i b/interface-definitions/include/firewall/action.xml.i index 230f590cb..4ba93e3aa 100644 --- a/interface-definitions/include/firewall/action.xml.i +++ b/interface-definitions/include/firewall/action.xml.i @@ -3,18 +3,22 @@    <properties>      <help>Rule action [REQUIRED]</help>      <completionHelp> -      <list>permit deny</list> +      <list>accept reject drop</list>      </completionHelp>      <valueHelp> -      <format>permit</format> -      <description>Permit matching entries</description> +      <format>accept</format> +      <description>Accept matching entries</description>      </valueHelp>      <valueHelp> -      <format>deny</format> -      <description>Deny matching entries</description> +      <format>reject</format> +      <description>Reject matching entries</description> +    </valueHelp> +    <valueHelp> +      <format>drop</format> +      <description>Drop matching entries</description>      </valueHelp>      <constraint> -      <regex>^(permit|deny)$</regex> +      <regex>^(accept|reject|drop)$</regex>      </constraint>    </properties>  </leafNode> diff --git a/interface-definitions/include/firewall/common-rule.xml.i b/interface-definitions/include/firewall/common-rule.xml.i index a59c0b390..415b6bf00 100644 --- a/interface-definitions/include/firewall/common-rule.xml.i +++ b/interface-definitions/include/firewall/common-rule.xml.i @@ -55,7 +55,7 @@          <help>Maximum number of packets to allow in excess of rate</help>          <valueHelp>            <format>u32:0-4294967295</format> -          <description>burst__change_me</description> +          <description>Maximum number of packets to allow in excess of rate</description>          </valueHelp>          <constraint>            <validator name="numeric" argument="--range 0-4294967295"/> @@ -67,7 +67,7 @@          <help>Maximum average matching rate</help>          <valueHelp>            <format>u32:0-4294967295</format> -          <description>rate__change_me</description> +          <description>Maximum average matching rate</description>          </valueHelp>          <constraint>            <validator name="numeric" argument="--range 0-4294967295"/> @@ -121,7 +121,6 @@        <validator name="ip-protocol"/>      </constraint>    </properties> -  <defaultValue>all</defaultValue>  </leafNode>  <node name="recent">    <properties> @@ -285,40 +284,65 @@      <help>Time to match rule</help>    </properties>    <children> -    <leafNode name="monthdays"> -      <properties> -        <help>Monthdays to match rule on</help> -      </properties> -    </leafNode>      <leafNode name="startdate">        <properties>          <help>Date to start matching rule</help> +        <valueHelp> +          <format>txt</format> +          <description>Enter date using following notation - YYYY-MM-DD</description> +        </valueHelp> +        <constraint> +          <regex>^(\d{4}\-\d{2}\-\d{2})$</regex> +        </constraint>        </properties>      </leafNode>      <leafNode name="starttime">        <properties>          <help>Time of day to start matching rule</help> +        <valueHelp> +          <format>txt</format> +          <description>Enter time using using 24 hour notation - hh:mm:ss</description> +        </valueHelp> +        <constraint> +          <regex>^([0-2][0-9](\:[0-5][0-9]){1,2})$</regex> +        </constraint>        </properties>      </leafNode>      <leafNode name="stopdate">        <properties>          <help>Date to stop matching rule</help> +        <valueHelp> +          <format>txt</format> +          <description>Enter date using following notation - YYYY-MM-DD</description> +        </valueHelp> +        <constraint> +          <regex>^(\d{4}\-\d{2}\-\d{2})$</regex> +        </constraint>        </properties>      </leafNode>      <leafNode name="stoptime">        <properties>          <help>Time of day to stop matching rule</help> -      </properties> -    </leafNode> -    <leafNode name="utc"> -      <properties> -        <help>Interpret times for startdate, stopdate, starttime and stoptime to be UTC</help> -        <valueless/> +        <valueHelp> +          <format>txt</format> +          <description>Enter time using using 24 hour notation - hh:mm:ss</description> +        </valueHelp> +        <constraint> +          <regex>^([0-2][0-9](\:[0-5][0-9]){1,2})$</regex> +        </constraint>        </properties>      </leafNode>      <leafNode name="weekdays">        <properties> -        <help>Weekdays to match rule on</help> +        <help>Comma separated weekdays to match rule on</help> +        <valueHelp> +          <format>txt</format> +          <description>Name of day (Monday, Tuesday, Wednesday, Thursdays, Friday, Saturday, Sunday)</description> +        </valueHelp> +        <valueHelp> +          <format>u32:0-6</format> +          <description>Day number (0 = Sunday ... 6 = Saturday)</description> +        </valueHelp>        </properties>      </leafNode>    </children> diff --git a/interface-definitions/include/firewall/source-destination-group-ipv6.xml.i b/interface-definitions/include/firewall/source-destination-group-ipv6.xml.i new file mode 100644 index 000000000..7815b78d4 --- /dev/null +++ b/interface-definitions/include/firewall/source-destination-group-ipv6.xml.i @@ -0,0 +1,33 @@ +<!-- include start from firewall/source-destination-group-ipv6.xml.i --> +<node name="group"> +  <properties> +    <help>Group</help> +  </properties> +  <children> +    <leafNode name="address-group"> +      <properties> +        <help>Group of addresses</help> +        <completionHelp> +          <path>firewall group ipv6-address-group</path> +        </completionHelp> +      </properties> +    </leafNode> +    <leafNode name="network-group"> +      <properties> +        <help>Group of networks</help> +        <completionHelp> +          <path>firewall group ipv6-network-group</path> +        </completionHelp> +      </properties> +    </leafNode> +    <leafNode name="port-group"> +      <properties> +        <help>Group of ports</help> +        <completionHelp> +          <path>firewall group port-group</path> +        </completionHelp> +      </properties> +    </leafNode> +  </children> +</node> +<!-- include end --> diff --git a/interface-definitions/include/firewall/source-destination-group.xml.i b/interface-definitions/include/firewall/source-destination-group.xml.i index 30226b0d8..9a9bed0fe 100644 --- a/interface-definitions/include/firewall/source-destination-group.xml.i +++ b/interface-definitions/include/firewall/source-destination-group.xml.i @@ -7,16 +7,25 @@      <leafNode name="address-group">        <properties>          <help>Group of addresses</help> +        <completionHelp> +          <path>firewall group address-group</path> +        </completionHelp>        </properties>      </leafNode>      <leafNode name="network-group">        <properties>          <help>Group of networks</help> +        <completionHelp> +          <path>firewall group network-group</path> +        </completionHelp>        </properties>      </leafNode>      <leafNode name="port-group">        <properties>          <help>Group of ports</help> +        <completionHelp> +          <path>firewall group port-group</path> +        </completionHelp>        </properties>      </leafNode>    </children> diff --git a/interface-definitions/include/interface/interface-firewall-vif-c.xml.i b/interface-definitions/include/interface/interface-firewall-vif-c.xml.i new file mode 100644 index 000000000..1bc235fcb --- /dev/null +++ b/interface-definitions/include/interface/interface-firewall-vif-c.xml.i @@ -0,0 +1,79 @@ +<!-- include start from interface/interface-firewall-vif-c.xml.i --> +<node name="firewall" owner="${vyos_conf_scripts_dir}/firewall-interface.py $VAR(../../../@).$VAR(../../@).$VAR(../@)"> +  <properties> +    <priority>615</priority> +    <help>Firewall options</help> +  </properties> +  <children> +    <node name="in"> +      <properties> +        <help>forwarded packets on inbound interface</help> +      </properties> +      <children> +        <leafNode name="name"> +          <properties> +            <help>Inbound IPv4 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall name</path> +            </completionHelp> +          </properties> +        </leafNode> +        <leafNode name="ipv6-name"> +          <properties> +            <help>Inbound IPv6 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall ipv6-name</path> +            </completionHelp> +          </properties> +        </leafNode> +      </children> +    </node> +    <node name="out"> +      <properties> +        <help>forwarded packets on outbound interface</help> +      </properties> +      <children> +        <leafNode name="name"> +          <properties> +            <help>Outbound IPv4 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall name</path> +            </completionHelp> +          </properties> +        </leafNode> +        <leafNode name="ipv6-name"> +          <properties> +            <help>Outbound IPv6 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall ipv6-name</path> +            </completionHelp> +          </properties> +        </leafNode> +      </children> +    </node> +    <node name="local"> +      <properties> +        <help>packets destined for this router</help> +      </properties> +      <children> +        <leafNode name="name"> +          <properties> +            <help>Local IPv4 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall name</path> +            </completionHelp> +          </properties> +        </leafNode> +        <leafNode name="ipv6-name"> +          <properties> +            <help>Local IPv6 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall ipv6-name</path> +            </completionHelp> +          </properties> +        </leafNode> +      </children> +    </node> +  </children> +</node> +<!-- include end --> diff --git a/interface-definitions/include/interface/interface-firewall-vif.xml.i b/interface-definitions/include/interface/interface-firewall-vif.xml.i new file mode 100644 index 000000000..a37ac5c4a --- /dev/null +++ b/interface-definitions/include/interface/interface-firewall-vif.xml.i @@ -0,0 +1,79 @@ +<!-- include start from interface/interface-firewall-vif.xml.i --> +<node name="firewall" owner="${vyos_conf_scripts_dir}/firewall-interface.py $VAR(../../@).$VAR(../@)"> +  <properties> +    <priority>615</priority> +    <help>Firewall options</help> +  </properties> +  <children> +    <node name="in"> +      <properties> +        <help>forwarded packets on inbound interface</help> +      </properties> +      <children> +        <leafNode name="name"> +          <properties> +            <help>Inbound IPv4 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall name</path> +            </completionHelp> +          </properties> +        </leafNode> +        <leafNode name="ipv6-name"> +          <properties> +            <help>Inbound IPv6 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall ipv6-name</path> +            </completionHelp> +          </properties> +        </leafNode> +      </children> +    </node> +    <node name="out"> +      <properties> +        <help>forwarded packets on outbound interface</help> +      </properties> +      <children> +        <leafNode name="name"> +          <properties> +            <help>Outbound IPv4 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall name</path> +            </completionHelp> +          </properties> +        </leafNode> +        <leafNode name="ipv6-name"> +          <properties> +            <help>Outbound IPv6 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall ipv6-name</path> +            </completionHelp> +          </properties> +        </leafNode> +      </children> +    </node> +    <node name="local"> +      <properties> +        <help>packets destined for this router</help> +      </properties> +      <children> +        <leafNode name="name"> +          <properties> +            <help>Local IPv4 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall name</path> +            </completionHelp> +          </properties> +        </leafNode> +        <leafNode name="ipv6-name"> +          <properties> +            <help>Local IPv6 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall ipv6-name</path> +            </completionHelp> +          </properties> +        </leafNode> +      </children> +    </node> +  </children> +</node> +<!-- include end --> diff --git a/interface-definitions/include/interface/interface-firewall.xml.i b/interface-definitions/include/interface/interface-firewall.xml.i new file mode 100644 index 000000000..b3f20c3bf --- /dev/null +++ b/interface-definitions/include/interface/interface-firewall.xml.i @@ -0,0 +1,79 @@ +<!-- include start from interface/interface-firewall.xml.i --> +<node name="firewall" owner="${vyos_conf_scripts_dir}/firewall-interface.py $VAR(../@)"> +  <properties> +    <priority>615</priority> +    <help>Firewall options</help> +  </properties> +  <children> +    <node name="in"> +      <properties> +        <help>forwarded packets on inbound interface</help> +      </properties> +      <children> +        <leafNode name="name"> +          <properties> +            <help>Inbound IPv4 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall name</path> +            </completionHelp> +          </properties> +        </leafNode> +        <leafNode name="ipv6-name"> +          <properties> +            <help>Inbound IPv6 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall ipv6-name</path> +            </completionHelp> +          </properties> +        </leafNode> +      </children> +    </node> +    <node name="out"> +      <properties> +        <help>forwarded packets on outbound interface</help> +      </properties> +      <children> +        <leafNode name="name"> +          <properties> +            <help>Outbound IPv4 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall name</path> +            </completionHelp> +          </properties> +        </leafNode> +        <leafNode name="ipv6-name"> +          <properties> +            <help>Outbound IPv6 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall ipv6-name</path> +            </completionHelp> +          </properties> +        </leafNode> +      </children> +    </node> +    <node name="local"> +      <properties> +        <help>packets destined for this router</help> +      </properties> +      <children> +        <leafNode name="name"> +          <properties> +            <help>Local IPv4 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall name</path> +            </completionHelp> +          </properties> +        </leafNode> +        <leafNode name="ipv6-name"> +          <properties> +            <help>Local IPv6 firewall ruleset name for interface</help> +            <completionHelp> +              <path>firewall ipv6-name</path> +            </completionHelp> +          </properties> +        </leafNode> +      </children> +    </node> +  </children> +</node> +<!-- include end --> diff --git a/interface-definitions/include/interface/interface-policy-vif-c.xml.i b/interface-definitions/include/interface/interface-policy-vif-c.xml.i new file mode 100644 index 000000000..5dad6422b --- /dev/null +++ b/interface-definitions/include/interface/interface-policy-vif-c.xml.i @@ -0,0 +1,26 @@ +<!-- include start from interface/interface-policy-vif-c.xml.i --> +<node name="policy" owner="${vyos_conf_scripts_dir}/policy-route-interface.py $VAR(../../../@).$VAR(../../@).$VAR(../@)"> +  <properties> +    <priority>620</priority> +    <help>Policy route options</help> +  </properties> +  <children> +    <leafNode name="route"> +      <properties> +        <help>IPv4 policy route ruleset for interface</help> +        <completionHelp> +          <path>policy route</path> +        </completionHelp> +      </properties> +    </leafNode> +    <leafNode name="ipv6-route"> +      <properties> +        <help>IPv6 policy route ruleset for interface</help> +        <completionHelp> +          <path>policy ipv6-route</path> +        </completionHelp> +      </properties> +    </leafNode> +  </children> +</node> +<!-- include end --> diff --git a/interface-definitions/include/interface/interface-policy-vif.xml.i b/interface-definitions/include/interface/interface-policy-vif.xml.i new file mode 100644 index 000000000..5ee80ae13 --- /dev/null +++ b/interface-definitions/include/interface/interface-policy-vif.xml.i @@ -0,0 +1,26 @@ +<!-- include start from interface/interface-policy-vif.xml.i --> +<node name="policy" owner="${vyos_conf_scripts_dir}/policy-route-interface.py $VAR(../../@).$VAR(../@)"> +  <properties> +    <priority>620</priority> +    <help>Policy route options</help> +  </properties> +  <children> +    <leafNode name="route"> +      <properties> +        <help>IPv4 policy route ruleset for interface</help> +        <completionHelp> +          <path>policy route</path> +        </completionHelp> +      </properties> +    </leafNode> +    <leafNode name="ipv6-route"> +      <properties> +        <help>IPv6 policy route ruleset for interface</help> +        <completionHelp> +          <path>policy ipv6-route</path> +        </completionHelp> +      </properties> +    </leafNode> +  </children> +</node> +<!-- include end --> diff --git a/interface-definitions/include/interface/interface-policy.xml.i b/interface-definitions/include/interface/interface-policy.xml.i new file mode 100644 index 000000000..06f025af1 --- /dev/null +++ b/interface-definitions/include/interface/interface-policy.xml.i @@ -0,0 +1,26 @@ +<!-- include start from interface/interface-policy.xml.i --> +<node name="policy" owner="${vyos_conf_scripts_dir}/policy-route-interface.py $VAR(../@)"> +  <properties> +    <priority>620</priority> +    <help>Policy route options</help> +  </properties> +  <children> +    <leafNode name="route"> +      <properties> +        <help>IPv4 policy route ruleset for interface</help> +        <completionHelp> +          <path>policy route</path> +        </completionHelp> +      </properties> +    </leafNode> +    <leafNode name="ipv6-route"> +      <properties> +        <help>IPv6 policy route ruleset for interface</help> +        <completionHelp> +          <path>policy ipv6-route</path> +        </completionHelp> +      </properties> +    </leafNode> +  </children> +</node> +<!-- include end --> diff --git a/interface-definitions/include/interface/vif-s.xml.i b/interface-definitions/include/interface/vif-s.xml.i index e7ba6d193..f1a61ff64 100644 --- a/interface-definitions/include/interface/vif-s.xml.i +++ b/interface-definitions/include/interface/vif-s.xml.i @@ -18,6 +18,8 @@      #include <include/interface/dhcpv6-options.xml.i>      #include <include/interface/disable-link-detect.xml.i>      #include <include/interface/disable.xml.i> +    #include <include/interface/interface-firewall-vif.xml.i> +    #include <include/interface/interface-policy-vif.xml.i>      <leafNode name="protocol">        <properties>          <help>Protocol used for service VLAN (default: 802.1ad)</help> @@ -63,6 +65,8 @@          #include <include/interface/mac.xml.i>          #include <include/interface/mtu-68-16000.xml.i>          #include <include/interface/vrf.xml.i> +        #include <include/interface/interface-firewall-vif-c.xml.i> +        #include <include/interface/interface-policy-vif-c.xml.i>        </children>      </tagNode>      #include <include/interface/vrf.xml.i> diff --git a/interface-definitions/include/interface/vif.xml.i b/interface-definitions/include/interface/vif.xml.i index 5644c554f..11ba7e2f8 100644 --- a/interface-definitions/include/interface/vif.xml.i +++ b/interface-definitions/include/interface/vif.xml.i @@ -19,6 +19,8 @@      #include <include/interface/disable-link-detect.xml.i>      #include <include/interface/disable.xml.i>      #include <include/interface/vrf.xml.i> +    #include <include/interface/interface-firewall-vif.xml.i> +    #include <include/interface/interface-policy-vif.xml.i>      <leafNode name="egress-qos">        <properties>          <help>VLAN egress QoS</help> diff --git a/interface-definitions/include/policy/route-common-rule-ipv6.xml.i b/interface-definitions/include/policy/route-common-rule-ipv6.xml.i new file mode 100644 index 000000000..2d6adcd1d --- /dev/null +++ b/interface-definitions/include/policy/route-common-rule-ipv6.xml.i @@ -0,0 +1,569 @@ +<!-- include start from policy/route-common-rule.xml.i --> +#include <include/policy/route-rule-action.xml.i> +#include <include/generic-description.xml.i> +<leafNode name="disable"> +  <properties> +    <help>Option to disable firewall rule</help> +    <valueless/> +  </properties> +</leafNode> +<node name="fragment"> +  <properties> +    <help>IP fragment match</help> +  </properties> +  <children> +    <leafNode name="match-frag"> +      <properties> +        <help>Second and further fragments of fragmented packets</help> +        <valueless/> +      </properties> +    </leafNode> +    <leafNode name="match-non-frag"> +      <properties> +        <help>Head fragments or unfragmented packets</help> +        <valueless/> +      </properties> +    </leafNode> +  </children> +</node> +<node name="ipsec"> +  <properties> +    <help>Inbound IPsec packets</help> +  </properties> +  <children> +    <leafNode name="match-ipsec"> +      <properties> +        <help>Inbound IPsec packets</help> +        <valueless/> +      </properties> +    </leafNode> +    <leafNode name="match-none"> +      <properties> +        <help>Inbound non-IPsec packets</help> +        <valueless/> +      </properties> +    </leafNode> +  </children> +</node> +<node name="limit"> +  <properties> +    <help>Rate limit using a token bucket filter</help> +  </properties> +  <children> +    <leafNode name="burst"> +      <properties> +        <help>Maximum number of packets to allow in excess of rate</help> +        <valueHelp> +          <format>u32:0-4294967295</format> +          <description>Maximum number of packets to allow in excess of rate</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 0-4294967295"/> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="rate"> +      <properties> +        <help>Maximum average matching rate</help> +        <valueHelp> +          <format>u32:0-4294967295</format> +          <description>Maximum average matching rate</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 0-4294967295"/> +        </constraint> +      </properties> +    </leafNode> +  </children> +</node> +<leafNode name="log"> +  <properties> +    <help>Option to log packets matching rule</help> +    <completionHelp> +      <list>enable disable</list> +    </completionHelp> +    <valueHelp> +      <format>enable</format> +      <description>Enable log</description> +    </valueHelp> +    <valueHelp> +      <format>disable</format> +      <description>Disable log</description> +    </valueHelp> +    <constraint> +      <regex>^(enable|disable)$</regex> +    </constraint> +  </properties> +</leafNode> +<leafNode name="protocol"> +  <properties> +    <help>Protocol to match (protocol name, number, or "all")</help> +    <completionHelp> +      <script>cat /etc/protocols | sed -e '/^#.*/d' | awk '{ print $1 }'</script> +    </completionHelp> +    <valueHelp> +      <format>all</format> +      <description>All IP protocols</description> +    </valueHelp> +    <valueHelp> +      <format>tcp_udp</format> +      <description>Both TCP and UDP</description> +    </valueHelp> +    <valueHelp> +      <format>0-255</format> +      <description>IP protocol number</description> +    </valueHelp> +    <valueHelp> +      <format>!<protocol></format> +      <description>IP protocol number</description> +    </valueHelp> +    <constraint> +      <validator name="ip-protocol"/> +    </constraint> +  </properties> +  <defaultValue>all</defaultValue> +</leafNode> +<node name="recent"> +  <properties> +    <help>Parameters for matching recently seen sources</help> +  </properties> +  <children> +    <leafNode name="count"> +      <properties> +        <help>Source addresses seen more than N times</help> +        <valueHelp> +          <format>u32:1-255</format> +          <description>Source addresses seen more than N times</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 1-255"/> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="time"> +      <properties> +        <help>Source addresses seen in the last N seconds</help> +        <valueHelp> +          <format>u32:0-4294967295</format> +          <description>Source addresses seen in the last N seconds</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 0-4294967295"/> +        </constraint> +      </properties> +    </leafNode> +  </children> +</node> +<node name="set"> +  <properties> +    <help>Packet modifications</help> +  </properties> +  <children> +    <leafNode name="dscp"> +      <properties> +        <help>Packet Differentiated Services Codepoint (DSCP)</help> +        <valueHelp> +          <format>u32:0-63</format> +          <description>DSCP number</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 0-63"/> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="mark"> +      <properties> +        <help>Packet marking</help> +        <valueHelp> +          <format>u32:1-2147483647</format> +          <description>Packet marking</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 1-2147483647"/> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="table"> +      <properties> +        <help>Routing table to forward packet with</help> +        <valueHelp> +          <format>u32:1-200</format> +          <description>Table number</description> +        </valueHelp> +        <valueHelp> +          <format>main</format> +          <description>Main table</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 1-200"/> +          <regex>^(main)$</regex> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="tcp-mss"> +      <properties> +        <help>TCP Maximum Segment Size</help> +        <valueHelp> +          <format>u32:500-1460</format> +          <description>Explicitly set TCP MSS value</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 500-1460"/> +        </constraint> +      </properties> +    </leafNode> +  </children> +</node> +<node name="source"> +  <properties> +    <help>Source parameters</help> +  </properties> +  <children> +    #include <include/firewall/address-ipv6.xml.i> +    #include <include/firewall/source-destination-group.xml.i> +    <leafNode name="mac-address"> +      <properties> +        <help>Source MAC address</help> +        <valueHelp> +          <format><MAC address></format> +          <description>MAC address to match</description> +        </valueHelp> +        <valueHelp> +          <format>!<MAC address></format> +          <description>Match everything except the specified MAC address</description> +        </valueHelp> +      </properties> +    </leafNode> +    #include <include/firewall/port.xml.i> +  </children> +</node> +<node name="state"> +  <properties> +    <help>Session state</help> +  </properties> +  <children> +    <leafNode name="established"> +      <properties> +        <help>Established state</help> +        <completionHelp> +          <list>enable disable</list> +        </completionHelp> +        <valueHelp> +          <format>enable</format> +          <description>Enable</description> +        </valueHelp> +        <valueHelp> +          <format>disable</format> +          <description>Disable</description> +        </valueHelp> +        <constraint> +          <regex>^(enable|disable)$</regex> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="invalid"> +      <properties> +        <help>Invalid state</help> +        <completionHelp> +          <list>enable disable</list> +        </completionHelp> +        <valueHelp> +          <format>enable</format> +          <description>Enable</description> +        </valueHelp> +        <valueHelp> +          <format>disable</format> +          <description>Disable</description> +        </valueHelp> +        <constraint> +          <regex>^(enable|disable)$</regex> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="new"> +      <properties> +        <help>New state</help> +        <completionHelp> +          <list>enable disable</list> +        </completionHelp> +        <valueHelp> +          <format>enable</format> +          <description>Enable</description> +        </valueHelp> +        <valueHelp> +          <format>disable</format> +          <description>Disable</description> +        </valueHelp> +        <constraint> +          <regex>^(enable|disable)$</regex> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="related"> +      <properties> +        <help>Related state</help> +        <completionHelp> +          <list>enable disable</list> +        </completionHelp> +        <valueHelp> +          <format>enable</format> +          <description>Enable</description> +        </valueHelp> +        <valueHelp> +          <format>disable</format> +          <description>Disable</description> +        </valueHelp> +        <constraint> +          <regex>^(enable|disable)$</regex> +        </constraint> +      </properties> +    </leafNode> +  </children> +</node> +<node name="tcp"> +  <properties> +    <help>TCP flags to match</help> +  </properties> +  <children> +    <leafNode name="flags"> +      <properties> +        <help>TCP flags to match</help> +        <valueHelp> +          <format>txt</format> +          <description>TCP flags to match</description> +        </valueHelp> +        <valueHelp> +          <format> </format> +          <description>\n\n  Allowed values for TCP flags : SYN ACK FIN RST URG PSH ALL\n  When specifying more than one flag, flags should be comma-separated.\n For example : value of 'SYN,!ACK,!FIN,!RST' will only match packets with\n  the SYN flag set, and the ACK, FIN and RST flags unset</description> +        </valueHelp> +      </properties> +    </leafNode> +  </children> +</node> +<node name="time"> +  <properties> +    <help>Time to match rule</help> +  </properties> +  <children> +    <leafNode name="monthdays"> +      <properties> +        <help>Monthdays to match rule on</help> +      </properties> +    </leafNode> +    <leafNode name="startdate"> +      <properties> +        <help>Date to start matching rule</help> +      </properties> +    </leafNode> +    <leafNode name="starttime"> +      <properties> +        <help>Time of day to start matching rule</help> +      </properties> +    </leafNode> +    <leafNode name="stopdate"> +      <properties> +        <help>Date to stop matching rule</help> +      </properties> +    </leafNode> +    <leafNode name="stoptime"> +      <properties> +        <help>Time of day to stop matching rule</help> +      </properties> +    </leafNode> +    <leafNode name="utc"> +      <properties> +        <help>Interpret times for startdate, stopdate, starttime and stoptime to be UTC</help> +        <valueless/> +      </properties> +    </leafNode> +    <leafNode name="weekdays"> +      <properties> +        <help>Weekdays to match rule on</help> +      </properties> +    </leafNode> +  </children> +</node> +<node name="icmpv6"> +  <properties> +    <help>ICMPv6 type and code information</help> +  </properties> +  <children> +    <leafNode name="type"> +      <properties> +        <help>ICMP type-name</help> +        <completionHelp> +          <list>any echo-reply pong destination-unreachable network-unreachable host-unreachable protocol-unreachable port-unreachable fragmentation-needed source-route-failed network-unknown host-unknown network-prohibited host-prohibited TOS-network-unreachable TOS-host-unreachable communication-prohibited host-precedence-violation precedence-cutoff source-quench redirect network-redirect host-redirect TOS-network-redirect TOS host-redirect echo-request ping router-advertisement router-solicitation time-exceeded ttl-exceeded ttl-zero-during-transit ttl-zero-during-reassembly parameter-problem ip-header-bad required-option-missing timestamp-request timestamp-reply address-mask-request address-mask-reply packet-too-big</list> +        </completionHelp> +        <valueHelp> +          <format>any</format> +          <description>Any ICMP type/code</description> +        </valueHelp> +        <valueHelp> +          <format>echo-reply</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>pong</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>destination-unreachable</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>network-unreachable</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>host-unreachable</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>protocol-unreachable</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>port-unreachable</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>fragmentation-needed</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>source-route-failed</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>network-unknown</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>host-unknown</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>network-prohibited</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>host-prohibited</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>TOS-network-unreachable</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>TOS-host-unreachable</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>communication-prohibited</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>host-precedence-violation</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>precedence-cutoff</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>source-quench</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>redirect</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>network-redirect</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>host-redirect</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>TOS-network-redirect</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>TOS host-redirect</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>echo-request</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>ping</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>router-advertisement</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>router-solicitation</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>time-exceeded</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>ttl-exceeded</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>ttl-zero-during-transit</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>ttl-zero-during-reassembly</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>parameter-problem</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>ip-header-bad</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>required-option-missing</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>timestamp-request</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>timestamp-reply</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>address-mask-request</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>address-mask-reply</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <valueHelp> +          <format>packet-too-big</format> +          <description>ICMP type/code name</description> +        </valueHelp> +        <constraint> +          <regex>^(any|echo-reply|pong|destination-unreachable|network-unreachable|host-unreachable|protocol-unreachable|port-unreachable|fragmentation-needed|source-route-failed|network-unknown|host-unknown|network-prohibited|host-prohibited|TOS-network-unreachable|TOS-host-unreachable|communication-prohibited|host-precedence-violation|precedence-cutoff|source-quench|redirect|network-redirect|host-redirect|TOS-network-redirect|TOS host-redirect|echo-request|ping|router-advertisement|router-solicitation|time-exceeded|ttl-exceeded|ttl-zero-during-transit|ttl-zero-during-reassembly|parameter-problem|ip-header-bad|required-option-missing|timestamp-request|timestamp-reply|address-mask-request|address-mask-reply|packet-too-big)$</regex> +          <validator name="numeric" argument="--range 0-255"/> +        </constraint> +      </properties> +    </leafNode> +  </children> +</node> +<!-- include end --> diff --git a/interface-definitions/include/policy/route-common-rule.xml.i b/interface-definitions/include/policy/route-common-rule.xml.i new file mode 100644 index 000000000..c4deefd2a --- /dev/null +++ b/interface-definitions/include/policy/route-common-rule.xml.i @@ -0,0 +1,418 @@ +<!-- include start from policy/route-common-rule.xml.i --> +#include <include/policy/route-rule-action.xml.i> +#include <include/generic-description.xml.i> +<leafNode name="disable"> +  <properties> +    <help>Option to disable firewall rule</help> +    <valueless/> +  </properties> +</leafNode> +<node name="fragment"> +  <properties> +    <help>IP fragment match</help> +  </properties> +  <children> +    <leafNode name="match-frag"> +      <properties> +        <help>Second and further fragments of fragmented packets</help> +        <valueless/> +      </properties> +    </leafNode> +    <leafNode name="match-non-frag"> +      <properties> +        <help>Head fragments or unfragmented packets</help> +        <valueless/> +      </properties> +    </leafNode> +  </children> +</node> +<node name="ipsec"> +  <properties> +    <help>Inbound IPsec packets</help> +  </properties> +  <children> +    <leafNode name="match-ipsec"> +      <properties> +        <help>Inbound IPsec packets</help> +        <valueless/> +      </properties> +    </leafNode> +    <leafNode name="match-none"> +      <properties> +        <help>Inbound non-IPsec packets</help> +        <valueless/> +      </properties> +    </leafNode> +  </children> +</node> +<node name="limit"> +  <properties> +    <help>Rate limit using a token bucket filter</help> +  </properties> +  <children> +    <leafNode name="burst"> +      <properties> +        <help>Maximum number of packets to allow in excess of rate</help> +        <valueHelp> +          <format>u32:0-4294967295</format> +          <description>Maximum number of packets to allow in excess of rate</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 0-4294967295"/> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="rate"> +      <properties> +        <help>Maximum average matching rate</help> +        <valueHelp> +          <format>u32:0-4294967295</format> +          <description>Maximum average matching rate</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 0-4294967295"/> +        </constraint> +      </properties> +    </leafNode> +  </children> +</node> +<leafNode name="log"> +  <properties> +    <help>Option to log packets matching rule</help> +    <completionHelp> +      <list>enable disable</list> +    </completionHelp> +    <valueHelp> +      <format>enable</format> +      <description>Enable log</description> +    </valueHelp> +    <valueHelp> +      <format>disable</format> +      <description>Disable log</description> +    </valueHelp> +    <constraint> +      <regex>^(enable|disable)$</regex> +    </constraint> +  </properties> +</leafNode> +<leafNode name="protocol"> +  <properties> +    <help>Protocol to match (protocol name, number, or "all")</help> +    <completionHelp> +      <script>cat /etc/protocols | sed -e '/^#.*/d' | awk '{ print $1 }'</script> +    </completionHelp> +    <valueHelp> +      <format>all</format> +      <description>All IP protocols</description> +    </valueHelp> +    <valueHelp> +      <format>tcp_udp</format> +      <description>Both TCP and UDP</description> +    </valueHelp> +    <valueHelp> +      <format>0-255</format> +      <description>IP protocol number</description> +    </valueHelp> +    <valueHelp> +      <format>!<protocol></format> +      <description>IP protocol number</description> +    </valueHelp> +    <constraint> +      <validator name="ip-protocol"/> +    </constraint> +  </properties> +  <defaultValue>all</defaultValue> +</leafNode> +<node name="recent"> +  <properties> +    <help>Parameters for matching recently seen sources</help> +  </properties> +  <children> +    <leafNode name="count"> +      <properties> +        <help>Source addresses seen more than N times</help> +        <valueHelp> +          <format>u32:1-255</format> +          <description>Source addresses seen more than N times</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 1-255"/> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="time"> +      <properties> +        <help>Source addresses seen in the last N seconds</help> +        <valueHelp> +          <format>u32:0-4294967295</format> +          <description>Source addresses seen in the last N seconds</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 0-4294967295"/> +        </constraint> +      </properties> +    </leafNode> +  </children> +</node> +<node name="set"> +  <properties> +    <help>Packet modifications</help> +  </properties> +  <children> +    <leafNode name="dscp"> +      <properties> +        <help>Packet Differentiated Services Codepoint (DSCP)</help> +        <valueHelp> +          <format>u32:0-63</format> +          <description>DSCP number</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 0-63"/> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="mark"> +      <properties> +        <help>Packet marking</help> +        <valueHelp> +          <format>u32:1-2147483647</format> +          <description>Packet marking</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 1-2147483647"/> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="table"> +      <properties> +        <help>Routing table to forward packet with</help> +        <valueHelp> +          <format>u32:1-200</format> +          <description>Table number</description> +        </valueHelp> +        <valueHelp> +          <format>main</format> +          <description>Main table</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 1-200"/> +          <regex>^(main)$</regex> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="tcp-mss"> +      <properties> +        <help>TCP Maximum Segment Size</help> +        <valueHelp> +          <format>u32:500-1460</format> +          <description>Explicitly set TCP MSS value</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 500-1460"/> +        </constraint> +      </properties> +    </leafNode> +  </children> +</node> +<node name="source"> +  <properties> +    <help>Source parameters</help> +  </properties> +  <children> +    #include <include/firewall/address.xml.i> +    #include <include/firewall/source-destination-group.xml.i> +    <leafNode name="mac-address"> +      <properties> +        <help>Source MAC address</help> +        <valueHelp> +          <format><MAC address></format> +          <description>MAC address to match</description> +        </valueHelp> +        <valueHelp> +          <format>!<MAC address></format> +          <description>Match everything except the specified MAC address</description> +        </valueHelp> +      </properties> +    </leafNode> +    #include <include/firewall/port.xml.i> +  </children> +</node> +<node name="state"> +  <properties> +    <help>Session state</help> +  </properties> +  <children> +    <leafNode name="established"> +      <properties> +        <help>Established state</help> +        <completionHelp> +          <list>enable disable</list> +        </completionHelp> +        <valueHelp> +          <format>enable</format> +          <description>Enable</description> +        </valueHelp> +        <valueHelp> +          <format>disable</format> +          <description>Disable</description> +        </valueHelp> +        <constraint> +          <regex>^(enable|disable)$</regex> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="invalid"> +      <properties> +        <help>Invalid state</help> +        <completionHelp> +          <list>enable disable</list> +        </completionHelp> +        <valueHelp> +          <format>enable</format> +          <description>Enable</description> +        </valueHelp> +        <valueHelp> +          <format>disable</format> +          <description>Disable</description> +        </valueHelp> +        <constraint> +          <regex>^(enable|disable)$</regex> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="new"> +      <properties> +        <help>New state</help> +        <completionHelp> +          <list>enable disable</list> +        </completionHelp> +        <valueHelp> +          <format>enable</format> +          <description>Enable</description> +        </valueHelp> +        <valueHelp> +          <format>disable</format> +          <description>Disable</description> +        </valueHelp> +        <constraint> +          <regex>^(enable|disable)$</regex> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="related"> +      <properties> +        <help>Related state</help> +        <completionHelp> +          <list>enable disable</list> +        </completionHelp> +        <valueHelp> +          <format>enable</format> +          <description>Enable</description> +        </valueHelp> +        <valueHelp> +          <format>disable</format> +          <description>Disable</description> +        </valueHelp> +        <constraint> +          <regex>^(enable|disable)$</regex> +        </constraint> +      </properties> +    </leafNode> +  </children> +</node> +<node name="tcp"> +  <properties> +    <help>TCP flags to match</help> +  </properties> +  <children> +    <leafNode name="flags"> +      <properties> +        <help>TCP flags to match</help> +        <valueHelp> +          <format>txt</format> +          <description>TCP flags to match</description> +        </valueHelp> +        <valueHelp> +          <format> </format> +          <description>\n\n  Allowed values for TCP flags : SYN ACK FIN RST URG PSH ALL\n  When specifying more than one flag, flags should be comma-separated.\n For example : value of 'SYN,!ACK,!FIN,!RST' will only match packets with\n  the SYN flag set, and the ACK, FIN and RST flags unset</description> +        </valueHelp> +      </properties> +    </leafNode> +  </children> +</node> +<node name="time"> +  <properties> +    <help>Time to match rule</help> +  </properties> +  <children> +    <leafNode name="monthdays"> +      <properties> +        <help>Monthdays to match rule on</help> +      </properties> +    </leafNode> +    <leafNode name="startdate"> +      <properties> +        <help>Date to start matching rule</help> +      </properties> +    </leafNode> +    <leafNode name="starttime"> +      <properties> +        <help>Time of day to start matching rule</help> +      </properties> +    </leafNode> +    <leafNode name="stopdate"> +      <properties> +        <help>Date to stop matching rule</help> +      </properties> +    </leafNode> +    <leafNode name="stoptime"> +      <properties> +        <help>Time of day to stop matching rule</help> +      </properties> +    </leafNode> +    <leafNode name="utc"> +      <properties> +        <help>Interpret times for startdate, stopdate, starttime and stoptime to be UTC</help> +        <valueless/> +      </properties> +    </leafNode> +    <leafNode name="weekdays"> +      <properties> +        <help>Weekdays to match rule on</help> +      </properties> +    </leafNode> +  </children> +</node> +<node name="icmp"> +  <properties> +    <help>ICMP type and code information</help> +  </properties> +  <children> +    <leafNode name="code"> +      <properties> +        <help>ICMP code (0-255)</help> +        <valueHelp> +          <format>u32:0-255</format> +          <description>ICMP code (0-255)</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 0-255"/> +        </constraint> +      </properties> +    </leafNode> +    <leafNode name="type"> +      <properties> +        <help>ICMP type (0-255)</help> +        <valueHelp> +          <format>u32:0-255</format> +          <description>ICMP type (0-255)</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 0-255"/> +        </constraint> +      </properties> +    </leafNode> +    #include <include/firewall/icmp-type-name.xml.i> +  </children> +</node> +<!-- include end --> diff --git a/interface-definitions/include/policy/route-rule-action.xml.i b/interface-definitions/include/policy/route-rule-action.xml.i new file mode 100644 index 000000000..9c880579d --- /dev/null +++ b/interface-definitions/include/policy/route-rule-action.xml.i @@ -0,0 +1,17 @@ +<!-- include start from policy/route-rule-action.xml.i --> +<leafNode name="action"> +  <properties> +    <help>Rule action [REQUIRED]</help> +    <completionHelp> +      <list>drop</list> +    </completionHelp> +    <valueHelp> +      <format>drop</format> +      <description>Drop matching entries</description> +    </valueHelp> +    <constraint> +      <regex>^(drop)$</regex> +    </constraint> +  </properties> +</leafNode> +<!-- include end --> diff --git a/interface-definitions/interfaces-bonding.xml.in b/interface-definitions/interfaces-bonding.xml.in index 17879cf1e..723041ca5 100644 --- a/interface-definitions/interfaces-bonding.xml.in +++ b/interface-definitions/interfaces-bonding.xml.in @@ -56,6 +56,8 @@            #include <include/interface/disable.xml.i>            #include <include/interface/vrf.xml.i>            #include <include/interface/mirror.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>            <leafNode name="hash-policy">              <properties>                <help>Bonding transmit hash policy</help> diff --git a/interface-definitions/interfaces-bridge.xml.in b/interface-definitions/interfaces-bridge.xml.in index 144f43f32..0856615be 100644 --- a/interface-definitions/interfaces-bridge.xml.in +++ b/interface-definitions/interfaces-bridge.xml.in @@ -41,6 +41,8 @@            #include <include/interface/disable.xml.i>            #include <include/interface/vrf.xml.i>            #include <include/interface/mtu-68-16000.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>            <leafNode name="forwarding-delay">              <properties>                <help>Forwarding delay</help> diff --git a/interface-definitions/interfaces-dummy.xml.in b/interface-definitions/interfaces-dummy.xml.in index 4d4c44160..3bca8b950 100644 --- a/interface-definitions/interfaces-dummy.xml.in +++ b/interface-definitions/interfaces-dummy.xml.in @@ -19,6 +19,8 @@            #include <include/interface/address-ipv4-ipv6.xml.i>            #include <include/interface/description.xml.i>            #include <include/interface/disable.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>            <node name="ip">              <properties>                <help>IPv4 routing parameters</help> diff --git a/interface-definitions/interfaces-ethernet.xml.in b/interface-definitions/interfaces-ethernet.xml.in index ceeda12a0..9e113cb71 100644 --- a/interface-definitions/interfaces-ethernet.xml.in +++ b/interface-definitions/interfaces-ethernet.xml.in @@ -31,6 +31,8 @@            </leafNode>            #include <include/interface/disable-link-detect.xml.i>            #include <include/interface/disable.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>            <leafNode name="duplex">              <properties>                <help>Duplex mode</help> diff --git a/interface-definitions/interfaces-geneve.xml.in b/interface-definitions/interfaces-geneve.xml.in index 2ca7dd9f6..dd4d324d4 100644 --- a/interface-definitions/interfaces-geneve.xml.in +++ b/interface-definitions/interfaces-geneve.xml.in @@ -23,6 +23,8 @@            #include <include/interface/ipv6-options.xml.i>            #include <include/interface/mac.xml.i>            #include <include/interface/mtu-1450-16000.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>            <node name="parameters">              <properties>                <help>GENEVE tunnel parameters</help> diff --git a/interface-definitions/interfaces-l2tpv3.xml.in b/interface-definitions/interfaces-l2tpv3.xml.in index 9364c85cd..85d4ab992 100644 --- a/interface-definitions/interfaces-l2tpv3.xml.in +++ b/interface-definitions/interfaces-l2tpv3.xml.in @@ -32,6 +32,8 @@              <defaultValue>5000</defaultValue>            </leafNode>            #include <include/interface/disable.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>            <leafNode name="encapsulation">              <properties>                <help>Encapsulation type (default: UDP)</help> diff --git a/interface-definitions/interfaces-macsec.xml.in b/interface-definitions/interfaces-macsec.xml.in index 4a566ef8b..d69a093af 100644 --- a/interface-definitions/interfaces-macsec.xml.in +++ b/interface-definitions/interfaces-macsec.xml.in @@ -19,6 +19,8 @@            #include <include/interface/address-ipv4-ipv6.xml.i>            #include <include/interface/ipv4-options.xml.i>            #include <include/interface/ipv6-options.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>            <node name="security">              <properties>                <help>Security/Encryption Settings</help> diff --git a/interface-definitions/interfaces-openvpn.xml.in b/interface-definitions/interfaces-openvpn.xml.in index 6b4440688..16d91145f 100644 --- a/interface-definitions/interfaces-openvpn.xml.in +++ b/interface-definitions/interfaces-openvpn.xml.in @@ -34,6 +34,8 @@              </children>            </node>            #include <include/interface/description.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>            <leafNode name="device-type">              <properties>                <help>OpenVPN interface device-type (default: tun)</help> diff --git a/interface-definitions/interfaces-pppoe.xml.in b/interface-definitions/interfaces-pppoe.xml.in index 57bb01258..80a890940 100644 --- a/interface-definitions/interfaces-pppoe.xml.in +++ b/interface-definitions/interfaces-pppoe.xml.in @@ -19,6 +19,8 @@            #include <include/pppoe-access-concentrator.xml.i>            #include <include/interface/authentication.xml.i>            #include <include/interface/dial-on-demand.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>            <leafNode name="default-route">              <properties>                <help>Default route insertion behaviour (default: auto)</help> diff --git a/interface-definitions/interfaces-pseudo-ethernet.xml.in b/interface-definitions/interfaces-pseudo-ethernet.xml.in index 366892032..bf7055f8d 100644 --- a/interface-definitions/interfaces-pseudo-ethernet.xml.in +++ b/interface-definitions/interfaces-pseudo-ethernet.xml.in @@ -27,6 +27,8 @@            #include <include/interface/ipv6-options.xml.i>            #include <include/source-interface-ethernet.xml.i>            #include <include/interface/mac.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>            <leafNode name="mode">              <properties>                <help>Receive mode (default: private)</help> diff --git a/interface-definitions/interfaces-tunnel.xml.in b/interface-definitions/interfaces-tunnel.xml.in index 203685790..fd69fd177 100644 --- a/interface-definitions/interfaces-tunnel.xml.in +++ b/interface-definitions/interfaces-tunnel.xml.in @@ -30,6 +30,8 @@            #include <include/source-address-ipv4-ipv6.xml.i>            #include <include/interface/tunnel-remote.xml.i>            #include <include/source-interface.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>            <leafNode name="6rd-prefix">              <properties>                <help>6rd network prefix</help> diff --git a/interface-definitions/interfaces-vti.xml.in b/interface-definitions/interfaces-vti.xml.in index b12434ae7..f03c7476d 100644 --- a/interface-definitions/interfaces-vti.xml.in +++ b/interface-definitions/interfaces-vti.xml.in @@ -35,6 +35,8 @@            #include <include/interface/ipv6-options.xml.i>            #include <include/interface/mtu-68-16000.xml.i>            #include <include/interface/vrf.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>          </children>        </tagNode>      </children> diff --git a/interface-definitions/interfaces-vxlan.xml.in b/interface-definitions/interfaces-vxlan.xml.in index 6c53f8c44..4c3c3ac71 100644 --- a/interface-definitions/interfaces-vxlan.xml.in +++ b/interface-definitions/interfaces-vxlan.xml.in @@ -53,6 +53,8 @@            #include <include/interface/ipv6-options.xml.i>            #include <include/interface/mac.xml.i>            #include <include/interface/mtu-1200-16000.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>            <leafNode name="mtu">              <defaultValue>1450</defaultValue>            </leafNode> diff --git a/interface-definitions/interfaces-wireguard.xml.in b/interface-definitions/interfaces-wireguard.xml.in index 403282e5c..7a7c9c1d9 100644 --- a/interface-definitions/interfaces-wireguard.xml.in +++ b/interface-definitions/interfaces-wireguard.xml.in @@ -22,6 +22,8 @@            #include <include/interface/vrf.xml.i>            #include <include/port-number.xml.i>            #include <include/interface/mtu-68-16000.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>            <leafNode name="mtu">              <defaultValue>1420</defaultValue>            </leafNode> diff --git a/interface-definitions/interfaces-wireless.xml.in b/interface-definitions/interfaces-wireless.xml.in index 048c7b475..a2d1439a3 100644 --- a/interface-definitions/interfaces-wireless.xml.in +++ b/interface-definitions/interfaces-wireless.xml.in @@ -17,6 +17,8 @@          </properties>          <children>            #include <include/interface/address-ipv4-ipv6-dhcp.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>            <node name="capabilities">              <properties>                <help>HT and VHT capabilities for your card</help> diff --git a/interface-definitions/interfaces-wwan.xml.in b/interface-definitions/interfaces-wwan.xml.in index 6b6fa1a66..03554feed 100644 --- a/interface-definitions/interfaces-wwan.xml.in +++ b/interface-definitions/interfaces-wwan.xml.in @@ -39,6 +39,8 @@            #include <include/interface/ipv4-options.xml.i>            #include <include/interface/ipv6-options.xml.i>            #include <include/interface/dial-on-demand.xml.i> +          #include <include/interface/interface-firewall.xml.i> +          #include <include/interface/interface-policy.xml.i>          </children>        </tagNode>      </children> diff --git a/interface-definitions/policy-route.xml.in b/interface-definitions/policy-route.xml.in new file mode 100644 index 000000000..ed726d1e4 --- /dev/null +++ b/interface-definitions/policy-route.xml.in @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<interfaceDefinition> +  <node name="policy"> +    <children> +      <tagNode name="ipv6-route" owner="${vyos_conf_scripts_dir}/policy-route.py"> +        <properties> +          <help>IPv6 policy route rule set name</help> +          <priority>201</priority> +        </properties> +        <children> +          #include <include/generic-description.xml.i> +          #include <include/firewall/name-default-log.xml.i> +          <tagNode name="rule"> +            <properties> +              <help>Rule number (1-9999)</help> +            </properties> +            <children> +              <node name="destination"> +                <properties> +                  <help>Destination parameters</help> +                </properties> +                <children> +                  #include <include/firewall/address-ipv6.xml.i> +                  #include <include/firewall/source-destination-group-ipv6.xml.i> +                  #include <include/firewall/port.xml.i> +                </children> +              </node> +              <node name="source"> +                <properties> +                  <help>Source parameters</help> +                </properties> +                <children> +                  #include <include/firewall/address-ipv6.xml.i> +                  #include <include/firewall/source-destination-group-ipv6.xml.i> +                  #include <include/firewall/port.xml.i> +                </children> +              </node> +              #include <include/policy/route-common-rule-ipv6.xml.i> +            </children> +          </tagNode> +        </children> +      </tagNode> +      <tagNode name="route" owner="${vyos_conf_scripts_dir}/policy-route.py"> +        <properties> +          <help>Policy route rule set name</help> +          <priority>201</priority> +        </properties> +        <children> +          #include <include/generic-description.xml.i> +          #include <include/firewall/name-default-log.xml.i> +          <tagNode name="rule"> +            <properties> +              <help>Rule number (1-9999)</help> +            </properties> +            <children> +              <node name="destination"> +                <properties> +                  <help>Destination parameters</help> +                </properties> +                <children> +                  #include <include/firewall/address.xml.i> +                  #include <include/firewall/source-destination-group.xml.i> +                  #include <include/firewall/port.xml.i> +                </children> +              </node> +              <node name="source"> +                <properties> +                  <help>Source parameters</help> +                </properties> +                <children> +                  #include <include/firewall/address.xml.i> +                  #include <include/firewall/source-destination-group.xml.i> +                  #include <include/firewall/port.xml.i> +                </children> +              </node> +              #include <include/policy/route-common-rule.xml.i> +            </children> +          </tagNode> +        </children> +      </tagNode> +    </children> +  </node> +</interfaceDefinition> diff --git a/interface-definitions/zone-policy.xml.in b/interface-definitions/zone-policy.xml.in new file mode 100644 index 000000000..dd64c7c16 --- /dev/null +++ b/interface-definitions/zone-policy.xml.in @@ -0,0 +1,143 @@ +<?xml version="1.0"?> +<interfaceDefinition> +  <node name="zone-policy" owner="${vyos_conf_scripts_dir}/zone_policy.py"> +    <properties> +      <help>Configure zone-policy</help> +      <priority>250</priority> +    </properties> +    <children> +      <tagNode name="zone"> +        <properties> +          <help>Zone name</help> +          <valueHelp> +            <format>txt</format> +            <description>Zone name</description> +          </valueHelp> +        </properties> +        <children> +          #include <include/generic-description.xml.i> +          <leafNode name="default-action"> +            <properties> +              <help>Default-action for traffic coming into this zone</help> +              <completionHelp> +                <list>drop reject</list> +              </completionHelp> +              <valueHelp> +                <format>drop</format> +                <description>Drop silently (default)</description> +              </valueHelp> +              <valueHelp> +                <format>reject</format> +                <description>Drop and notify source</description> +              </valueHelp> +              <constraint> +                <regex>^(drop|reject)$</regex> +              </constraint> +            </properties> +          </leafNode> +          <tagNode name="from"> +            <properties> +              <help>Zone from which to filter traffic</help> +              <completionHelp> +                <path>zone-policy zone</path> +              </completionHelp> +            </properties> +            <children> +              <node name="firewall"> +                <properties> +                  <help>Firewall options</help> +                </properties> +                <children> +                  <leafNode name="ipv6-name"> +                    <properties> +                      <help>IPv6 firewall ruleset</help> +                      <completionHelp> +                        <path>firewall ipv6-name</path> +                      </completionHelp> +                    </properties> +                  </leafNode> +                  <leafNode name="name"> +                    <properties> +                      <help>IPv4 firewall ruleset</help> +                      <completionHelp> +                        <path>firewall name</path> +                      </completionHelp> +                    </properties> +                  </leafNode> +                </children> +              </node> +            </children> +          </tagNode> +          <leafNode name="interface"> +            <properties> +              <help>Interface associated with zone</help> +              <valueHelp> +                <format>txt</format> +                <description>Interface associated with zone</description> +              </valueHelp> +              <completionHelp> +                <script>${vyos_completion_dir}/list_interfaces.py</script> +              </completionHelp> +              <multi/> +            </properties> +          </leafNode> +          <node name="intra-zone-filtering"> +            <properties> +              <help>Intra-zone filtering</help> +            </properties> +            <children> +              <leafNode name="action"> +                <properties> +                  <help>Action for intra-zone traffic</help> +                  <completionHelp> +                    <list>accept drop</list> +                  </completionHelp> +                  <valueHelp> +                    <format>accept</format> +                    <description>Accept traffic (default)</description> +                  </valueHelp> +                  <valueHelp> +                    <format>drop</format> +                    <description>Drop silently</description> +                  </valueHelp> +                  <constraint> +                    <regex>^(accept|drop)$</regex> +                  </constraint> +                </properties> +              </leafNode> +              <node name="firewall"> +                <properties> +                  <help>Use the specified firewall chain</help> +                </properties> +                <children> +                  <leafNode name="ipv6-name"> +                    <properties> +                      <help>IPv6 firewall ruleset</help> +                      <completionHelp> +                        <path>firewall ipv6-name</path> +                      </completionHelp> +                    </properties> +                  </leafNode> +                  <leafNode name="name"> +                    <properties> +                      <help>IPv4 firewall ruleset</help> +                      <completionHelp> +                        <path>firewall name</path> +                      </completionHelp> +                    </properties> +                  </leafNode> +                </children> +              </node> +            </children> +          </node> +          <leafNode name="local-zone"> +            <properties> +              <help>Zone to be local-zone</help> +              <valueless/> +            </properties> +          </leafNode>  +        </children> +      </tagNode> +    </children> +  </node> +</interfaceDefinition>  | 
