#!/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_ips_to_squid_conf.sh "$ip" "$squid_port" >> $squid_conf_dir echo "${ip}:${squid_port}:admin:ballsofsteel" done < "$ip_file" # restart squid after sudo systemctl restart squid