diff --git a/setup/so-functions b/setup/so-functions index a20953035..1e7bf7951 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -948,6 +948,35 @@ node_pillar() { cat "$pillar_file" >> "$setup_log" 2>&1 } +parse_options() { + case "$1" in + --turbo=*) + local proxy + proxy=$(echo "$1" | awk -F'--turbo=' '{print $2}') + use_proxy "http://$proxy" + ;; + --proxy=*) + echo "Unimplimented" + return + + if [[ $2 != --proxy-user=* ]] || [[ $3 != --proxy-pass=* ]]; then + echo "Invalid options passed for proxy. Order is --proxy-user= --proxy-pass=" + else + local proxy + local user + local password + proxy=$(echo "$1" | awk -F'--proxy=' '{print $2}') + user=$(echo "$2" | awk -F'--proxy-user=' '{print $2}') + password=$(echo "$3" | awk -F'--proxy-pass=' '{print $2}') + + use_proxy "$proxy" "$user" "$password" + fi + ;; + *) + echo "Invalid option" + esac +} + patch_pillar() { local pillar_file=$temp_install_dir/pillar/minions/$MINION_ID.sls @@ -1443,6 +1472,26 @@ update_packages() { fi } +use_proxy() { + local proxy_addr=$1 + #TODO: add options for username + pass + + if [[ $OS == 'centos' ]]; then + printf '%s\n'\ + "proxy=\"$proxy_addr\"" >> /etc/yum.conf + else + printf '%s\n'\ + "Acquire {"\ + "HTTP::proxy \"$proxy_addr\";"\ + "HTTPS::proxy \"$proxy_addr\";"\ + "}" > /etc/apt/apt.conf.d/proxy.conf + fi + mkdir -p /etc/systemd/system/docker.service.d + printf '%s\n'\ + "[Service]"\ + "ExecStart=/usr/bin/dockerd /usr/bin/dockerd -H fd:// --registry-mirror \"$proxy_addr\"" > /etc/systemd/system/docker.service.d/docker.conf +} + ls_heapsize() { if [ "$total_mem" -ge 32000 ]; then diff --git a/setup/so-setup b/setup/so-setup index 406d69763..5ec148208 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -48,7 +48,7 @@ fi setterm -blank 0 -if (whiptail_you_sure); then +if [ "$setup_type" == 'iso' ] || (whiptail_you_sure); then true else echo "User cancelled setup." >> $setup_log 2>&1 @@ -241,6 +241,11 @@ fi whiptail_make_changes +if [[ $# -gt 1 ]]; then + set -- "${@:2}" + parse_options "$@" +fi + if [[ "$setup_type" == 'iso' ]]; then # Init networking so rest of install works set_hostname_iso diff --git a/setup/so-whiptail b/setup/so-whiptail index cfe00b67b..559f791b7 100755 --- a/setup/so-whiptail +++ b/setup/so-whiptail @@ -1048,7 +1048,7 @@ whiptail_you_sure() { [ -n "$TESTING" ] && return - whiptail --title "Security Onion Setup" --yesno "Are you sure you want to install Security Onion over the internet?" 8 75 + whiptail --title "Security Onion Setup" --yesno "Are you sure you want to continue a network install of Security Onion?" 8 75 local exitstatus=$? return $exitstatus diff --git a/so-setup-network b/so-setup-network index ae9af4ffa..2528ff14b 100755 --- a/so-setup-network +++ b/so-setup-network @@ -15,6 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -cd setup +cd setup || exit -./so-setup network +./so-setup network "$@"