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

entferne Kompression für VPN Tunnel #12

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,6 @@
SERVER_VERSION = "{{ openvpn_server_version.stdout }}"


# siehe Code-Kopie in roles/gateway-server/templates/openvpn/opennet_ugw/connect_script.py
def get_compression_config_lines():
# parse die ersten beiden Versions-Zahlen
client_version = os.getenv("IV_VER", "2.3")
# ermittle die passende Kombination von Server- und Client-Kompression
if Version(SERVER_VERSION) < Version("2.4"):
# older server version supporting only lzo
if Version(client_version) < Version("2.4"):
compression = ("comp-lzo", "comp-lzo")
else:
compression = ("comp-lzo", "compress lzo")
else:
# modern server version supporting all compression algorithms
if os.getenv("IV_LZ4v2") == "1":
compression = ("compress lz4-v2", "compress lz4-v2")
elif os.getenv("IV_LZ4") == "1":
compression = ("compress lz4", "compress lz4")
elif Version(client_version) < Version("2.4"):
compression = ("compress lzo", "comp-lzo")
else:
compression = ("compress lzo", "compress lzo")
yield compression[0]
yield 'push "{}"'.format(compression[1])


if __name__ == "__main__":
client_cn = os.getenv('common_name')

Expand All @@ -64,6 +39,5 @@ def get_compression_config_lines():
target_file = open(target_filename, 'w')
config_items = []
config_items.append('ifconfig-push {ip} {netmask}'.format(ip=client_ip, netmask=NETMASK))
config_items.extend(get_compression_config_lines())
target_file.write(os.linesep.join(config_items))
target_file.close()
7 changes: 1 addition & 6 deletions roles/gateway-server/templates/openvpn/opennet_ugw.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ dh /etc/openvpn/dh2048.pem

# Verbindungsdetails
keepalive 10 60
# die verwendete Kompression wird spaeter im "connect"-Skript ausgehandelt
{% if ansible_distribution_major_version|int < 9 %}
comp-lzo
{% else %}
compress lzo
{% endif %}

# erlaube dem Client, seine IP zu wechseln (z.B. dynamische IP des DSL-Anschluss)
float

Expand Down
1 change: 1 addition & 0 deletions roles/gateway-server/templates/openvpn/opennet_user6.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dh /etc/openvpn/dh2048.pem

# Verbindungsdetails
keepalive 10 60

# erlaube dem Client, seine IP zu wechseln (z.B. dynamische IP des DSL-Anschluss)
float

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,6 @@
#sys.stderr = file("/tmp/vpn-connect.log", "w")


# siehe Code-Kopie in roles/gateway-server/templates/openvpn/opennet_users/connect_script.py
def get_compression_config_lines():
# parse die ersten beiden Versions-Zahlen
client_version = os.getenv("IV_VER", "2.3")
# ermittle die passende Kombination von Server- und Client-Kompression
if Version(SERVER_VERSION) < Version("2.4"):
# older server version supporting only lzo
if Version(client_version) < Version("2.4"):
compression = ("comp-lzo", "comp-lzo")
else:
compression = ("comp-lzo", "compress lzo")
else:
# modern server version supporting all compression algorithms
if os.getenv("IV_LZ4v2") == "1":
compression = ("compress lz4-v2", "compress lz4-v2")
elif os.getenv("IV_LZ4") == "1":
compression = ("compress lz4", "compress lz4")
elif Version(client_version) < Version("2.4"):
compression = ("compress lzo", "comp-lzo")
else:
compression = ("compress lzo", "compress lzo")
yield compression[0]
yield 'push "{}"'.format(compression[1])


def process_openvpn_connection_event(client_cn):
ipv4_base = None
ipv6_base = None
Expand Down Expand Up @@ -72,7 +47,6 @@ def process_openvpn_connection_event(client_cn):
# target_file.write('iroute-ipv6 2a01:a700:4629:fe02::/64')
#if client_cn == '2.50.aps.on':
# target_file.write('iroute-ipv6 2a01:a700:4629:fe03::/64')
config_items.extend(get_compression_config_lines())
target_file.write(os.linesep.join(config_items))
else:
# wir wurden als "client-disconnect"-Skript aufgerufen
Expand Down
7 changes: 1 addition & 6 deletions roles/gateway-server/templates/openvpn/opennet_users.conf
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@ multihome

# Verbindungsdetails
keepalive 10 120
# die verwendete Kompression wird spaeter im "connect"-Skript ausgehandelt
{% if ansible_distribution_major_version|int < 9 %}
comp-lzo
{% else %}
compress lzo
{% endif %}

# erlaube dem Client, seine IP zu wechseln (z.B. bei einem Routing-Wechsel auf einem Client mit zwei olsr-Interfaces)
float
# der Standard-Wert (100) verursacht bei ca. 100 Clients regelmaessig Paketverluste
Expand Down