From f9ba7c29cfdd1ca1f375df70200f68d529df2d70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu>
Date: Thu, 9 Feb 2017 12:02:42 +0100
Subject: [PATCH] Added setup porxy step (refs #20413).

---
 1.Base/4.Proxy_settings/0_setup.py            |  47 ++++
 2.Common_services/4.Wowza/0_setup.py          |  41 ++++
 2.Common_services/4.Wowza/Proxy.xml           |  18 ++
 .../4.Wowza/live-application.xml.bak          | 228 ------------------
 .../4.Wowza/wowza-update.sh.back              | 163 -------------
 .../1.Apply_client_configuration/0_setup.sh   |  73 ------
 .../3.Initialize_APT/0_setup.sh               |  13 +-
 global-conf.sh                                |   6 +-
 launcher.sh                                   |   1 +
 9 files changed, 109 insertions(+), 481 deletions(-)
 create mode 100644 1.Base/4.Proxy_settings/0_setup.py
 create mode 100644 2.Common_services/4.Wowza/Proxy.xml
 delete mode 100644 2.Common_services/4.Wowza/live-application.xml.bak
 delete mode 100755 2.Common_services/4.Wowza/wowza-update.sh.back

diff --git a/1.Base/4.Proxy_settings/0_setup.py b/1.Base/4.Proxy_settings/0_setup.py
new file mode 100644
index 00000000..5f136b7d
--- /dev/null
+++ b/1.Base/4.Proxy_settings/0_setup.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+import os
+
+import utils
+
+
+def setup(interactive=True):
+    # Get conf
+    http_proxy = utils.get_conf('PROXY_HTTP')
+    https_proxy = utils.get_conf('PROXY_HTTPS')
+    no_proxy = utils.get_conf('PROXY_EXCLUDE')
+    # Environment
+    environment_path = '/etc/environment'
+    environment = 'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"\n'
+    if http_proxy:
+        environment += 'http_proxy="%s"\n' % http_proxy
+    if https_proxy:
+        environment += 'https_proxy="%s"\n' % https_proxy
+    if no_proxy:
+        environment += 'no_proxy="%s"\n' % no_proxy
+    # apt
+    apt_proxy_path = '/etc/apt/apt.conf.d/proxy'
+    apt_proxy = ''
+    if http_proxy:
+        apt_proxy += 'Acquire::http::Proxy "%s";' % http_proxy
+    if https_proxy:
+        apt_proxy += 'Acquire::https::Proxy "%s";' % https_proxy
+    # write changes
+    files = (
+        (environment_path, environment),
+        (apt_proxy_path, apt_proxy),
+    )
+    for path, content in files:
+        if os.path.exists(path):
+            with open(path, 'r') as fo:
+                current = fo.read()
+        else:
+            current = ''
+        if current != content:
+            if content:
+                with open(path, 'w') as fo:
+                    fo.write(content)
+                utils.log('File "%s" updated.' % path)
+            else:
+                os.path.remove(path)
+                utils.log('File "%s" removed.' % path)
diff --git a/2.Common_services/4.Wowza/0_setup.py b/2.Common_services/4.Wowza/0_setup.py
index bd6aab86..81486e0a 100644
--- a/2.Common_services/4.Wowza/0_setup.py
+++ b/2.Common_services/4.Wowza/0_setup.py
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 import os
+import re
 
 import utils
 
@@ -53,5 +54,45 @@ def setup(interactive=True):
             'ln -sfn /home/ftp/storage/www /usr/local/WowzaStreamingEngine/content',
         ])
     utils.run_commands(cmds)
+    # Proxy for license key
+    path = '/usr/local/WowzaStreamingEngine/conf/Server.xml'
+    with open(path, 'r') as fo:
+        content = fo.read()
+    start_index = content.rfind('<Properties>')
+    if start_index < 0:
+        raise ValueError('Unexpected content in "%s". Properties section not found.' % path)
+    start_index += len('<Properties>')
+    properties = content[start_index:]
+    end_index = properties.find('</Properties>')
+    if end_index < 0:
+        raise ValueError('Unexpected content in "%s". Properties section not found.' % path)
+    properties = properties[:end_index]
+    end_index += start_index
+    http_proxy = utils.get_conf('PROXY_HTTP')
+    if http_proxy:
+        regexp = r'http(s){0,1}://(([\w_-]*)(:[\w_-]*){0,1}@){0,1}(.*)(:\d*){0,1}[/]*'
+        m = re.match(regexp, http_proxy)
+        if not m:
+            raise ValueError('Invalid value for PROXY_HTTP (value do not match reg exp: %s).' % regexp)
+        https, creds, user, pwd, host, port = m.groups()
+        if port:
+            port = port.strip(':')
+        else:
+            port = '443' if https else '80'
+        pwd = pwd.strip(':') if pwd else ''
+        user = user if user else ''
+        if not host:
+            raise ValueError('Invalid value for PROXY_HTTP (no host found using regexp: %s).' % regexp)
+        with open('%s/Proxy.xml' % dir_path, 'r') as fo:
+            proxy_tplt = fo.read()
+        new_properties = proxy_tplt % dict(user=user, pwd=pwd, host=host, port=port)
+    else:
+        new_properties = ''
+    new_properties += '\n\t\t'
+    if properties != new_properties:
+        new_content = content[:start_index] + new_properties + content[end_index:]
+        with open(path, 'w') as fo:
+            fo.write(new_content)
+        utils.log('The file "%s" has been updated.' % path)
     utils.log('Edit /usr/local/WowzaStreamingEngine/conf/admin.password to change web manager access password.')
     utils.log('Edit /usr/local/WowzaStreamingEngine/conf/Server.license to change license key.')
diff --git a/2.Common_services/4.Wowza/Proxy.xml b/2.Common_services/4.Wowza/Proxy.xml
new file mode 100644
index 00000000..690e6c99
--- /dev/null
+++ b/2.Common_services/4.Wowza/Proxy.xml
@@ -0,0 +1,18 @@
+
+			<Property>
+				<Name>licenseServerProxyAddress</Name>
+				<Value>%(host)s</Value>
+			</Property>
+			<Property>
+				<Name>licenseServerProxyPort</Name>
+				<Value>%(port)s</Value>
+				<Type>Integer</Type>
+			</Property>
+			<Property>
+				<Name>licenseServerProxyUsername</Name>
+				<Value>%(user)s</Value>
+			</Property>
+			<Property>
+				<Name>licenseServerProxyPassword</Name>
+				<Value>%(pwd)s</Value>
+			</Property>
\ No newline at end of file
diff --git a/2.Common_services/4.Wowza/live-application.xml.bak b/2.Common_services/4.Wowza/live-application.xml.bak
deleted file mode 100644
index 8653ae9c..00000000
--- a/2.Common_services/4.Wowza/live-application.xml.bak
+++ /dev/null
@@ -1,228 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Root version="1">
-	<Application>
-		<Name>live</Name>
-		<AppType>Live</AppType>
-		<Description>Default application for live streaming created when Wowza Streaming Engine is installed. Use this application with its default configuration or modify the configuration as needed. You can also copy it to create another live application.</Description>
-		<!-- Uncomment to set application level timeout values
-		<ApplicationTimeout>60000</ApplicationTimeout>
-		<PingTimeout>12000</PingTimeout>
-		<ValidationFrequency>8000</ValidationFrequency>
-		<MaximumPendingWriteBytes>0</MaximumPendingWriteBytes>
-		<MaximumSetBufferTime>60000</MaximumSetBufferTime>
-		<MaximumStorageDirDepth>25</MaximumStorageDirDepth>
-		-->
-		<Connections>
-			<AutoAccept>true</AutoAccept>
-			<AllowDomains></AllowDomains>
-		</Connections>
-		<!--
-			StorageDir path variables
-			
-			${com.wowza.wms.AppHome} - Application home directory
-			${com.wowza.wms.ConfigHome} - Configuration home directory
-			${com.wowza.wms.context.VHost} - Virtual host name
-			${com.wowza.wms.context.VHostConfigHome} - Virtual host config directory
-			${com.wowza.wms.context.Application} - Application name
-			${com.wowza.wms.context.ApplicationInstance} - Application instance name
-			
-		-->
-		<Streams>
-			<StreamType>live</StreamType>
-			<StorageDir>${com.wowza.wms.context.VHostConfigHome}/content</StorageDir>
-			<KeyDir>${com.wowza.wms.context.VHostConfigHome}/keys</KeyDir>
-			<!-- LiveStreamPacketizers (separate with commas): cupertinostreamingpacketizer, smoothstreamingpacketizer, sanjosestreamingpacketizer, mpegdashstreamingpacketizer, cupertinostreamingrepeater, smoothstreamingrepeater, sanjosestreamingrepeater, mpegdashstreamingrepeater -->
-			<LiveStreamPacketizers>cupertinostreamingpacketizer, mpegdashstreamingpacketizer, sanjosestreamingpacketizer, smoothstreamingpacketizer</LiveStreamPacketizers>
-			<!-- Properties defined here will override any properties defined in conf/Streams.xml for any streams types loaded by this application -->
-			<Properties>
-			</Properties>
-		</Streams>
-		<Transcoder>
-			<!-- To turn on transcoder set to: transcoder -->
-			<LiveStreamTranscoder></LiveStreamTranscoder>
-			<!-- [templatename].xml or ${SourceStreamName}.xml -->
-			<Templates>${SourceStreamName}.xml,transrate.xml</Templates>
-			<ProfileDir>${com.wowza.wms.context.VHostConfigHome}/transcoder/profiles</ProfileDir>
-			<TemplateDir>${com.wowza.wms.context.VHostConfigHome}/transcoder/templates</TemplateDir>
-			<Properties>
-			</Properties>
-		</Transcoder>
-		<DVR>
-			<!-- As a single server or as an origin, use dvrstreamingpacketizer in LiveStreamPacketizers above -->
-			<!-- Or, in an origin-edge configuration, edges use dvrstreamingrepeater in LiveStreamPacketizers above -->
-			<!-- As an origin, also add dvrchunkstreaming to HTTPStreamers below -->
-			<!-- If this is a dvrstreamingrepeater, define Application/Repeater/OriginURL to point back to the origin -->
-			<!-- To turn on DVR recording set Recorders to dvrrecorder.  This works with dvrstreamingpacketizer  -->
-			<Recorders></Recorders>
-			<!-- As a single server or as an origin, set the Store to dvrfilestorage-->
-			<!-- edges should have this empty -->
-			<Store></Store>
-			<!--  Window Duration is length of live DVR window in seconds.  0 means the window is never trimmed. -->
-			<WindowDuration>0</WindowDuration>
-			<!-- Storage Directory is top level location where dvr is stored.  e.g. c:/temp/dvr -->
-			<StorageDir>${com.wowza.wms.context.VHostConfigHome}/dvr</StorageDir>
-			<!-- valid ArchiveStrategy values are append, version, delete -->
-			<ArchiveStrategy>append</ArchiveStrategy>
-			<!-- Properties for DVR -->
-			<Properties>
-			</Properties>
-		</DVR>
-		<TimedText>
-			<!-- VOD caption providers (separate with commas): vodcaptionprovidermp4_3gpp, vodcaptionproviderttml, vodcaptionproviderwebvtt,  vodcaptionprovidersrt, vodcaptionproviderscc -->
-			<VODTimedTextProviders></VODTimedTextProviders>
-			<!-- Properties for TimedText -->
-			<Properties>
-			</Properties>
-		</TimedText>
-		<!-- HTTPStreamers (separate with commas): cupertinostreaming, smoothstreaming, sanjosestreaming, mpegdashstreaming, dvrchunkstreaming -->
-		<HTTPStreamers>cupertinostreaming, smoothstreaming, sanjosestreaming, mpegdashstreaming</HTTPStreamers>
-		<MediaCache>
-			<MediaCacheSourceList></MediaCacheSourceList>
-		</MediaCache>
-		<SharedObjects>
-			<StorageDir>${com.wowza.wms.context.VHostConfigHome}/applications/${com.wowza.wms.context.Application}/sharedobjects/${com.wowza.wms.context.ApplicationInstance}</StorageDir>
-		</SharedObjects>
-		<Client>
-			<IdleFrequency>-1</IdleFrequency>
-			<Access>
-				<StreamReadAccess>*</StreamReadAccess>
-				<StreamWriteAccess>*</StreamWriteAccess>
-				<StreamAudioSampleAccess></StreamAudioSampleAccess>
-				<StreamVideoSampleAccess></StreamVideoSampleAccess>
-				<SharedObjectReadAccess>*</SharedObjectReadAccess>
-				<SharedObjectWriteAccess>*</SharedObjectWriteAccess>
-			</Access>
-		</Client>
-		<RTP>
-			<!-- RTP/Authentication/[type]Methods defined in Authentication.xml. Default setup includes; none, basic, digest -->
-			<Authentication>
-				<PublishMethod>digest</PublishMethod>
-				<PlayMethod>none</PlayMethod>
-			</Authentication>
-			<!-- RTP/AVSyncMethod. Valid values are: senderreport, systemclock, rtptimecode -->
-			<AVSyncMethod>senderreport</AVSyncMethod>
-			<MaxRTCPWaitTime>12000</MaxRTCPWaitTime>
-			<IdleFrequency>75</IdleFrequency>
-			<RTSPSessionTimeout>90000</RTSPSessionTimeout>
-			<RTSPMaximumPendingWriteBytes>0</RTSPMaximumPendingWriteBytes>
-			<RTSPBindIpAddress></RTSPBindIpAddress>
-			<RTSPConnectionIpAddress>0.0.0.0</RTSPConnectionIpAddress>
-			<RTSPOriginIpAddress>127.0.0.1</RTSPOriginIpAddress>
-			<IncomingDatagramPortRanges>*</IncomingDatagramPortRanges>
-			<!-- Properties defined here will override any properties defined in conf/RTP.xml for any depacketizers loaded by this application -->
-			<Properties>
-			</Properties>
-		</RTP>
-		<MediaCaster>
-			<RTP>
-				<RTSP>
-					<!-- udp, interleave -->
-					<RTPTransportMode>interleave</RTPTransportMode>
-				</RTSP>
-			</RTP>
-			<StreamValidator>
-				<Enable>true</Enable>
-				<ResetNameGroups>true</ResetNameGroups>
-				<StreamStartTimeout>20000</StreamStartTimeout>
-				<StreamTimeout>12000</StreamTimeout>
-				<VideoStartTimeout>0</VideoStartTimeout>
-				<VideoTimeout>0</VideoTimeout>
-				<AudioStartTimeout>0</AudioStartTimeout>
-				<AudioTimeout>0</AudioTimeout>
-				<VideoTCToleranceEnable>false</VideoTCToleranceEnable>
-				<VideoTCPosTolerance>3000</VideoTCPosTolerance>
-				<VideoTCNegTolerance>-500</VideoTCNegTolerance>
-				<AudioTCToleranceEnable>false</AudioTCToleranceEnable>
-				<AudioTCPosTolerance>3000</AudioTCPosTolerance>
-				<AudioTCNegTolerance>-500</AudioTCNegTolerance>
-				<DataTCToleranceEnable>false</DataTCToleranceEnable>
-				<DataTCPosTolerance>3000</DataTCPosTolerance>
-				<DataTCNegTolerance>-500</DataTCNegTolerance>
-				<AVSyncToleranceEnable>false</AVSyncToleranceEnable>
-				<AVSyncTolerance>1500</AVSyncTolerance>
-				<DebugLog>false</DebugLog>
-			</StreamValidator>
-			<!-- Properties defined here will override any properties defined in conf/MediaCasters.xml for any MediaCasters loaded by this applications -->
-			<Properties>
-			</Properties>
-		</MediaCaster>
-		<MediaReader>
-			<!-- Properties defined here will override any properties defined in conf/MediaReaders.xml for any MediaReaders loaded by this applications -->
-			<Properties>
-			</Properties>
-		</MediaReader>
-		<MediaWriter>
-			<!-- Properties defined here will override any properties defined in conf/MediaWriter.xml for any MediaWriter loaded by this applications -->
-			<Properties>
-			</Properties>
-		</MediaWriter>
-		<LiveStreamPacketizer>
-			<!-- Properties defined here will override any properties defined in conf/LiveStreamPacketizers.xml for any LiveStreamPacketizers loaded by this applications -->
-			<Properties>
-				<Property>
-					<Name>cupertinoChunkDurationTarget</Name>
-					<Value>2000</Value>
-					<Type>Integer</Type>
-				</Property>
-				<Property>
-					<Name>httpRandomizeMediaName</Name>
-					<Value>true</Value>
-					<Type>Boolean</Type>
-				</Property>
-			</Properties>
-		</LiveStreamPacketizer>
-		<HTTPStreamer>
-			<!-- Properties defined here will override any properties defined in conf/HTTPStreamers.xml for any HTTPStreamer loaded by this applications -->
-			<Properties>
-			</Properties>
-		</HTTPStreamer>
-		<Manager>
-			<!-- Properties defined are used by the Manager -->
-			<Properties>
-			</Properties>
-		</Manager>
-		<Repeater>
-			<OriginURL></OriginURL>
-			<QueryString><![CDATA[]]></QueryString>
-		</Repeater>
-		<StreamRecorder>
-			<Properties>
-			</Properties>
-		</StreamRecorder>
-		<Modules>
-			<Module>
-				<Name>base</Name>
-				<Description>Base</Description>
-				<Class>com.wowza.wms.module.ModuleCore</Class>
-			</Module>
-			<Module>
-				<Name>logging</Name>
-				<Description>Client Logging</Description>
-				<Class>com.wowza.wms.module.ModuleClientLogging</Class>
-			</Module>
-			<Module>
-				<Name>flvplayback</Name>
-				<Description>FLVPlayback</Description>
-				<Class>com.wowza.wms.module.ModuleFLVPlayback</Class>
-			</Module>
-			<Module>
-				<Name>ModuleSecureUrlParams</Name>
-				<Description>Legacy security</Description>
-				<Class>com.wowza.wms.security.ModuleSecureURLParams</Class>
-			</Module>
-		</Modules>
-		<!-- Properties defined here will be added to the IApplication.getProperties() and IApplicationInstance.getProperties() collections -->
-		<Properties>
-			<Property>
-				<Name>securityPublishRequirePassword</Name>
-				<Value>false</Value>
-				<Type>Boolean</Type>
-			</Property>
-			<Property>
-				<Name>secureurlparams.publish</Name>
-				<Value>{{ live_pwd }}.doPublish</Value>
-				<Type>String</Type>
-			</Property>
-		</Properties>
-	</Application>
-</Root>
diff --git a/2.Common_services/4.Wowza/wowza-update.sh.back b/2.Common_services/4.Wowza/wowza-update.sh.back
deleted file mode 100755
index f4877291..00000000
--- a/2.Common_services/4.Wowza/wowza-update.sh.back
+++ /dev/null
@@ -1,163 +0,0 @@
-#!/bin/bash
-
-SELF=$( basename $0 )
-usage () {
-  cat >&2 <<EOF
-usage: $SELF [-h] [-f] wowza-archive
-  -h, --help       This help message!
-  -f, --force      Disable dry run mode (default is enabled).
-                   Use this to really run command(s) instead of print them.
-
-  -x, --extract    ONLY extract Debian package from official binary archive.
-
-  wowza-archive    Could be (local or remote):
-                   - an official binary archive from Wowza Media Systems, or
-                   - a Debian package extracted from official binary archive.
-
-  http://www.wowza.com/downloads/WowzaStreamingEngine-4-1-2/WowzaStreamingEngine-4.1.2.deb.bin
-    or
-  http://ubicast.eu/medias/downloads/packages/WowzaStreamingEngine-4.1.2.deb.bin
-    or
-  ./WowzaStreamingEngine-4.1.2.deb
-EOF
-  exit 1
-}
-
-check_root () {
-  if [ $( id -u ) -ne 0 ]; then
-    echo "This script MUST be run as root." >&2
-    echo "Try: sudo $0 $@" >&2
-    exit 1
-  fi
-}
-
-error () {
-  echo "Error: $1" >&2
-  exit 1
-}
-
-DRYRUN=1
-run () {
-  case "$DRYRUN" in
-    0) "$@" ;;
-    1) echo "$@" >&2 ;;
-  esac
-  return $?
-}
-
-exit_script () {
-  if [ "$DRYRUN" = "1" ]; then
-    echo "Warning: Dry run is enabled. Use '-f' to really run commands." >&2
-  fi
-  exit $1
-}
-
-parse () {
-  while [ -n "$1" ]; do
-    case "$1" in
-      -h|--help)  usage ;;
-      -f|--force) DRYRUN=0 ;;
-      -x|--extract) ONLY_EXTRACT='yes' ;;
-      *) WOWZA_SRC="$1" ;;
-    esac
-    shift
-  done
-  [ -n "$WOWZA_SRC" ] || usage
-}
-
-is_url () {
-  echo "$1" | grep -q '^https\?://.*'
-}
-
-get_url () {
-  run wget -q "$1" -O "$2"
-  [ $? -eq 0 ] || error "Error: Could not download $1"
-}
-
-is_debian_pkg () {
-  file "$1" | grep -q '.*: Debian binary package .*'
-}
-
-stop_wowza () {
-  run /etc/init.d/WowzaStreamingEngineManager stop
-  run /etc/init.d/WowzaStreamingEngine stop
-}
-
-start_wowza () {
-  run /etc/init.d/WowzaStreamingEngine start
-  run /etc/init.d/WowzaStreamingEngineManager start
-}
-
-get_wowza_path () {
-  [ -e "$1" -a -L "$1" ] && readlink -f "$1"
-}
-
-WOWZA_DEB_OFFSET=1410
-extract_wowza_deb () {
-  run /bin/sh -c "tail -n +$WOWZA_DEB_OFFSET $1 > $2"
-  [ $? -eq 0 ] || error "Could not extract Debian package from $1"
-}
-
-install_wowza_deb () {
-  run dpkg --install "$1"
-  [ $? -eq 0 ] || error "Could not install Debian package $1"
-}
-
-# Preambule
-parse $@
-[ "$DRYRUN" = "0" -a -z "$ONLY_EXTRACT" ] && check_root $@
-
-# Get Wowza archive from url
-if is_url "$WOWZA_SRC"; then
-  WOWZA_TMP="${WOWZA_SRC##*/}"
-  get_url "$WOWZA_SRC" "$WOWZA_TMP"
-elif [ -f "$WOWZA_SRC" ]; then
-  WOWZA_TMP="$WOWZA_SRC"
-else
-  error "$WOWZA_SRC is not a regular file."
-fi
-
-# Extract Debian package from Wowza binary archive
-if ! is_debian_pkg "$WOWZA_TMP"; then
-  WOWZA_DEB="${WOWZA_TMP%.deb.bin}.deb"
-  extract_wowza_deb "$WOWZA_TMP" "$WOWZA_DEB"
-  [ "$WOWZA_SRC" != "$WOWZA_TMP" ] && run rm -f "$WOWZA_TMP"
-  [ -n "$ONLY_EXTRACT" ] && exit_script 0
-else
-  WOWZA_DEB="$WOWZA_TMP"
-fi
-
-# Search previous version
-WOWZA_SYMLINK='/usr/local/WowzaStreamingEngine'
-WOWZA_CURRENT="$( get_wowza_path "$WOWZA_SYMLINK" )"
-[ -n "$WOWZA_CURRENT" ] || error "Could not found previous install of Wowza."
-
-# Stop Wowza services
-stop_wowza
-
-# Install new version
-install_wowza_deb "$WOWZA_DEB"
-[ "$WOWZA_TMP" != "$WOWZA_DEB" ] && run rm -f "$WOWZA_DEB"
-
-if [ "$DRYRUN" = "0" ]; then
-  WOWZA_NEW="$( get_wowza_path "$WOWZA_SYMLINK" )"
-  if [ -n "$WOWZA_NEW" -a "$WOWZA_NEW" != "$WOWZA_CURRENT" ]; then
-    echo "$( basename "$WOWZA_CURRENT" ) -> $( basename "$WOWZA_NEW" )" >&2
-  else
-    error "Wowza update failed!"
-  fi
-fi
-
-# Restore configuration of previous version
-run cp -a "$WOWZA_CURRENT/conf/" "$WOWZA_SYMLINK/"
-run cp -a "$WOWZA_CURRENT/applications/" "$WOWZA_SYMLINK/"
-if [ -d "/home/ftp/storage/www" ]; then
-  [ -d "$WOWZA_SYMLINK/content" ] && run rm -rf "$WOWZA_SYMLINK/content"
-  run ln -s "/home/ftp/storage/www" "$WOWZA_SYMLINK/content"
-fi
-
-# Restart Wowza services
-start_wowza
-
-exit_script 0
-
diff --git a/20.Client_configuration/1.Apply_client_configuration/0_setup.sh b/20.Client_configuration/1.Apply_client_configuration/0_setup.sh
index c57465cf..6317dc12 100755
--- a/20.Client_configuration/1.Apply_client_configuration/0_setup.sh
+++ b/20.Client_configuration/1.Apply_client_configuration/0_setup.sh
@@ -38,79 +38,6 @@ echo "server ${NTP_SERVER3}" >> /etc/ntp.conf
 fi
 service ntp restart
 
-# proxy
-if [ ${PROXY} = "1" ]
-then
-	if [ ${PROXY_AUTHENTICATION} = "1" ]
-	then
-	# APT
-	echo "Acquire::http::Proxy \"http://${PROXY_USER}:${PROXY_PWD}@${PROXY_HTTP}:${PROXY_PORT}\";" > /etc/apt/apt.conf.d/proxy
-	echo "Acquire::https::Proxy \"http://${PROXY_USER}:${PROXY_PWD}@${PROXY_HTTP}:${PROXY_PORT}\";" >> /etc/apt/apt.conf.d/proxy
-	# /etc/environment
-	echo "http_proxy=\"http://${PROXY_USER}:${PROXY_PWD}@${PROXY_HTTP}:${PROXY_PORT}\"" >> /etc/environment
-	echo "https_proxy=\"http://${PROXY_USER}:${PROXY_PWD}@${PROXY_HTTP}:${PROXY_PORT}\"" >> /etc/environment
-	else
-	# APT
-	echo "Acquire::http::Proxy \"http://${PROXY_HTTP}:${PROXY_PORT}\";" > /etc/apt/apt.conf.d/proxy
-	echo "Acquire::https::Proxy \"http://${PROXY_HTTP}:${PROXY_PORT}\";" >> /etc/apt/apt.conf.d/proxy
-	# /etc/environment
-	echo "http_proxy=\"http://${PROXY_HTTP}:${PROXY_PORT}\"" >> /etc/environment
-	echo "https_proxy=\"http://${PROXY_HTTP}:${PROXY_PORT}\"" >> /etc/environment
-	fi
-fi
-
-# MS specific
-if ( test -d /usr/local/WowzaStreamingEngine )
-then
-if [ ${PROXY} = "1" ]
-then
-# wowza
-NB=$(grep -n 'Properties defined here will be added to the IServer.getProperties()' /usr/local/WowzaStreamingEngine/conf/Server.xml | awk -F ":" '{print$1}')
-NB_1=$(( ${NB} + 1 ))
-NB_MAX=$(wc -l /usr/local/WowzaStreamingEngine/conf/Server.xml | awk '{print$1}')
-	if [ ${PROXY_AUTHENTICATION} = "1" ]
-	then
-	sed -i "${NB_1},${NB_MAX}d" /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Properties>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Name>licenseServerProxyAddress</Name>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Value>${PROXY_HTTP}</Value>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "</Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Name>licenseServerProxyPort</Name>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Value>${PROXY_PORT}</Value>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Type>Integer</Type>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "</Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Name>licenseServerProxyUsername</Name>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Value>${PROXY_USER}</Value>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "</Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Name>licenseServerProxyPassword</Name>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Value>${PROXY_PWD}</Value>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "</Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "</Properties>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "</Server>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "</Root>	" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	else
-	sed -i "${NB_1},${NB_MAX}d" /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Properties>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Name>licenseServerProxyAddress</Name>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Value>${PROXY_HTTP}</Value>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "</Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Name>licenseServerProxyPort</Name>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Value>${PROXY_PORT}</Value>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "<Type>Integer</Type>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "</Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "</Properties>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "</Server>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	echo "</Root>	" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
-	fi
-fi
-fi
-
 # set email sender
 if ( ! test -z ${EMAIL_SENDER} )
 then
diff --git a/3.New_server_deployment/3.Initialize_APT/0_setup.sh b/3.New_server_deployment/3.Initialize_APT/0_setup.sh
index d6367d11..f47a48d4 100755
--- a/3.New_server_deployment/3.Initialize_APT/0_setup.sh
+++ b/3.New_server_deployment/3.Initialize_APT/0_setup.sh
@@ -9,17 +9,6 @@ if ( ! test -z ${APT_CACHE_HOST} ); then
 	fi
 fi
 
-# APT proxy
-if [ "${PROXY}" = "1" ]; then
-	if [ "${PROXY_AUTHENTICATION}" = "1" ]; then
-		# general settings
-		echo "Proxy: http://${PROXY_USER}:${PROXY_PWD}@${PROXY_HTTP}:${PROXY_PORT}" >> /etc/apt-cacher-ng/acng.conf
-	else
-		# general settings
-		echo "Proxy: http://${PROXY_HTTP}:${PROXY_PORT}" >> /etc/apt-cacher-ng/acng.conf
-	fi
-fi
-
 # migrate to Ubuntu 16.04 / apply sources.list
 if ( rgrep '14.04' /etc/lsb-release >/dev/null ); then
 	echo "Upgrading to Ubuntu 16.04."
@@ -27,7 +16,7 @@ if ( rgrep '14.04' /etc/lsb-release >/dev/null ); then
 	apt-get dist-upgrade -y
 	cp sources16.list /etc/apt/sources.list
 	apt-get update
-	DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get dist-upgrade -o Dpkg::Options::="--force-confold" --force-yes -y
+	DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -o Dpkg::Options::="--force-confold" --force-yes -y
 	apt-get install -f -y
 	apt-get dist-upgrade -y
 else
diff --git a/global-conf.sh b/global-conf.sh
index 7a053922..da2822ab 100644
--- a/global-conf.sh
+++ b/global-conf.sh
@@ -82,13 +82,9 @@ NETWORK_DNS2=0
 NETWORK_MASK=0
 NETWORK_GATEWAY=0
 # proxy
-PROXY=0
-PROXY_AUTHENTICATION=0
 PROXY_HTTP=
 PROXY_HTTPS=
-PROXY_PORT=
-PROXY_USER=
-PROXY_PWD=
+PROXY_EXCLUDE=
 
 # -- Backup server specific (burp) --
 BURP_STATUS_IP=
diff --git a/launcher.sh b/launcher.sh
index 8e82689c..dc38bc30 100755
--- a/launcher.sh
+++ b/launcher.sh
@@ -24,6 +24,7 @@ init() {
     python3 /root/envsetup/envsetup.py 11
     python3 /root/envsetup/envsetup.py 12
     python3 /root/envsetup/envsetup.py 13
+    python3 /root/envsetup/envsetup.py 14
 
     python3 /root/envsetup/envsetup.py 21
     python3 /root/envsetup/envsetup.py 22
-- 
GitLab