Ajout : vm_hosted : rule_unbound_configure .
[lhc/ateliers.git] / vm_hosted
index 91ec25a..134b539 100755 (executable)
--- a/vm_hosted
+++ b/vm_hosted
@@ -748,6 +748,10 @@ rule_network_configure () {
                $(cat /etc/hosts)
                127.0.0.1 $vm_fqdn $vm
                EOF
+       sudo install -m 644 -o root -g root /dev/stdin /etc/resolv.conf <<-EOF
+               search ${vm_host#*.}
+               nameserver ${vm_host_nameserver}
+               EOF
        sudo install -m 644 -o root -g root /dev/stdin /etc/network/interfaces <<-EOF
                auto lo
                iface lo inet loopback
@@ -1283,6 +1287,23 @@ rule_time_configure () {
        rule dpkg_reconfigure tzdata
        rule apt_get_install ntp
  }
+rule_unbound_configure () {
+       sudo apt-get install unbound m4
+       sudo install -m 644 -o root -g root /dev/stdin /etc/resolv.conf <<-EOF
+               search ${vm_host#*.}
+               nameserver 127.0.0.1
+               #nameserver ${vm_host_nameserver}
+               EOF
+       sudo install -m 440 -o unbound -g unbound \
+        "$tool"/etc/unbound/named.cache \
+        /etc/unbound/named.cache
+       m4 \
+        --define=OUTGOING_INTERFACE=$vm_ipv4 \
+        <"$tool"/etc/unbound/unbound.conf |
+       sudo install -m 440 -o unbound -g unbound /dev/stdin \
+        /etc/unbound/unbound.conf
+       sudo service unbound restart
+ }
 rule_user_add () { # SYNTAX: $user
        rule user_configure
        local user=$1