Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
f1dac1fe
Commit
f1dac1fe
authored
Jun 06, 2014
by
Joshua Tauberer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show less output when updating DNS configuration
parent
389c354c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
13 deletions
+31
-13
dns_update.py
management/dns_update.py
+30
-12
start.sh
setup/start.sh
+1
-1
No files found.
management/dns_update.py
View file @
f1dac1fe
...
...
@@ -31,19 +31,27 @@ def do_dns_update(env):
updated_domains
.
append
(
domain
)
# Write the main nsd.conf file.
write_nsd_conf
(
zonefiles
)
if
write_nsd_conf
(
zonefiles
):
# Make sure updated_domains contains *something* if we wrote an updated
# nsd.conf so that we know to restart nsd.
if
len
(
updated_domains
)
==
0
:
updated_domains
.
append
(
"DNS configuration"
)
# Kick nsd if anything changed.
if
len
(
updated_domains
)
>
0
:
os
.
system
(
"service nsd restart"
)
# Write the OpenDKIM configuration tables.
write_opendkim_tables
(
zonefiles
,
env
)
# Kick nsd.
os
.
system
(
"service nsd restart"
)
# Kick opendkim.
os
.
system
(
"service opendkim restart"
)
if
len
(
updated_domains
)
==
0
:
updated_domains
=
[
'(no domains required an update)'
]
return
"Updated: "
+
","
.
join
(
updated_domains
)
+
"
\n
"
if
len
(
updated_domains
)
==
0
:
# if nothing was updated (except maybe DKIM), don't show any output
return
""
else
:
return
"updated: "
+
","
.
join
(
updated_domains
)
+
"
\n
"
########################################################################
...
...
@@ -136,8 +144,7 @@ $TTL 86400 ; default time to live
########################################################################
def
write_nsd_conf
(
zonefiles
):
with
open
(
"/etc/nsd/nsd.conf"
,
"w"
)
as
f
:
f
.
write
(
"""
nsdconf
=
"""
server:
hide-version: yes
...
...
@@ -148,14 +155,25 @@ server:
zonesdir: "/etc/nsd/zones"
# ZONES
"""
)
"""
for
domain
,
zonefile
in
zonefiles
:
f
.
write
(
"""
for
domain
,
zonefile
in
zonefiles
:
nsdconf
+=
"""
zone:
name:
%
s
zonefile:
%
s
"""
%
(
domain
,
zonefile
))
"""
%
(
domain
,
zonefile
)
# Check if the nsd.conf is changing. If it isn't changing,
# return False to flag that no change was made.
with
open
(
"/etc/nsd/nsd.conf"
)
as
f
:
if
f
.
read
()
==
nsdconf
:
return
False
with
open
(
"/etc/nsd/nsd.conf"
,
"w"
)
as
f
:
f
.
write
(
nsdconf
)
return
True
########################################################################
...
...
setup/start.sh
View file @
f1dac1fe
...
...
@@ -115,7 +115,7 @@ EOF
# Write the DNS configuration files.
sleep
5
# wait for the daemon to start
curl
-d
POSTDATA http://127.0.0.1:10222/dns/update
curl
-
s
-
d
POSTDATA http://127.0.0.1:10222/dns/update
# If there aren't any mail users yet, create one.
if
[
-z
"
`
tools/mail.py user
`
"
]
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment