34 lines
1.1 KiB
Bash
Executable file
34 lines
1.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# this is the bootstrap script that will do the following:
|
|
# 1. add ip addresses to a centos 7 system
|
|
# 2. install a squid proxy with basic auth username/pass
|
|
# 3. append ip addresses as listeners for each ip added.
|
|
|
|
# step 1: install squid
|
|
sh install_squid.sh
|
|
|
|
network_script_dir='/etc/sysconfig/network-scripts'
|
|
squid_conf_dir='/etc/squid/squid.conf'
|
|
|
|
count=0
|
|
ip_file="./ips.txt"
|
|
squid_port=3128
|
|
|
|
[[ -f $ip_file ]] || echo "IP address file: $ip_file does not exist. Please create a file in the `pwd` with the names ips.txt. One IP per line."
|
|
|
|
while IFS= read -r ip
|
|
do
|
|
# increment our index for eth0:{index} and our squid port per ip that we have.
|
|
((count=count+1))
|
|
((squid_port=squid_port+1))
|
|
./ifcfg-eth0-template.sh "$ip" "$count" > "${network_script_dir}/ifcfg-eth0:${count}"
|
|
./add_ip_to_squid_conf.sh "$ip" "$squid_port" >> $squid_conf_dir
|
|
echo "${ip}:${squid_port}:admin:ballsofsteel"
|
|
done < "$ip_file"
|
|
|
|
# first restart networking
|
|
# big money, big money, big money
|
|
sudo systemctl restart network
|
|
|
|
# restart squid after.
|
|
sudo systemctl restart squid
|