i2p: Add HTTP(S) and IRC ports to firewall

Enable or disable the ports with the firewalld.

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
LoveIsGrief 2019-04-10 17:54:54 +02:00 committed by Sunil Mohan Adapa
parent 5c26c28f96
commit f40ecaa155
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
4 changed files with 36 additions and 12 deletions

View File

@ -64,11 +64,15 @@ additional_favorites = [
('YaCy Seeker', 'http://seeker.i2p'),
]
tunnels_to_manage = [
'I2P HTTP Proxy',
'I2P HTTPS Proxy',
'Irc2P'
]
tunnels_to_manage = {
'I2P HTTP Proxy': 'i2p_socks_http-freedombox',
'I2P HTTPS Proxy': 'i2p_socks_https-freedombox',
'Irc2P': 'i2p_irc-freedombox'
}
service_ports = [
'http', 'https'
] + list(tunnels_to_manage.values())
def init():
@ -80,9 +84,8 @@ def init():
global service
setup_helper = globals()['setup_helper']
if setup_helper.get_state() != 'needs-setup':
service = service_module.Service(managed_services[0], name, ports=[
'http', 'https'
], is_external=True, is_enabled=is_enabled, enable=enable,
service = service_module.Service(managed_services[0], name, ports=service_ports,
is_external=True, is_enabled=is_enabled, enable=enable,
disable=disable,
is_running=is_running)
@ -105,19 +108,19 @@ def setup(helper, old_version=None):
])
# Tunnels to all interfaces
for tunnel in tunnels_to_manage:
for tunnel in tunnels_to_manage.keys():
helper.call('post', actions.superuser_run, 'i2p', [
'set-tunnel-property',
'--name', tunnel,
'--property', 'interface',
'--value', '0.0.0.0'
])
helper.call('post', disable)
helper.call('post', enable)
global service
if service is None:
service = service_module.Service(managed_services[0], name, ports=[
'http', 'https'
], is_external=True, is_enabled=is_enabled, enable=enable,
service = service_module.Service(managed_services[0], name, ports=service_ports,
is_external=True, is_enabled=is_enabled, enable=enable,
disable=disable,
is_running=is_running)

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>I2P IRC</short>
<description>An entry into an IRC proxy server on I2P</description>
<port protocol="tcp" port="6668"/>
<port protocol="udp" port="6668"/>
</service>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>I2P SOCKS5 HTTP Proxy</short>
<description>A SOCKS5 HTTP proxy into the I2P network to browse eepsites.</description>
<port protocol="tcp" port="4444"/>
<port protocol="udp" port="4444"/>
</service>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>I2P SOCKS5 HTTPS Proxy</short>
<description>A SOCKS5 HTTPS proxy into the I2P network to browse eepsites.</description>
<port protocol="tcp" port="4445"/>
<port protocol="udp" port="4445"/>
</service>