mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
(tinc) add some options for https://github.com/opnsense/plugins/issues/61
This commit is contained in:
parent
3941032554
commit
9b540745d7
5 changed files with 60 additions and 8 deletions
|
|
@ -23,6 +23,12 @@
|
|||
<type>text</type>
|
||||
<help>This machines external address to use</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>host.extport</id>
|
||||
<label>Ext. Port</label>
|
||||
<type>text</type>
|
||||
<help>This machines external port to use</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>host.subnet</id>
|
||||
<label>Subnet</label>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,14 @@
|
|||
<type>text</type>
|
||||
<help>This machines internal address to use and network mask for the whole network</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>network.pingtimeout</id>
|
||||
<label>PingTimeout</label>
|
||||
<type>text</type>
|
||||
<help>The number of seconds to wait for a response to pings or to allow meta connections to block.
|
||||
If the other end doesn't respond within this time, the connection is terminated, and the others will be notified of this.
|
||||
</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>network.cipher</id>
|
||||
<label>Cipher</label>
|
||||
|
|
@ -49,6 +57,18 @@
|
|||
<type>text</type>
|
||||
<help>This machines external address to use</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>network.extport</id>
|
||||
<label>Ext. Port</label>
|
||||
<type>text</type>
|
||||
<help>This machines external port to use</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>network.subnet</id>
|
||||
<label>Subnet</label>
|
||||
<type>text</type>
|
||||
<help>This machines part of the network</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>network.subnet</id>
|
||||
<label>Subnet</label>
|
||||
|
|
|
|||
|
|
@ -21,11 +21,17 @@
|
|||
<mask>/^([0-9a-zA-Z\_]){1,1024}$/u</mask>
|
||||
<ValidationMessage>Please specify a valid hostname.</ValidationMessage>
|
||||
</hostname>
|
||||
<extaddress type="NetworkField">
|
||||
<extaddress type="TextField">
|
||||
<Required>Y</Required>
|
||||
<WildcardEnabled>N</WildcardEnabled>
|
||||
<FieldSeparator>,</FieldSeparator>
|
||||
<mask>/^([0-9a-zA-Z\.,_\-:]){0,1024}$/u</mask>
|
||||
</extaddress>
|
||||
<extport type="IntegerField">
|
||||
<Required>Y</Required>
|
||||
<default>655</default>
|
||||
<MinimumValue>1</MinimumValue>
|
||||
<MaximumValue>65535</MaximumValue>
|
||||
<ValidationMessage>Port number must be between 1...65535</ValidationMessage>
|
||||
</extport>
|
||||
<intaddress type="NetworkField">
|
||||
<Required>Y</Required>
|
||||
<WildcardEnabled>N</WildcardEnabled>
|
||||
|
|
@ -36,6 +42,13 @@
|
|||
<NetMaskRequired>Y</NetMaskRequired>
|
||||
<FieldSeparator>,</FieldSeparator>
|
||||
</subnet>
|
||||
<pingtimeout type="IntegerField">
|
||||
<Required>Y</Required>
|
||||
<default>5</default>
|
||||
<MinimumValue>1</MinimumValue>
|
||||
<MaximumValue>65535</MaximumValue>
|
||||
<ValidationMessage>Ping timeout must be between 1...65535</ValidationMessage>
|
||||
</pingtimeout>
|
||||
<privkey type="TextField">
|
||||
<Required>Y</Required>
|
||||
</privkey>
|
||||
|
|
@ -86,10 +99,16 @@
|
|||
<mask>/^([0-9a-zA-Z\_]){1,1024}$/u</mask>
|
||||
<ValidationMessage>Please specify a valid hostname.</ValidationMessage>
|
||||
</hostname>
|
||||
<extaddress type="NetworkField">
|
||||
<extport type="IntegerField">
|
||||
<Required>Y</Required>
|
||||
<WildcardEnabled>N</WildcardEnabled>
|
||||
<FieldSeparator>,</FieldSeparator>
|
||||
<default>655</default>
|
||||
<MinimumValue>1</MinimumValue>
|
||||
<MaximumValue>65535</MaximumValue>
|
||||
<ValidationMessage>Port number must be between 1...65535</ValidationMessage>
|
||||
</extport>
|
||||
<extaddress type="TextField">
|
||||
<Required>Y</Required>
|
||||
<mask>/^([0-9a-zA-Z\.,_\-:]){0,1024}$/u</mask>
|
||||
</extaddress>
|
||||
<subnet type="NetworkField">
|
||||
<Required>Y</Required>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class NetwConfObject(object):
|
|||
self._payload['hostname'] = None
|
||||
self._payload['network'] = None
|
||||
self._payload['address'] = None
|
||||
self._payload['port'] = None
|
||||
|
||||
def is_valid(self):
|
||||
for key in self._payload:
|
||||
|
|
@ -85,6 +86,8 @@ class Network(NetwConfObject):
|
|||
def config_text(self):
|
||||
result = list()
|
||||
result.append('AddressFamily=any')
|
||||
result.append('Port=%(port)s' % self._payload)
|
||||
result.append('PingTimeout=%(pingtimeout)s' % self._payload)
|
||||
for host in self._hosts:
|
||||
if host.connect_to_this_host():
|
||||
result.append('ConnectTo = %s' % (host.get_hostname(),))
|
||||
|
|
@ -122,7 +125,7 @@ class Host(NetwConfObject):
|
|||
|
||||
def config_text(self):
|
||||
result = list()
|
||||
result.append('Address=%(address)s'%self._payload)
|
||||
result.append('Address=%(address)s %(port)s'%self._payload)
|
||||
result.append('Subnet=%(subnet)s'%self._payload)
|
||||
result.append('Cipher=%(cipher)s'%self._payload)
|
||||
result.append('Digest=sha256')
|
||||
|
|
|
|||
|
|
@ -9,12 +9,15 @@
|
|||
<intaddress>{{network.intaddress}}</intaddress>
|
||||
<privkey><![CDATA[{{network.privkey}}]]></privkey>
|
||||
<address>{{network.intaddress}}</address>
|
||||
<port>{{network.extport}}</port>
|
||||
<debuglevel>{{network.debuglevel}}</debuglevel>
|
||||
<pingtimeout>{{network.pingtimeout}}</pingtimeout>
|
||||
<hosts>
|
||||
<host>
|
||||
<hostname>{{network.hostname}}</hostname>
|
||||
<network>{{network.name}}</network>
|
||||
<address>{{network.extaddress}}</address>
|
||||
<port>{{network.extport}}</port>
|
||||
<subnet>{{network.subnet}}</subnet>
|
||||
<pubkey><![CDATA[{{network.pubkey}}]]></pubkey>
|
||||
<cipher>{{network.cipher}}</cipher>
|
||||
|
|
@ -26,6 +29,7 @@
|
|||
<hostname>{{host.hostname}}</hostname>
|
||||
<network>{{network.name}}</network>
|
||||
<address>{{host.extaddress}}</address>
|
||||
<port>{{network.extport}}</port>
|
||||
<subnet>{{host.subnet}}</subnet>
|
||||
<pubkey><![CDATA[{{host.pubkey}}]]></pubkey>
|
||||
<cipher>{{host.cipher}}</cipher>
|
||||
|
|
@ -38,4 +42,4 @@
|
|||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</networks>
|
||||
</networks>
|
||||
|
|
|
|||
Loading…
Reference in a new issue