You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.5 KiB

  1. #!/bin/bash
  2. set -eux
  3. apt-get -y install bind9 logrotate
  4. ## copy configuration
  5. ##
  6. ## Logs
  7. ##
  8. ## set log in /etc/bind/named.conf.options
  9. cat <<EOF >> /etc/bind/named.conf.options
  10. logging {
  11. channel warning
  12. {
  13. file "/var/log/named/dns.warnings.log";
  14. severity warning;
  15. print-category yes;
  16. print-severity yes;
  17. print-time yes;
  18. };
  19. channel general_dns
  20. {
  21. file "/var/log/named/dns.log";
  22. severity info;
  23. print-category yes;
  24. print-severity yes;
  25. print-time yes;
  26. };
  27. category default { warning; } ;
  28. category queries { general_dns; } ;
  29. };
  30. EOF
  31. ## set up logrotate
  32. cat <<EOF >> /etc/logrotate.d/named
  33. # logrotate.d example configuration for dns in user log config,
  34. # contributed by Lab Valentin based on Dag Wieers distcc logrotate.d example.
  35. # The "copytruncate" option means fetchmail can keep appending to the
  36. # same filehandle. You would otherwise need to make sure fetchmail is not
  37. # running.
  38. /var/log/named/*.log {
  39. missingok
  40. copytruncate
  41. notifempty
  42. compress
  43. }
  44. EOF
  45. mkdir -p /var/log/named
  46. chown bind:bind /var/log/named
  47. ##
  48. ## BEWARE of recursion (recursion allow your server to answer queries in which he is NOT SOA
  49. ##
  50. # allow-recursion yes;
  51. # allow-recursion { 127.0.0.1; 172.128/16; 37.59.9.161;};
  52. # allow-recursion-on { any;};