mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
bind: Replace config in setup
This commit is contained in:
1 parent
e0abdbd0e9
commit
d4b0809db0
4 files changed
+44
-29
No files matched your search
+36
-20
@@ -27,12 +27,41 @@ from plinth import action_utils
|
||||
|
||||
|
||||
CONFIG_FILE = '/etc/bind/named.conf.options'
|
||||
|
||||
value1 = 'acl goodclients { \n localnets;\n};\n'
|
||||
value2 = ' recursion yes;\n allow-query { goodclients; };\n\n'
|
||||
value3 = ' // 8.8.8.8; 8.8.4.4;\n'
|
||||
value4 = ' //forward first;\n'
|
||||
value5 = ' //dnssec-enable yes;\n'
|
||||
default_file = '\n'+\
|
||||
'acl goodclients {\n'+\
|
||||
' localnets;\n'+\
|
||||
'};\n'+\
|
||||
'options {\n'+\
|
||||
'directory "/var/cache/bind";\n'+\
|
||||
'\n'+\
|
||||
'recursion yes;\n'+\
|
||||
'allow-query { goodclients; };\n'+\
|
||||
'\n'+\
|
||||
'// If there is a firewall between you and nameservers you want\n'+\
|
||||
'// to talk to, you may need to fix the firewall to allow multiple\n'+\
|
||||
'// ports to talk. See http://www.kb.cert.org/vuls/id/800113\n'+\
|
||||
'\n'+\
|
||||
'// If your ISP provided one or more IP addresses for stable\n'+\
|
||||
'// nameservers, you probably want to use them as forwarders.\n'+\
|
||||
'// Uncomment the following block, and insert the addresses replacing\n'+\
|
||||
"// the all-0's placeholder.\n"+\
|
||||
'\n'+\
|
||||
'forwarders {\n'+\
|
||||
'8.8.8.8; 8.8.4.4;\n'+\
|
||||
'};\n'+\
|
||||
'forward first;\n'+\
|
||||
'\n'+\
|
||||
'dnssec-enable yes;\n'+\
|
||||
'//========================================================================\n'+\
|
||||
'// If BIND logs error messages about the root key being expired,\n'+\
|
||||
'// you will need to update your keys. See https://www.isc.org/bind-keys\n'+\
|
||||
'//========================================================================\n'+\
|
||||
'dnssec-validation auto;\n'+\
|
||||
'\n'+\
|
||||
'auth-nxdomain no; # conform to RFC1035\n'+\
|
||||
'listen-on-v6 { any; };\n'+\
|
||||
'};\n'+\
|
||||
'\n'
|
||||
|
||||
def parse_arguments():
|
||||
"""Return parsed command line arguments as dictionary"""
|
||||
@@ -54,22 +83,9 @@ def parse_arguments():
|
||||
|
||||
def subcommand_setup(_):
|
||||
"""Setup BIND configuration."""
|
||||
f = open(CONFIG_FILE, "r")
|
||||
contents = f.readlines()
|
||||
f.close()
|
||||
|
||||
contents.insert(0, value1)
|
||||
contents.insert(4, value2)
|
||||
contents.insert(15, value3)
|
||||
contents.insert(18, value4)
|
||||
contents.insert(20, value5)
|
||||
|
||||
f = open(CONFIG_FILE, "w")
|
||||
contents = "".join(contents)
|
||||
f.write(contents)
|
||||
f.write(default_file)
|
||||
f.close()
|
||||
set_forwarding(True)
|
||||
enable_dnssec(True)
|
||||
action_utils.service_restart('bind9')
|
||||
|
||||
def subcommand_dns(arguments):
|
||||
|
||||
Reference in new issue
Block a user