Archiv:Tinyproxy
Einleitung
Dieser Artikel basiert auf dem Tutorial von der_Typ aus dem Synology Forum
Voraussetzungen
- Zugriff auf das NAS per Kommandozeile muss aktiviert sein
- IPKG muss installiert sein
Installation/Konfiguration
ipkg install tinyproxy
Aktuell (April 2012) ist über IPKG die Version 1.8.2-1 verfügbar.
Startup Script erstellen
Da die IPKG-Installation kein eigenes start-stop-Script enthält muss selbst eines erstellt werden. Dazu im Editor eurer Wahl (Ich verwende gerne Nano) folgen Code unter /opt/etc/init.d/S80tinyproxy speichern.
#!/bin/sh TINYD="/opt/sbin/tinyproxy" case $1 in start) echo "Starting tinyproxy" ${TINYD} >/dev/null 2>&1 echo "done" ;; stop) PID=`cat /var/run/tinyproxy.pid` `kill ${PID}` echo "Stopping tinyproxy ${PID}" ;; restart) $0 stop $0 start ;; *) echo "Usages: $0 [start|stop|restart]" ;; esac
Falls der Aufruf von tinyproxy -d
die Meldungen
tinyproxy: Could not create file /opt/var/log/tinyproxy/tinyproxy.log: No such file or directory tinyproxy: Could not create file /opt/var/run/tinyproxy/tinyproxy.pid: No such file or directory tinyproxy: Could not create PID file.
ausgibt müssen die betreffenden Verzeichnisse noch erstellt werden. Kommt die Meldung
tinyproxy: Could not create file /opt/var/log/tinyproxy/tinyproxy.log: Permission denied tinyproxy: Could not create file /opt/var/run/tinyproxy/tinyproxy.pid: Permission denied tinyproxy: Could not create PID file.
Müssen die Verzeichnisse tinyproxy
noch dem in dem Benutzer übereignet werden der in der Datei tinyproxy.conf
angegeben wurde (default nobody).
Tinyproxy Konfiguration anpassen
Als letzter Schritt muss noch die Datei /opt/etc/tinyproxy.conf
angepasst werden.
Folgende Zeilen habe ich geändert:
# # Name of the user the tinyproxy daemon should switch to after the port # has been bound. # User admin ///Hier einen User eintragen der auf der DS vorhanden ist (zb. Admin) Group users ///Hier die entsprechende Gruppe eintragen # # Port to listen on. # Port xxxx ///Den gewünschten Port eintragen # # This is the absolute highest number of threads which will be created. In # other words, only MaxClients number of clients can be connected at the # same time. # MaxClients 10 ///Hier die maximal erwünschten User eintragen # # The following is the authorization controls. If there are any access # control keywords then the default action is to DENY. Otherwise, the # default action is ALLOW. # # Also the order of the controls are important. The incoming connections # are tested against the controls based on order. # #Allow 127.0.0.1 /// Hier kann eine Zugriffsberechtigung für betimmte IPs bzw IP-Ranges vergeben werden #Allow 192.168.1.0/25 /// Ich habe alles auskommentiert, dass entspricht einem Allow all # # The "Via" header is required by the HTTP RFC, but using the real host name # is a security concern. If the following directive is enabled, the string # supplied will be used as the host name in the Via header; otherwise, the # server's host name will be used. # ViaProxyName "tinyproxy" ///Hier den gewünschten Servernamen angeben (wird zb. für die Error-Messages verwendet)
Firewall der DS anpassen
Falls Ihr die Firewall auf der DS aktiviert habt müsst Ihr natürlich noch den entsprechenden Port freigeben. Das gilt auch für Router-Firewalls.
Testlauf
Nun könnt Ihr eure DS neustarten und dann sollte der Tinyproxy laufen. Überprüfen kann man das entweder im Terminal mit
ps -e<PID>
oder man versucht einfach mal die lokale IP der DS und den entsprechenden Port als Proxy im Browser einzustellen. Falls der Proxy nicht starten sollte kann man versuchen über die Konsole mit
tinyproxy -d <PID>
in den Debug-Mode zu wechseln um eventuell auftretende Fehler zu erkennen.