mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-08 02:02:50 +01:00
[feat] Initial work for running setup through proxy
This commit is contained in:
@@ -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=<user> --proxy-pass=<password>"
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
cd setup
|
||||
cd setup || exit
|
||||
|
||||
./so-setup network
|
||||
./so-setup network "$@"
|
||||
|
||||
Reference in New Issue
Block a user