Eine genaue Proxy-Konfiguration ist mithilfe von Umgebungsvariablen möglich: http_proxy, https_proxy und no_proxy.
Die info-Seite von wget führt dazu aus:
- Code: Select all
Wget supports proxies for both HTTP and FTP retrievals. The
standard way to specify proxy location, which Wget recognizes, is using
the following environment variables:
`http_proxy'
`https_proxy'
If set, the `http_proxy' and `https_proxy' variables should
contain the URLs of the proxies for HTTP and HTTPS connections
respectively.
`ftp_proxy'
This variable should contain the URL of the proxy for FTP
connections. It is quite common that `http_proxy' and `ftp_proxy'
are set to the same URL.
`no_proxy'
This variable should contain a comma-separated list of domain
extensions proxy should _not_ be used for. For instance, if the
value of `no_proxy' is `.mit.edu', proxy will not be used to
retrieve documents from MIT.
Entsprechend führt die man-Seite für aria2 aus:
- Code: Select all
ENVIRONMENT
aria2 recognizes the following environment variables.
http_proxy [http://][USER:PASSWORD@]HOST[:PORT]
Specify proxy server for use in HTTP. Overrides http-proxy
value in configuration file. The command-line option
--http-proxy overrides this value.
https_proxy [http://][USER:PASSWORD@]HOST[:PORT]
Specify proxy server for use in HTTPS. Overrides https-proxy
value in configuration file. The command-line option
--https-proxy overrides this value.
ftp_proxy [http://][USER:PASSWORD@]HOST[:PORT]
Specify proxy server for use in FTP. Overrides ftp-proxy value
in configuration file. The command-line option --ftp-proxy
overrides this value.
all_proxy [http://][USER:PASSWORD@]HOST[:PORT]
Specify proxy server for use if no protocol-specific proxy is
specified. Overrides all-proxy value in configuration file.
The command-line option --all-proxy overrides this value.
Note Although aria2 accepts ftp:// and https:// scheme in proxy URI,
it simply assumes that http:// is specified and does not change
its behavior based on the specified scheme.
no_proxy [DOMAIN,...]
Specify comma-separated hostname, domains and network address
with or without CIDR block to which proxy should not be used.
Overrides no-proxy value in configuration file. The com‐
mand-line option --no-proxy overrides this value.
Diese Umgebungsvariablen werden auch von anderen Programmen verwendet: Firefox, Chrome, Internet Explorer.
Mit der Variablen no_proxy kann man Ausnahmen definieren, die direkt aufgerufen werden sollen. Das sind üblicherweise Server im lokalen Netzwerk.
Man kann die Umgebungsvariablen an mehreren Stellen definieren:
Global in der Umgebung, zum Beispiel mit dem Kontrollfeld System in der SystemsteuerungDas ist keine schlechte Lösung, denn wenn man einen Proxy-Server verwendet, muss man ihn für
alle Programme konfigurieren. Das geht am einfachsten in der globalen Umgebung.
In den Einstellungsdateien für wget oder aria2Für wget kann man eine Einstellungsdatei ~/.wgetrc unter Linux oder C:\Users\Benutzername\.wgetrc für Windows erstellen mit dem Inhalt:
- Code: Select all
http_proxy = http://192.168.1.1:3128
https_proxy = http://192.168.1.1:3128
no_proxy = 192.168.1.2
In diesem Beispiel hat der Proxy-Server die Adresse
http://192.168.1.1:3128 und der WSUS-Server die Adresse
http://192.168.1.2 . Für Downloads vom lokalen WSUS-Server wird dann kein Proxy verwendet, für Adressen wie
http://download.windowsupdate.com aber schon.
Wenn man die Variable https_proxy definiert, hat das den zusätzlichen Vorteil, dass auch das veraltete wget aus WSUS Offline Update
verschlüsselte Verbindungen zum Internet aufbauen kann. Die Verbindung zum Proxy-Server bleibt dabei unverschlüsselt, aber der Proxy-Server kann die https-URL übernehmen und dann eine verschlüsselte Verbindung aufbauen.
Lokal im Skript DownloadUpdates.cmdWenn man die Änderung auf das Skript DownloadUpdates.cmd begrenzen will, muss man die Variable no_proxy nach der Zeile setlocal einfügen:
- Code: Select all
setlocal enableextensions enabledelayedexpansion
if errorlevel 1 goto NoExtensions
set no_proxy=192.168.1.2
Viele Grüße,
Hartmut