Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

UPnP: T4211: T4620 Fix upnp template #1476

Merged
merged 2 commits into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 9 additions & 6 deletions data/templates/firewall/upnpd.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ min_lifetime={{ pcp_lifetime.min }}

{% if friendly_name is vyos_defined %}
# Name of this service, default is "`uname -s` router"
friendly_name= {{ friendly_name }}
friendly_name={{ friendly_name }}
{% endif %}

# Manufacturer name, default is "`uname -s`"
Expand Down Expand Up @@ -117,7 +117,10 @@ clean_ruleset_threshold=10
clean_ruleset_interval=600

# Anchor name in pf (default is miniupnpd)
anchor=VyOS
# Something wrong with this option "anchor", comment it out
# vyos@r14# miniupnpd -vv -f /run/upnp/miniupnp.conf
# invalid option in file /run/upnp/miniupnp.conf line 74 : anchor=VyOS
#anchor=VyOS

uuid={{ uuid }}

Expand All @@ -129,7 +132,7 @@ lease_file=/config/upnp.leases
#serial=12345678
#model_number=1

{% if rules is vyos_defined %}
{% if rule is vyos_defined %}
# UPnP permission rules
# (allow|deny) (external port range) IP/mask (internal port range)
# A port range is <min port>-<max port> or <port> if there is only
Expand All @@ -142,9 +145,9 @@ lease_file=/config/upnp.leases
# modify the IP ranges to match their own internal networks, and
# also consider implementing network-specific restrictions
# CAUTION: failure to enforce any rules may permit insecure requests to be made!
{% for rule, config in rules.items() %}
{% if config.disable is vyos_defined %}
{{ config.action }} {{ config.external_port_range }} {{ config.ip }} {{ config.internal_port_range }}
{% for rule, config in rule.items() %}
{% if config.disable is not vyos_defined %}
{{ config.action }} {{ config.external_port_range }} {{ config.ip }}{{ '/32' if '/' not in config.ip else '' }} {{ config.internal_port_range }}
{% endif %}
{% endfor %}
{% endif %}
Expand Down
7 changes: 6 additions & 1 deletion interface-definitions/service-upnp.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,15 @@
<help>The IP to which this rule applies (REQUIRE)</help>
<valueHelp>
<format>ipv4</format>
<description>The IPv4 address to which this rule applies</description>
</valueHelp>
<valueHelp>
<format>ipv4net</format>
<description>The IPv4 to which this rule applies</description>
</valueHelp>
<constraint>
<validator name="ipv4-address" />
<validator name="ipv4-address"/>
<validator name="ipv4-host"/>
</constraint>
</properties>
</leafNode>
Expand Down