<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sohail Riaz, Linux and Open Source Blog &#187; Proxy</title>
	<atom:link href="http://www.sohailriaz.com/category/proxy/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sohailriaz.com</link>
	<description>Sohail Riaz, Linux and Open Source Blog</description>
	<lastBuildDate>Sat, 17 Jul 2010 07:38:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>HowTo SSH outside using Authenticated Proxy</title>
		<link>http://www.sohailriaz.com/howto-ssh-outside-using-authenticated-proxy/</link>
		<comments>http://www.sohailriaz.com/howto-ssh-outside-using-authenticated-proxy/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 07:19:43 +0000</pubDate>
		<dc:creator>Sohail Riaz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.sohailriaz.com/?p=40</guid>
		<description><![CDATA[<a href="http://www.sohailriaz.com/howto-ssh-outside-using-authenticated-proxy/"><img src=""  alt="" title="" /></a>
This howto describe how to ssh outside another network / server using authenticated proxy. SSH (Secure Shell) is typically used to log into a remote machine and execute commands, but it also supports tunneling, forwarding TCP ports and X11 connections; it can transfer files using the associated SFTP or SCP protocols.
Normally we use NetCat to [...]]]></description>
			<content:encoded><![CDATA[<p>This howto describe how to ssh outside another network / server using authenticated proxy. SSH (Secure Shell) is typically used to log into a remote machine and execute commands, but it also supports tunneling, forwarding TCP ports and X11 connections; it can transfer files using the associated SFTP or SCP protocols.<span id="more-40"></span></p>
<p>Normally we use NetCat to ssh outside using proxy server but if its not support proxy user / pass to authenticate by proxy server and then ssh outside. Here we will use a package called connect.c.</p>
<p><strong>connect.c</strong> is the simple relaying command to make network connection via SOCKS and https proxy. It is mainly intended to be used as <strong>proxy command</strong> of OpenSSH. You can make SSH session beyond the firewall with this command.</p>
<p>This can be achieved by other methods too but this works for me.</p>
<h3>1) Download connect.c software.</h3>
<blockquote><p>wget http://www.meadowy.org/~gotoh/ssh/connect.c</p></blockquote>
<h3>2) Compile connect.c Using GCC</h3>
<blockquote><p>gcc connect.c -o connect</p></blockquote>
<p>and then copy to directory in your PATH i.e /usr/bin or /usr/local/bin</p>
<blockquote><p>cp connect /usr/bin</p></blockquote>
<h3>3) Congiure ssh_config</h3>
<p>append following line</p>
<blockquote><p>ProxyCommand /usr/bin/connect -H proxy01.sohailriaz.com:8080 %h %p</p></blockquote>
<h3>4) Export Proxy User / Pass as variable</h3>
<p>It is insecure but we have to used it. If your proxy doesnt use user/pass for authenticatio, you can skip this.</p>
<blockquote><p>export HTTP_PROXY_USER=your_username<br />
export HTTP_PROXY_PASSWORD=your_password</p></blockquote>
<p>Thats it now you can ssh outside without any restriction <img src='http://www.sohailriaz.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://www.sohailriaz.com/wp-content/plugins/pixelstats/trackingpixel.php?post_id=40&amp;ts=1284149969" style="display:none;" alt="pixelstats trackingpixel"/>]]></content:encoded>
			<wfw:commentRss>http://www.sohailriaz.com/howto-ssh-outside-using-authenticated-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo Wget behind Authenticated Proxy</title>
		<link>http://www.sohailriaz.com/howto-wget-behind-authenticated-proxy/</link>
		<comments>http://www.sohailriaz.com/howto-wget-behind-authenticated-proxy/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 07:15:38 +0000</pubDate>
		<dc:creator>Sohail Riaz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[WGET]]></category>

		<guid isPermaLink="false">http://www.sohailriaz.com/?p=38</guid>
		<description><![CDATA[<a href="http://www.sohailriaz.com/howto-wget-behind-authenticated-proxy/"><img src=""  alt="" title="" /></a>
This howto describe how to run wget behind authenticated proxy to download files. GNU Wget is a package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. It is a non-interactive commandline tool, so it may easily be called from scripts, cron jobs, terminals without X-Windows support, etc.
GNU Wget comes as [...]]]></description>
			<content:encoded><![CDATA[<p>This howto describe how to run wget behind authenticated proxy to download files. GNU Wget is a package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. It is a non-interactive commandline tool, so it may easily be called from scripts, cron jobs, terminals without X-Windows support, etc.</p>
<p>GNU Wget comes as default software with almost every distribution, so we are going to just configure it to start downloading using authenticated proxy.<span id="more-38"></span></p>
<h3>1) Export http_proxy variable</h3>
<blockquote><p>export http_proxy=&#8221;http://yourproxyaddress.com:port/&#8221;</p></blockquote>
<h3>2) Export http_proxy variable in bash login script</h3>
<blockquote><p>vi ~/.bash_profile</p></blockquote>
<blockquote><p>export http_proxy=&#8221;http://yourproxyaddress.com:port/&#8221;</p></blockquote>
<h3>3) Define Proxy User / Pass in .wgetrc</h3>
<blockquote><p>vi ~/.wgetrc</p></blockquote>
<blockquote><p>proxy_user=your_username<br />
proxy_pass=your_password</p></blockquote>
<h3>4) Test</h3>
<blockquote><p>[root@centos1 ~]# wget http://www.rarlab.com/rar/rarlinux-3.8.0.tar.gz<br />
&#8211;08:46:50&#8211;  http://www.rarlab.com/rar/rarlinux-3.8.0.tar.gz<br />
Resolving proxy01.sohailriaz.com&#8230; 10.1.59.81<br />
Connecting to proxy01.sohailriaz.com|10.1.59.81|:80&#8230; connected.<br />
Proxy request sent, awaiting response&#8230; 200 OK<br />
Length: 791915 (773K) [application/x-gzip]<br />
Saving to: `rarlinux-3.8.0.tar.gz&#8217;</p>
<p>100%[=======================================&gt;] 791,915     88.8K/s   in 11s</p>
<p>08:47:04 (70.7 KB/s) &#8211; `rarlinux-3.8.0.tar.gz&#8217; saved [791915/791915]</p></blockquote>
<p>Enjoy Brothers <img src='http://www.sohailriaz.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://www.sohailriaz.com/wp-content/plugins/pixelstats/trackingpixel.php?post_id=38&amp;ts=1284149969" style="display:none;" alt="pixelstats trackingpixel"/>]]></content:encoded>
			<wfw:commentRss>http://www.sohailriaz.com/howto-wget-behind-authenticated-proxy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How To Configure Yum Behind Authenticated Proxy Server</title>
		<link>http://www.sohailriaz.com/how-to-configure-yum-behind-authenticated-proxy-server/</link>
		<comments>http://www.sohailriaz.com/how-to-configure-yum-behind-authenticated-proxy-server/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 07:12:03 +0000</pubDate>
		<dc:creator>Sohail Riaz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[YUM]]></category>

		<guid isPermaLink="false">http://www.sohailriaz.com/?p=36</guid>
		<description><![CDATA[<a href="http://www.sohailriaz.com/how-to-configure-yum-behind-authenticated-proxy-server/"><img src=""  alt="" title="" /></a>
This how to describe to configure YUM to work behind proxy server using username / password for authentication. YUM is great tool available in RHEL/Fedora/CentOS to install/update/remove packages easily from local and internet repositories. In the most offices / schools / colleges where proxies are implemented and direct connection to the internet is not possible [...]]]></description>
			<content:encoded><![CDATA[<p>This how to describe to configure YUM to work behind proxy server using username / password for authentication. YUM is great tool available in RHEL/Fedora/CentOS to install/update/remove packages easily from local and internet repositories. In the most offices / schools / colleges where proxies are implemented and direct connection to the internet is not possible and all internet traffic goes through proxy servers. Same as in my office we have to use proxy server with username / password to authenticate ourself to get internet access. So we are going to configure my YUM software to use proxy to get my LINUX updated with new softwares all the times with repositories available on internet.<span id="more-36"></span></p>
<p>OS = Fedora 10</p>
<h3>1) Configure yum.conf</h3>
<blockquote><p>vi /etc/yum.conf</p></blockquote>
<p>enter following lines at bottom of [main] section</p>
<blockquote><p>proxy=http://yourproxyaddress:port/<br />
proxy_username=youruser<br />
proxy_password=yourpassword</p></blockquote>
<h3>2) Export http_proxy variable</h3>
<blockquote><p>export http_proxy=&#8221;http://yourproxyaddress:80/&#8221;</p></blockquote>
<h3>3) Export http_proxy variable in bash login script</h3>
<blockquote><p>vi /root/.bash_profile</p></blockquote>
<blockquote><p>export http_proxy=&#8221;http://yourproxyaddress:80/&#8221;</p></blockquote>
<p>This will help you to export http_proxy variable automatically everytime you login.</p>
<p>Now use &#8220;yum list&#8221; command to check for its working.</p>
<blockquote><p>yum list</p></blockquote>
<p>Enjoy Brothers <img src='http://www.sohailriaz.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://www.sohailriaz.com/wp-content/plugins/pixelstats/trackingpixel.php?post_id=36&amp;ts=1284149969" style="display:none;" alt="pixelstats trackingpixel"/>]]></content:encoded>
			<wfw:commentRss>http://www.sohailriaz.com/how-to-configure-yum-behind-authenticated-proxy-server/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Anonymous Proxy using SQUID 3</title>
		<link>http://www.sohailriaz.com/anonymous-proxy-using-squid-3/</link>
		<comments>http://www.sohailriaz.com/anonymous-proxy-using-squid-3/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 12:06:54 +0000</pubDate>
		<dc:creator>Sohail Riaz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[SQUID]]></category>

		<guid isPermaLink="false">http://www.sohailriaz.com/?p=16</guid>
		<description><![CDATA[<a href="http://www.sohailriaz.com/anonymous-proxy-using-squid-3/"><img src=""  alt="" title="" /></a>
This howto describe step by step method to install SQUID 3 server as Anonymous Proxy. An anonymous proxy is a tool that attempts to make activity on the Internet untraceable. It accesses the Internet on the user&#8217;s behalf, protecting personal information by hiding the source computer&#8217;s identifying information. Simply say to hide your IP.The following [...]]]></description>
			<content:encoded><![CDATA[<p>This howto describe step by step method to install SQUID 3 server as Anonymous Proxy. An anonymous proxy is a tool that attempts to make activity on the Internet untraceable. It accesses the Internet on the user&#8217;s behalf, protecting personal information by hiding the source computer&#8217;s identifying information. Simply say to hide your IP.<span id="more-16"></span>The following How To setups CentOS 5 as OS but it can be implemented on CentOS 4, Fedora Core 5-9 with same steps and SQUID version 3. Bydefault SQUID only uses default IP to communicate on internet but we will make use of all IPs available on server to act as anonymous proxy i.e if user connects to IP1 of server then IP1 will be act as proxy and forward same IP, if user connects to IP2 then IP2 will be act proxy and foward same IP and so on and also we will implement ncsa user based authentication to protect server from unauthorized used.</p>
<p>Server = CentOS 5.2, SQUID = version 3, IPs = 192.168.0.1 &#8211; 192.168.0.5</p>
<h3>1 Installation Of Squid 3:</h3>
<p>CentOS 5 comes with SQUID 2.6 but we need squid 3, so we will download source rpm of squid 3 and compile for our OS.</p>
<h3>1.1  Install Pre-requisite</h3>
<p>Install pre-requisite softwares i.e Development Tools to get all the compilers, libraries and other rpms for compilation of SQUID 3.</p>
<blockquote><p>yum -y groupinstall &#8220;Development Tools&#8221;<br />
yum -y install rpm-build openjade linuxdoc-tools openldap-devel pam-devel openssl-devel httpd rpm-devel</p></blockquote>
<h3>1.2 Download Squid 3 Source RPM</h3>
<p>Download source rpm of Squid 3 from FEDORA website and install it.</p>
<blockquote><p>cd /usr/src<br />
wget http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Fedora/source/SRPMS/squid-3.0.STABLE10-1.fc10.src.rpm<br />
rpm -ivh squid-3.0.STABLE10-1.fc10.src.rpm</p></blockquote>
<h3>1.3 Compile Squid 3</h3>
<p>Use following commands to start compilation, at end it will generate rpm file to install</p>
<blockquote><p>cd /usr/src/redhat/SPECS<br />
rpmbuild -bb squid.spec</p></blockquote>
<h3>1.4 Install Squid 3</h3>
<p>Install newly build rpm, which will be found in /usr/src/redhat/RPMS/i386 for i686 and /usr/src/redhat/RPMS/x86_64 for x86_64.</p>
<blockquote><p>rpm -Uvh /usr/src/redhat/RPMS/i386/squid-3.0.STABLE10-1.i386.rpm</p></blockquote>
<h3>2 Configuration</h3>
<p>I will use default squid.conf to edit.</p>
<blockquote><p>vi /etc/squid/squid.conf</p></blockquote>
<h3>2.1 Configure auth_param</h3>
<p>We will enable ncsa authentication to access our squid server. Find following lines</p>
<blockquote><p>#auth_param basic program &lt;uncomment and complete this line&gt;<br />
#auth_param basic childred 5<br />
#auth_param basic realm Squid proxy-caching web server<br />
#auth_param basic credentialsttl 2 hours</p></blockquote>
<p>Change to</p>
<blockquote><p>auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/squid_passwd<br />
auth_param basic childred 5<br />
auth_param basic realm Squid proxy-caching web server<br />
auth_param basic credentialsttl 2 hours</p></blockquote>
<h3>2.2 Create proxy_auth acl</h3>
<p>Here we will create proxy_auth acl to prompt user/pass to everyone want to use anonymous proxy. Find following line</p>
<blockquote><p>#INSERT YOUR OWN RULES(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS</p></blockquote>
<p>We will insert our proxy_auth rule under above line.</p>
<blockquote><p>#INSERT YOUR OWN RULES(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS<br />
acl ncsaauth proxy_auth REQUIRED<br />
http_access allow ncsaauth</p></blockquote>
<h3>2.3 Disable Forwarded Client IP</h3>
<p>Bydefault squid forward client IP to respective website, but to setup anonymous proxy we will disable it to hide client IPs and send only IPs which are configured on squid server. Find following line squid.conf</p>
<blockquote><p>forwarded_for on</p></blockquote>
<p>Change to</p>
<blockquote><p>forwarded_for off</p></blockquote>
<h3>2.4 Configure IPs</h3>
<p>Now we will generate rules for outgoing IP i.e if any one connects to any IP of my server, so it will go with same IP to destination server. In this way we can connect several clients on different IPs and all IPs act as anonymous proxy. Find following line</p>
<blockquote><p># TAG: tcp_outgoing_address</p></blockquote>
<p>add following lines under it.</p>
<blockquote><p>acl ip1 myip 192.168.0.1<br />
tcp_outgoing_address 192.168.0.1 ip1<br />
acl ip2 myip 192.168.0.2<br />
tcp_outgoing_address 192.168.0.2 ip2<br />
acl ip3 myip 192.168.0.3<br />
tcp_outgoing_address 192.168.0.4 ip3<br />
acl ip4 myip 192.168.0.4<br />
tcp_outgoing_address 192.168.0.4 ip4<br />
acl ip5 myip 192.168.0.5<br />
tcp_outgoing_address 192.168.0.5 ip5</p></blockquote>
<p>You can add as many IPs you like, just use the same pattern above.</p>
<h3>2.5 Enable Anonymizer (Anonymous Proxy)</h3>
<p>Put following lines at the bottom of your squid.conf</p>
<blockquote><p>request_header_access Allow allow all<br />
request_header_access Authorization allow all<br />
request_header_access WWW-Authenticate allow all<br />
request_header_access Proxy-Authorization allow all<br />
request_header_access Proxy-Authenticate allow all<br />
request_header_access Cache-Control allow all<br />
request_header_access Content-Encoding allow all<br />
request_header_access Content-Length allow all<br />
request_header_access Content-Type allow all<br />
request_header_access Date allow all<br />
request_header_access Expires allow all<br />
request_header_access Host allow all<br />
request_header_access If-Modified-Since allow all<br />
request_header_access Last-Modified allow all<br />
request_header_access Location allow all<br />
request_header_access Pragma allow all<br />
request_header_access Accept allow all<br />
request_header_access Accept-Charset allow all<br />
request_header_access Accept-Encoding allow all<br />
request_header_access Accept-Language allow all<br />
request_header_access Content-Language allow all<br />
request_header_access Mime-Version allow all<br />
request_header_access Retry-After allow all<br />
request_header_access Title allow all<br />
request_header_access Connection allow all<br />
request_header_access Proxy-Connection allow all<br />
request_header_access User-Agent allow all<br />
request_header_access Cookie allow all<br />
request_header_access All deny all</p></blockquote>
<p>Configuration is finished, save the file.</p>
<h3>3 User Management</h3>
<p>Now its time to create squid_passwd file, in which we will put our users for authentication using ncsa. For this we need htpasswd command to generate user/pass.</p>
<p>create file to hold username and password</p>
<blockquote><p>touch /etc/squid/squid_passwd</p></blockquote>
<h3>3.1 Create New User</h3>
<blockquote><p>htpasswd /etc/squid/squid_passwd proxyadmin</p></blockquote>
<p>Where /etc/squid/squid_passwd is a file, in which all users goes and proxyadmin is a username which will be added with the password given</p>
<h3>4 Service Management</h3>
<p>Run the squid service and add it up at startup.</p>
<blockquote><p>service squid start<br />
chkconfig squid on</p></blockquote>
<h3>5 Troubleshooting</h3>
<h3>5.1 visible_hostname error</h3>
<p>If you see visible_hostname error after starting service, then again edit /etc/squid/squid.conf file and give visible_hostname tag with your server hostname.</p>
<blockquote><p>visible_hostname server1</p></blockquote>
<p>Your server is ready now and you can use Firefox or IExplorer on your client to check its working. I have used default port 3128 for squid, so put any of the above IP and port to connect. As it connects it will prompt you for user/pass, give the right user/pass and you will start browsing the site. To check the anonymity open http://www.whatsmyipaddress.com. If you have done anything wrong in request_header_access, you proxy can be dedect but if everything is fine. It will just show IP and assume its a direct connection without proxy.</p>
<img src="http://www.sohailriaz.com/wp-content/plugins/pixelstats/trackingpixel.php?post_id=16&amp;ts=1284149969" style="display:none;" alt="pixelstats trackingpixel"/>]]></content:encoded>
			<wfw:commentRss>http://www.sohailriaz.com/anonymous-proxy-using-squid-3/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
