mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-08 10:12:53 +01:00
[wip] Further proxy changes
* Remove unused docker.conf template * Rename proxy variable to avoid name collision * Reword address prompt to specify users should not include user:pass in their input * Actually call the collect_proxy function
This commit is contained in:
@@ -1,2 +0,0 @@
|
|||||||
[Service]
|
|
||||||
ExecStart=/usr/bin/dockerd /usr/bin/dockerd -H fd:// --registry-mirror "$proxy_addr"
|
|
||||||
@@ -553,13 +553,13 @@ collect_proxy() {
|
|||||||
local url_prefixes=( 'http://' 'https://' )
|
local url_prefixes=( 'http://' 'https://' )
|
||||||
for prefix in "${url_prefixes[@]}"; do
|
for prefix in "${url_prefixes[@]}"; do
|
||||||
if echo "$proxy_addr" | grep "$prefix"; then
|
if echo "$proxy_addr" | grep "$prefix"; then
|
||||||
proxy=${proxy_addr#"$prefix"}
|
local proxy=${proxy_addr#"$prefix"}
|
||||||
proxy="${prefix}${proxy_user}:${proxy_pass}@${proxy}"
|
so_proxy="${prefix}${proxy_user}:${proxy_pass}@${proxy}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
proxy="$proxy_addr"
|
so_proxy="$proxy_addr"
|
||||||
fi
|
fi
|
||||||
export proxy
|
export proxy
|
||||||
fi
|
fi
|
||||||
@@ -1541,7 +1541,7 @@ manager_global() {
|
|||||||
" hnmanager: '$HNMANAGER'"\
|
" hnmanager: '$HNMANAGER'"\
|
||||||
" ntpserver: '$NTPSERVER'"\
|
" ntpserver: '$NTPSERVER'"\
|
||||||
" dockernet: '$DOCKERNET'"\
|
" dockernet: '$DOCKERNET'"\
|
||||||
" proxy: '$proxy'"\
|
" proxy: '$so_proxy'"\
|
||||||
" mdengine: '$ZEEKVERSION'"\
|
" mdengine: '$ZEEKVERSION'"\
|
||||||
" ids: '$NIDS'"\
|
" ids: '$NIDS'"\
|
||||||
" url_base: '$REDIRECTIT'"\
|
" url_base: '$REDIRECTIT'"\
|
||||||
@@ -1719,6 +1719,10 @@ network_init() {
|
|||||||
if [[ "$setup_type" == 'iso' ]]; then
|
if [[ "$setup_type" == 'iso' ]]; then
|
||||||
set_management_interface
|
set_management_interface
|
||||||
fi
|
fi
|
||||||
|
# Check if the proxy variable was set then set proxy for various apps if so
|
||||||
|
if [[ -n "$so_proxy" ]]; then
|
||||||
|
set_proxy
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
network_init_whiptail() {
|
network_init_whiptail() {
|
||||||
@@ -1742,6 +1746,7 @@ network_init_whiptail() {
|
|||||||
whiptail_management_nic
|
whiptail_management_nic
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
collect_proxy
|
||||||
}
|
}
|
||||||
|
|
||||||
network_setup() {
|
network_setup() {
|
||||||
@@ -2224,7 +2229,7 @@ set_proxy() {
|
|||||||
# Set proxy environment variables used by curl, wget, docker, and others
|
# Set proxy environment variables used by curl, wget, docker, and others
|
||||||
{
|
{
|
||||||
echo "export use_proxy=on"
|
echo "export use_proxy=on"
|
||||||
echo "export http_proxy=\"${proxy}\""
|
echo "export http_proxy=\"${so_proxy}\""
|
||||||
echo "export https_proxy=\"\$http_addr\""
|
echo "export https_proxy=\"\$http_addr\""
|
||||||
echo "export ftp_proxy=\"\$http_addr\""
|
echo "export ftp_proxy=\"\$http_addr\""
|
||||||
echo "export no_proxy=\"${no_proxy_string}\""
|
echo "export no_proxy=\"${no_proxy_string}\""
|
||||||
@@ -2233,8 +2238,8 @@ set_proxy() {
|
|||||||
# Create proxy config for dockerd
|
# Create proxy config for dockerd
|
||||||
printf '%s\n'\
|
printf '%s\n'\
|
||||||
"[Service]"\
|
"[Service]"\
|
||||||
"Environment=\"HTTP_PROXY=${proxy}\""\
|
"Environment=\"HTTP_PROXY=${so_proxy}\""\
|
||||||
"Environment=\"HTTPS_PROXY=${proxy}\""\
|
"Environment=\"HTTPS_PROXY=${so_proxy}\""\
|
||||||
"Environment=\"NO_PROXY=${no_proxy_string}\"" > /etc/systemd/system/docker.service.d/http-proxy.conf
|
"Environment=\"NO_PROXY=${no_proxy_string}\"" > /etc/systemd/system/docker.service.d/http-proxy.conf
|
||||||
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
@@ -2242,18 +2247,18 @@ set_proxy() {
|
|||||||
|
|
||||||
# Set proxy for package manager
|
# Set proxy for package manager
|
||||||
if [ "$OS" = 'centos' ]; then
|
if [ "$OS" = 'centos' ]; then
|
||||||
echo "proxy=$proxy" >> /etc/yum.conf
|
echo "proxy=$so_proxy" >> /etc/yum.conf
|
||||||
else
|
else
|
||||||
# Set it up so the updates roll through the manager
|
# Set it up so the updates roll through the manager
|
||||||
printf '%s\n'\
|
printf '%s\n'\
|
||||||
"Acquire::http::Proxy \"$proxy\";"\
|
"Acquire::http::Proxy \"$so_proxy\";"\
|
||||||
"Acquire::https::Proxy \"$proxy\";" > /etc/apt/apt.conf.d/00-proxy.conf
|
"Acquire::https::Proxy \"$so_proxy\";" > /etc/apt/apt.conf.d/00-proxy.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set global git proxy
|
# Set global git proxy
|
||||||
printf '%s\n'\
|
printf '%s\n'\
|
||||||
"[http]"\
|
"[http]"\
|
||||||
" proxy = ${proxy}" > /etc/gitconfig
|
" proxy = ${so_proxy}" > /etc/gitconfig
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_salt_master_dirs() {
|
setup_salt_master_dirs() {
|
||||||
|
|||||||
@@ -1224,8 +1224,14 @@ whiptail_proxy_ask() {
|
|||||||
|
|
||||||
whiptail_proxy_addr() {
|
whiptail_proxy_addr() {
|
||||||
[ -n "$TESTING" ] && return
|
[ -n "$TESTING" ] && return
|
||||||
|
local message
|
||||||
|
read -r -d '' message <<- EOM
|
||||||
|
Please input the proxy server you wish to use, including the URL prefix (ex: https://your.proxy.com:1234).
|
||||||
|
|
||||||
proxy_addr=$(whiptail --title "Security Onion Setup" --inputbox "Please input the proxy server you wish to use, including the URL prefix (ex: https://your.proxy.com:1234):" 8 60 3>&1 1>&2 2>&3)
|
If your proxy requires a username and password do not include them in your input. Setup will ask for those values next.
|
||||||
|
EOM
|
||||||
|
|
||||||
|
proxy_addr=$(whiptail --title "Security Onion Setup" --inputbox "$message" 13 60 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
local exitstatus=$?
|
local exitstatus=$?
|
||||||
whiptail_check_exitstatus $exitstatus
|
whiptail_check_exitstatus $exitstatus
|
||||||
|
|||||||
Reference in New Issue
Block a user