diff options
Diffstat (limited to 'scripts/hostclass/idm_server/40-unbound')
-rw-r--r-- | scripts/hostclass/idm_server/40-unbound | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/hostclass/idm_server/40-unbound b/scripts/hostclass/idm_server/40-unbound index 01c1c70..d38194f 100644 --- a/scripts/hostclass/idm_server/40-unbound +++ b/scripts/hostclass/idm_server/40-unbound @@ -4,8 +4,10 @@ unbound_user=unbound unbound_conf_dir=/usr/local/etc/unbound unbound_blocklist_dir="${unbound_conf_dir}/blocklists" unbound_blocklist_url_file="${unbound_conf_dir}/blocklist_urls" +unbound_whitelist_file="${unbound_conf_dir}/whitelist" : ${unbound_blocklist_urls:=''} +: ${unbound_whitelist:=''} : ${unbound_cache_max_negative_ttl:='60'} : ${unbound_rrset_cache_size:='104857600'} # 100 MB : ${unbound_msg_cache_size:='52428800'} # 50 MB @@ -24,9 +26,10 @@ install_directory -m 0755 -o "$unbound_user" "$unbound_blocklist_dir" install_template -m 0644 "${unbound_conf_dir}/unbound.conf" # Download blocklists. +echo "$unbound_whitelist" | tee "$unbound_whitelist_file" echo "$unbound_blocklists" | tee "$unbound_blocklist_url_file" install_file -m 0755 /usr/local/libexec/idm-update-unbound-blocklists -su -m "$unbound_user" -c "/usr/local/libexec/idm-update-unbound-blocklists ${unbound_blocklist_dir} < ${unbound_blocklist_url_file}" +su -m "$unbound_user" -c "/usr/local/libexec/idm-update-unbound-blocklists ${unbound_blocklist_url_file} ${unbound_whitelist_file} ${unbound_blocklist_dir}" # Enable and start unbound. sysrc -v unbound_enable=YES @@ -36,5 +39,4 @@ service unbound restart install_template -m 0644 /etc/resolv.conf # Update blocklists with a cron job. -echo "@daily root su -m ${unbound_user} -c \"/usr/local/libexec/idm-update-unbound-blocklists ${unbound_blocklist_dir} < ${unbound_blocklist_url_file}\" && service unbound reload" \ - | tee /etc/cron.d/idm-update-unbound-blocklists +install_template -m 0644 /etc/cron.d/unbound |