Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a really simple Q. I just need to know how to specify an http proxy (with login credentials) within debian. The squid server is a separate machine, and since the proxy got implemented our web services and backups on the dev server arn't working. so basically i just need to specify an http proxy within debian...

share|improve this question

4 Answers 4

You may want to can create an environnement variable 'http_proxy' throught your .bashrc script and assign it the value like:

export http_proxy=http://login:pass@xxx.xxx.xxx.xxx:3128

There's also manual settings to to with the web browser but for apt-get edit your /etc/apt/apt.conf and add:

use Acquire::http::Proxy "http://login:pass@xxx.xxx.xxx.xxx:3128";

EDIT: You may wish to look at the following article to setup iptables tor edirect the traffic to your proxy: http://www.tldp.org/HOWTO/TransparentProxy-6.html

share|improve this answer
    
what if nobody logs in? I need it to be as transparent as possible, this is our web dev server, most users don't login they just access shares via samba.. –  Bananagram Jul 7 '09 at 7:01
    
I suspect i need to use iptables? –  Bananagram Jul 7 '09 at 7:02
    
http_port xxx.xxx.xxx.xxx:3128 transparent, add this in squid.conf –  Caterpillar Jul 7 '09 at 7:08

Transparent http traffic routing

# Your debian machine (gateway)
LAN_IP="192.168.0.1"

# Your network
LAN_IP_RANGE="192.168.0.0/24"                                                               

# Your squid machine
PROXY_IP="192.168.0.254"                                                                   
PROXY_PORT="3128"

iptables -t mangle -A PREROUTING -s $LAN_IP_RANGE ! -d $LAN_IP_RANGE -p TCP --destination-port 80 -j MARK --set-mark 11                                     
iptables -t nat -A PREROUTING -m mark --mark 11 -p TCP -j DNAT --to-destination ${PROXY_IP}:${PROXY_PORT}                                                          
iptables -t nat -A POSTROUTING -m mark --mark 11 -p TCP -j SNAT --to-source $LAN_IP
share|improve this answer

Transparent proxying CANNOT be done with login credentials. Think about it; if the user doesn't know it's going on, then you can't expect them to engage in a username/password exchange!

share|improve this answer

Hi This may help you. Try this.

Add this in /etc/squid.conf

auth_param basic program /usr/lib/squid/getpwnam_auth /etc/passwd auth_param basic children 5 auth_param basic realm Squid Proxy Cacheing Server auth_param basic creddentialsttl 1 hour

I have also been advised to enter the acl:

acl password proxy_auth REQUIRED http_access allow password

One site has stated that you need the entry:

authentication_program /usr/lib/squid/getpwnam_auth

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.