Fix IP_RANGE variable substitution

This commit is contained in:
Unknown 2020-02-29 01:35:33 -05:00
parent d7cbcf7ec1
commit 239b5be082
No known key found for this signature in database
GPG Key ID: 3222DB0F636031B6

View File

@ -104,19 +104,19 @@ function installUnbound () {
apt-get install -y unbound
# Configuration
echo 'interface: ${VAR: : -1}1
access-control: ${VAR: : -1}1/24 allow
echo "interface: ${IP_RANGE: : -1}1
access-control: ${IP_RANGE: : -1}1/24 allow
hide-identity: yes
hide-version: yes
use-caps-for-id: yes
prefetch: yes' >> /etc/unbound/unbound.conf
prefetch: yes" >> /etc/unbound/unbound.conf
elif [[ "$OS" =~ (centos|amzn) ]]; then
yum install -y unbound
# Configuration
sed -i 's|# interface: 0.0.0.0$|interface: ${VAR: : -1}1|' /etc/unbound/unbound.conf
sed -i 's|# access-control: 127.0.0.0/8 allow|access-control: ${VAR: : -1}1/24 allow|' /etc/unbound/unbound.conf
sed -i "s|# interface: 0.0.0.0$|interface: ${IP_RANGE: : -1}1|" /etc/unbound/unbound.conf
sed -i "s|# access-control: 127.0.0.0/8 allow|access-control: ${IP_RANGE: : -1}1/24 allow|" /etc/unbound/unbound.conf
sed -i 's|# hide-identity: no|hide-identity: yes|' /etc/unbound/unbound.conf
sed -i 's|# hide-version: no|hide-version: yes|' /etc/unbound/unbound.conf
sed -i 's|use-caps-for-id: no|use-caps-for-id: yes|' /etc/unbound/unbound.conf
@ -125,8 +125,8 @@ prefetch: yes' >> /etc/unbound/unbound.conf
dnf install -y unbound
# Configuration
sed -i 's|# interface: 0.0.0.0$|interface: ${VAR: : -1}1|' /etc/unbound/unbound.conf
sed -i 's|# access-control: 127.0.0.0/8 allow|access-control: ${VAR: : -1}1/24 allow|' /etc/unbound/unbound.conf
sed -i "s|# interface: 0.0.0.0$|interface: ${IP_RANGE: : -1}1|" /etc/unbound/unbound.conf
sed -i "s|# access-control: 127.0.0.0/8 allow|access-control: ${IP_RANGE: : -1}1/24 allow|" /etc/unbound/unbound.conf
sed -i 's|# hide-identity: no|hide-identity: yes|' /etc/unbound/unbound.conf
sed -i 's|# hide-version: no|hide-version: yes|' /etc/unbound/unbound.conf
sed -i 's|# use-caps-for-id: no|use-caps-for-id: yes|' /etc/unbound/unbound.conf
@ -139,15 +139,15 @@ prefetch: yes' >> /etc/unbound/unbound.conf
mv /etc/unbound/unbound.conf /etc/unbound/unbound.conf.old
echo 'server:
echo "server:
use-syslog: yes
do-daemonize: no
username: "unbound"
directory: "/etc/unbound"
username: \"unbound\"
directory: \"/etc/unbound\"
trust-anchor-file: trusted-key.key
root-hints: root.hints
interface: ${VAR: : -1}1
access-control: ${VAR: : -1}1/24 allow
interface: ${IP_RANGE: : -1}1
access-control: ${IP_RANGE: : -1}1/24 allow
port: 53
num-threads: 2
use-caps-for-id: yes
@ -155,7 +155,7 @@ prefetch: yes' >> /etc/unbound/unbound.conf
hide-identity: yes
hide-version: yes
qname-minimisation: yes
prefetch: yes' > /etc/unbound/unbound.conf
prefetch: yes" > /etc/unbound/unbound.conf
fi
if [[ ! "$OS" =~ (fedora|centos|amzn) ]];then
@ -173,9 +173,9 @@ private-address: ::ffff:0:0/96" >> /etc/unbound/unbound.conf
echo 'include: /etc/unbound/openvpn.conf' >> /etc/unbound/unbound.conf
# Add Unbound 'server' for the OpenVPN subnet
echo 'server:
interface: ${VAR: : -1}1
access-control: ${VAR: : -1}1/24 allow
echo "server:
interface: ${IP_RANGE: : -1}1
access-control: ${IP_RANGE: : -1}1/24 allow
hide-identity: yes
hide-version: yes
use-caps-for-id: yes
@ -187,7 +187,7 @@ private-address: 169.254.0.0/16
private-address: fd00::/8
private-address: fe80::/10
private-address: 127.0.0.0/8
private-address: ::ffff:0:0/96' > /etc/unbound/openvpn.conf
private-address: ::ffff:0:0/96" > /etc/unbound/openvpn.conf
fi
systemctl enable unbound
@ -760,7 +760,7 @@ ifconfig-pool-persist ipp.txt" >> /etc/openvpn/server.conf
done
;;
2)
echo 'push "dhcp-option DNS ${VAR: : -1}1"' >> /etc/openvpn/server.conf
echo "push \"dhcp-option DNS ${IP_RANGE: : -1}1\"" >> /etc/openvpn/server.conf
;;
3) # Cloudflare
echo 'push "dhcp-option DNS 1.0.0.1"' >> /etc/openvpn/server.conf