mirror of
https://github.com/Mailu/Mailu.git
synced 2025-02-13 13:28:30 +02:00
Added IPv6 as optional
This commit is contained in:
parent
75cc21a19f
commit
3ae1c75c55
@ -3,7 +3,7 @@
|
||||
# Please read the documentation before attempting any change.
|
||||
# Generated for {{ flavor }} flavor
|
||||
|
||||
version: '3.6'
|
||||
version: '2.2'
|
||||
|
||||
services:
|
||||
|
||||
@ -160,8 +160,14 @@ services:
|
||||
|
||||
networks:
|
||||
default:
|
||||
{% if ipv6_enabled %}
|
||||
enable_ipv6: true
|
||||
{% endif %}
|
||||
driver: bridge
|
||||
ipam:
|
||||
driver: default
|
||||
config:
|
||||
- subnet: {{ subnet }}
|
||||
{% if ipv6_enabled %}
|
||||
- subnet: {{ subnet6 }}
|
||||
{% endif %}
|
||||
|
@ -27,6 +27,9 @@ SECRET_KEY={{ secret(16) }}
|
||||
|
||||
# Subnet of the docker network. This should not conflict with any networks to which your system is connected. (Internal and external!)
|
||||
SUBNET={{ subnet }}
|
||||
{% if ipv6_enabled %}
|
||||
SUBNET6={{ subnet6 }}
|
||||
{% endif %}
|
||||
|
||||
# Main mail domain
|
||||
DOMAIN={{ domain }}
|
||||
|
@ -9,6 +9,7 @@ import string
|
||||
import random
|
||||
import ipaddress
|
||||
import hashlib
|
||||
import time
|
||||
|
||||
|
||||
version = os.getenv("this_version", "master")
|
||||
@ -33,6 +34,17 @@ def secret(length=16):
|
||||
for _ in range(length)
|
||||
)
|
||||
|
||||
#Original copied from https://github.com/andrewlkho/ulagen
|
||||
def random_ipv6_subnet():
|
||||
eui64 = uuid.getnode() >> 24 << 48 | 0xfffe000000 | uuid.getnode() & 0xffffff
|
||||
eui64_canon = "-".join([format(eui64, "02X")[i:i+2] for i in range(0, 18, 2)])
|
||||
|
||||
h = hashlib.sha1()
|
||||
h.update((eui64_canon + str(time.time() - time.mktime((1900, 1, 1, 0, 0, 0, 0, 1, -1)))).encode('utf-8'))
|
||||
globalid = h.hexdigest()[0:10]
|
||||
|
||||
prefix = ":".join(("fd" + globalid[0:2], globalid[2:6], globalid[6:10]))
|
||||
return prefix
|
||||
|
||||
def build_app(path):
|
||||
|
||||
@ -69,8 +81,9 @@ def build_app(path):
|
||||
@root_bp.route("/submit_flavor", methods=["POST"])
|
||||
def submit_flavor():
|
||||
data = flask.request.form.copy()
|
||||
subnet6 = random_ipv6_subnet()
|
||||
steps = sorted(os.listdir(os.path.join(path, "templates", "steps", data["flavor"])))
|
||||
return flask.render_template('wizard.html', flavor=data["flavor"], steps=steps)
|
||||
return flask.render_template('wizard.html', flavor=data["flavor"], steps=steps, subnet6=subnet6)
|
||||
|
||||
@prefix_bp.route("/submit", methods=["POST"])
|
||||
@root_bp.route("/submit", methods=["POST"])
|
||||
|
@ -86,3 +86,16 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
if ($('#enable_ipv6').prop('checked')) {
|
||||
$("#ipv6").show();
|
||||
}
|
||||
$("#enable_ipv6").change(function() {
|
||||
if ($(this).is(":checked")) {
|
||||
$("#ipv6").show();
|
||||
} else {
|
||||
$("#ipv6").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -18,13 +18,27 @@ avoid generic all-interfaces addresses like <code>0.0.0.0</code> or <code>::</co
|
||||
<!-- Validates IPv4 address -->
|
||||
<input class="form-control" type="text" name="bind4" value="127.0.0.1"
|
||||
pattern="^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$">
|
||||
<label>Subnet of the docker network. This should not conflict with any networks to which your system is connected. (Internal and external!)</label>
|
||||
<input class="form-control" type="text" name="subnet" required pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))$"
|
||||
value="192.168.203.0/24">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-check form-check-inline">
|
||||
<label class="form-check-label">
|
||||
<input class="form-check-input" type="checkbox" name="ipv6_enabled" value="true" id="enable_ipv6">
|
||||
Enable IPv6
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="ipv6" style="display: none">
|
||||
<p><span class="label label-warning">Warning</span> You must use specific addresses, please
|
||||
avoid generic all-interfaces addresses like <code>0.0.0.0</code> or <code>::</code>.</p>
|
||||
<label>IPv6 listen address</label>
|
||||
<!-- Validates IPv6 address -->
|
||||
<input class="form-control" type="text" name="bind6" value="::1"
|
||||
pattern="^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?$">
|
||||
<label>Subnet of the docker network. This should not conflict with any networks to which your system is connected. (Internal and external!)</label>
|
||||
<input class="form-control" type="text" name="subnet6" required value="{{ subnet6 }}:beef::/64">
|
||||
</div>
|
||||
|
||||
<p>The unbound resolver enables Mailu to do DNSsec verification, DNS root lookups and caching. This also helps the antispam service not to get blocked by the public or ISP DNS servers.</p>
|
||||
@ -34,12 +48,6 @@ avoid generic all-interfaces addresses like <code>0.0.0.0</code> or <code>::</co
|
||||
Enable unbound resolver
|
||||
</label>
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="form-group">
|
||||
<label>Subnet of the docker network. This should not conflict with any networks to which your system is connected. (Internal and external!)</label>
|
||||
<input class="form-control" type="text" name="subnet" required pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))$"
|
||||
value="192.168.203.0/24">
|
||||
</div>
|
||||
|
||||
<p>You server will be available under a main hostname but may expose multiple public
|
||||
hostnames. Every e-mail domain that points to this server must have one of the
|
||||
|
Loading…
x
Reference in New Issue
Block a user