Websense: the squid-proxy solution
Some people have asked about problems with websense blocking legitimate technical content on the web. I have used this solution to this problem for years. I do not condone trying to outsmart your employer's IT people. However, I believe that productivity is important.
I use the following python script to setup the proxy. Replace internal_ip_addr and external_ip_addr with the appropriate IP addresses for your network. You also may need ssh_port if you're like me and you run ssh on a high numbered port. If not, you can remove the -p. You'll need to apt-get a few things like PyQt to make this work, else you can remove them and make it run daemon mode. I'm a GUI guy so that is beyond the scope of this document.
- On your home machine: sudo apt-get install squid-proxy
- This will put the squid proxy on port 3128. Additional configuration may be required but is beyond the scope of this document.
- On your work machine: ssh -L 3128:internal_ip_address_of_the_machine_hosting_the_proxy:3128 -p ssh_port username@external_ip_address_of_the_machine_hosting_the_proxy
- On your work machine: Set firefox to proxy to localhost:3128 for everything. This means that firefox is talking to the port forwarding SSH tunnel that we setup in step #3 on the local machine which then sends the traffic over the tunnel to the squid proxy on the remote end.
I use the following python script to setup the proxy. Replace internal_ip_addr and external_ip_addr with the appropriate IP addresses for your network. You also may need ssh_port if you're like me and you run ssh on a high numbered port. If not, you can remove the -p. You'll need to apt-get a few things like PyQt to make this work, else you can remove them and make it run daemon mode. I'm a GUI guy so that is beyond the scope of this document.
import os
import popen2
import sys
from PyQt4.Qt import *
import signal
process = None
def on_start_clicked():
global process
print 'clicked start'
ok = 0
tup = QInputDialog.getText(w, 'SSH Password', 'password', QLineEdit.Password)
if tup[1] and not tup[0].isEmpty():
process = popen2.Popen3('sshpass -p ' + str(tup[0]) +
' ssh -L 3128:interal_ip_addr:3128 -p ssh_port david@external_ip_addr')
print process.pid + 2
def on_stop_clicked():
global process
print 'clicked stop'
if process:
os.kill(process.pid + 2, signal.SIGKILL)
a=QApplication(sys.argv)
w = QWidget()
gl = QGridLayout()
w.setLayout(gl)
start = QPushButton('start')
stop = QPushButton('stop')
gl.addWidget(start)
gl.addWidget(stop)
w.connect(start, SIGNAL('clicked()'), on_start_clicked)
w.connect(stop, SIGNAL('clicked()'), on_stop_clicked)
w.show()
a.exec_()



0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home