Use sudo for unbound forwarding.conf in configure_mirror.sh

We need sudo permissions to write the forwarding.conf file.

Change-Id: I788915fccc5ac92b57b6a0815b90c40e32948bed
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2017-06-21 05:25:55 -04:00
parent 87f0024cf4
commit 6fb7a47873
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
1 changed files with 6 additions and 2 deletions

View File

@ -32,14 +32,14 @@ export NODEPOOL_STATIC_NAMESERVER_V4='208.67.222.222'
export NODEPOOL_STATIC_NAMESERVER_V6_FALLBACK='2001:4860:4860::8888'
export NODEPOOL_STATIC_NAMESERVER_V4_FALLBACK='8.8.8.8'
if ip -6 route | grep '^default' ; then
cat > /etc/unbound/forwarding.conf << EOF
cat > /tmp/forwarding.conf << EOF
forward-zone:
name: "."
forward-addr: $NODEPOOL_STATIC_NAMESERVER_V6
forward-addr: $NODEPOOL_STATIC_NAMESERVER_V6_FALLBACK
EOF
else
cat > /etc/unbound/forwarding.conf << EOF
cat > /tmp/forwarding.conf << EOF
forward-zone:
name: "."
forward-addr: $NODEPOOL_STATIC_NAMESERVER_V4
@ -47,6 +47,10 @@ forward-zone:
EOF
fi
sudo mv /tmp/forwarding.conf /etc/unbound
sudo chown root:root /etc/unbound/forwarding.conf
sudo chmod 0644 /etc/unbound/forwarding.conf
if type -p systemctl ; then
sudo systemctl restart unbound
else