Granularere Proxy-Config möglich?

Granularere Proxy-Config möglich?

Postby DukeSniper » 11.07.2016, 09:17

Moin...

Wäre es möglich, eine Config-Option einzubinden, mit der man festlegt, dass - wenn ein WSUS konfiguriert ist - der Proxy nur für Internet-Zugriff genutzt wird? Momentan wird der Proxy entweder ganz oder gar nicht genutzt, was in folgendem Konstrukt etwas kontraproduktiv ist.

Image

Denn obwohl die Updates auf dem Downstream-WSUS vorhanden sind und per GBit gezogen werden könnten, wird immer der Proxy verwendet, so dass - je nach Auslastung der VPN-Strecke - das extrem langsam werden kann. Keinen Proxy zu setzen fällt aber auch aus, weil ja dann die WSUSSCN2.CAB nicht geladen werden kann...
Attachments
Network Diagram.png
(47.14 KiB) Not downloaded yet
DukeSniper
 

Re: Granularere Proxy-Config möglich?

Postby hbuhrmester » 11.07.2016, 18:09

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 Systemsteuerung

Das 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 aria2

Fü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.cmd

Wenn 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
hbuhrmester
 
Posts: 525
Joined: 11.10.2013, 20:59

Re: Granularere Proxy-Config möglich?

Postby WSUSUpdateAdmin » 12.07.2016, 13:44

Moin!

DukeSniper wrote:[...]Wäre es möglich, eine Config-Option einzubinden, mit der man festlegt, dass - wenn ein WSUS konfiguriert ist - der Proxy nur für Internet-Zugriff genutzt wird? Momentan wird der Proxy entweder ganz oder gar nicht genutzt, was in folgendem Konstrukt etwas kontraproduktiv ist.

Das stimmt nicht (Zeile 1470):
Code: Select all
%DLDR_PATH% %DLDR_COPT% %DLDR_NVOPT% --no-proxy %DLDR_POPT% ..\client\%1\%2 %DLDR_LOPT% %%l

Werden Updates vom lokalen WSUS geladen, wird der Proxy (in der Standardkonfiguration) nicht verwendet!

Gruß
Torsten Wittrock
WSUSUpdateAdmin
Administrator
 
Posts: 2245
Joined: 07.07.2009, 14:38


Return to Anregungen / Suggestions

Who is online

Users browsing this forum: No registered users and 34 guests