I've got an ini file with several variables in it. Which i source from my bash script.
smb.ini:
USERNAME=bridge01.test
PASSWORD="8934v98nt3jiogt"
SHARE="//test.one.test.nl/Data/"
DOMAIN=ONE
USERDNS=one.test.nl
INTERFACE=eth0
IPALLOWED="172.1.50.95"
DNSSERVERS=172.2.1.21,172.17.1.11,10.2.1.10
HOSTNAME=bridge01.test
When I add these variables in my bash everything works as usual, but I want it to be configured by the ini file.
This is the output from the script when sourcing from smb.ini:
Adding firewall rules
' not found.8.7 (nf_tables): host/network `172.1.50.95
Try `iptables -h' or 'iptables --help' for more information.
172.1.50.95
' not found.8.7 (nf_tables): host/network `172.1.50.9
This is the script:
config_file="smb.ini"
source "$config_file"
# Loop through the IP addresses and allow traffic from them
for IPS in $IPALLOWED
do
echo $IPS
# Allow traffic from the current IP address on TCP ports 137, 139, and 445
iptables -I INPUT -s "$IPS" -p tcp -m multiport --dports 137,139,445 -m state --state NEW -j ACCEPT
echo "Allowed traffic from $IPS"
iptables-restore < /etc/iptables
iptables-save
done
It seems to add \n to the IP?
Please note: I need to add several IPs to unblock.