mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-03-05 15:57:23 +01:00
Merge remote-tracking branch 'upstream/master' into mgmt-auth
Conflicts: management/daemon.py
This commit is contained in:
@@ -109,6 +109,9 @@ def do_updates():
|
||||
if __name__ == '__main__':
|
||||
if "DEBUG" in os.environ: app.debug = True
|
||||
|
||||
if not app.debug:
|
||||
app.logger.addHandler(utils.create_syslog_handler())
|
||||
|
||||
# For testing on the command line, you can use `curl` like so:
|
||||
# curl --user $(</var/lib/mailinabox/api.key): http://localhost:10222/mail/users
|
||||
auth_service.write_key()
|
||||
@@ -117,6 +120,5 @@ if __name__ == '__main__':
|
||||
# debug console and enter that as the username
|
||||
app.logger.info('API key: ' + auth_service.key)
|
||||
|
||||
|
||||
app.run(port=10222)
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ def build_zone(domain, zonefile, env, with_ns=True):
|
||||
records.append(("ns1", "A", env["PUBLIC_IP"]))
|
||||
records.append(("ns2", "A", env["PUBLIC_IP"]))
|
||||
|
||||
# Add a TLSA record for SMTP.
|
||||
# Add a DANE TLSA record for SMTP.
|
||||
records.append(("_25._tcp", "TLSA", build_tlsa_record(env)))
|
||||
|
||||
def has_rec(qname, rtype):
|
||||
@@ -179,9 +179,8 @@ def build_zone(domain, zonefile, env, with_ns=True):
|
||||
########################################################################
|
||||
|
||||
def build_tlsa_record(env):
|
||||
# A TLSA record in DNS specifies that connections on a port, e.g.
|
||||
# the SMTP port, must use TLS and the certificate must match a
|
||||
# particular certificate.
|
||||
# A DANE TLSA record in DNS specifies that connections on a port
|
||||
# must use TLS and the certificate must match a particular certificate.
|
||||
#
|
||||
# Thanks to http://blog.huque.com/2012/10/dnssec-and-certificates.html
|
||||
# for explaining all of this!
|
||||
|
||||
@@ -95,3 +95,9 @@ def shell(method, cmd_args, env={}, capture_stderr=False, return_bytes=False):
|
||||
ret = getattr(subprocess, method)(cmd_args, env=env, stderr=stderr)
|
||||
if not return_bytes and isinstance(ret, bytes): ret = ret.decode("utf8")
|
||||
return ret
|
||||
|
||||
def create_syslog_handler():
|
||||
import logging.handlers
|
||||
handler = logging.handlers.SysLogHandler(address='/dev/log')
|
||||
handler.setLevel(logging.WARNING)
|
||||
return handler
|
||||
|
||||
Reference in New Issue
Block a user