Академический Документы
Профессиональный Документы
Культура Документы
Creating an HTTP Proxy Using Squid on CentOS 6.4 - Linode Guides & Tutorials
Guides&Tutorials(/docs/)
IPs,Networking&Domains(/docs/networking/)
SquidProxy/Cache(/docs/networking/squid/)
CreatinganHTTPProxyUsingSquidonCentOS6.4
Squidisaproxy/cacheapplicationwithavarietyofconfigurationsanduses.Thisguide
willcoverusingSquidasanHTTPproxy.Pleasenotethatunlessyoufollowthelast
sectionoftheguideAnonymizingTraffic,thiswillnotanonymizeyourtraffictothe
outsideworld,asyouroriginatingIPaddresswillstillbesentintheXForwardedFor
header.Additionally,thetrafficisnotencryptedandwillstillbevisibleonyourlocal
network.Ifyouarelookingforasolutionthatoffersgreatersecurity,youmaywantto
lookatourguidetoSettingupanSSHTunnel(/docs/networking/ssh/settingupanssh
tunnelwithyourlinodeforsafebrowsing)orDeployVPNServiceswithOpenVPN
(/docs/networking/vpn/securecommunicationswithopenvpnoncentos6).
Note
Thisguideiswrittenforanonrootuser.Commandsthatrequireelevatedprivilegesare
prefixedwith sudo.Ifyourenotfamiliarwiththe sudocommand,youcancheckour
UsersandGroups(/docs/toolsreference/linuxusersandgroups)guide.
Installing Squid
1. SquidisavailableintheCentOSrepositories.Toensureyoursystemisuptodate
andinstallSquidrunthefollowingcommands:
1
2
sudoyumupdate
sudoyuminstallsquid
https://www.linode.com/docs/networking/squid/squid-http-proxy-centos-6-4
1/8
9/19/2015
Creating an HTTP Proxy Using Squid on CentOS 6.4 - Linode Guides & Tutorials
2. Copytheoriginalconfigurationfiletokeepasabackup:
1
sudocp/etc/squid/squid.conf/etc/squid/squid.conf.default
Basic Setup
ThissectioncoverstheeasiestwaytouseSquidasanHTTPproxy,usingonlytheclient
IPaddressforauthentication.
1. EdittheSquidconfigurationfileandaddthefollowinglines:
aclclientsrc12.34.56.78#HomeIPhttp\_accessallowclient
Besuretoreplaceclientwithanameidentifyingtheconnectingcomputer,and
12.34.56.78withyourlocalIPaddress.Thecomment #HomeIPisntrequired,but
commentscanbeusedtohelpidentifyclients.
1. Onceyouvesavedandexitedthefile,startSquid:
1
sudoservicesquidrestart
2. Atthispointyoucanconfigureyourlocalbrowseroroperatingsystemsnetwork
settingstouseyourLinodeasanHTTPproxy.Howtodothiswilldependonyour
choiceofOSandbrowser.Onceyouvemadethechangetoyoursettings,testthe
connectionbypointingyourbrowseratawebsitethattellsyouyourIPaddress,
suchasifconfig(http://ifconfig.me),WhatismyIP(http://www.whatismyip.com/),or
byGooglingWhatismyip(https://www.google.com/search?q=what+is+my+ip).
3. Additionalclientscanbedefinedbyaddingnew acllinesto
https://www.linode.com/docs/networking/squid/squid-http-proxy-centos-6-4
2/8
9/19/2015
Creating an HTTP Proxy Using Squid on CentOS 6.4 - Linode Guides & Tutorials
/etc/squid/squid.conf.Accesstotheproxyisgrantedbyaddingthename
Advanced Authentication
ThefollowingconfigurationallowsforauthenticatedaccesstotheSquidproxyservice
usingusernamesandpasswords.
1. Youwillneedthe htpasswdutility.IfyouveinstalledApacheonyourLinode,you
willalreadyhaveit.Otherwiserun:
1
sudoyuminstallhttpdtools
2. CreateafiletostoreSquidusersandpasswords,andchangeownership:
1
2
sudotouch/etc/squid/squid_passwd
sudochownsquid/etc/squid/squid_passwd
3. Createausernamepasswordpair:
1
sudohtpasswd/etc/squid/squid_passwduser1
Replaceuser1withausername.Youwillbepromptedtocreateapasswordforthis
user:
1
2
3
Newpassword:
Retypenewpassword:
Addingpasswordforuseruser1
Youcanrepeatthisstepatanytimetocreatenewusers.
4. EdittheSquidconfigurationfileandaddthefollowinglines:
https://www.linode.com/docs/networking/squid/squid-http-proxy-centos-6-4
3/8
9/19/2015
1
2
3
Creating an HTTP Proxy Using Squid on CentOS 6.4 - Linode Guides & Tutorials
auth_parambasicprogram/usr/lib64/squid/ncsa_auth/etc/squid/squid_passwd
aclncsa_usersproxy_authREQUIRED
http_accessallowncsa_users
5. Onceyouvesavedandexitedthefile,restartSquid:
1
sudoservicesquidrestart
6. Atthispoint,youcanconfigureyourlocalbrowseroroperatingsystemsnetwork
settingstouseyourLinodeasanHTTPproxy.Youwillneedtospecifythatthe
serverrequiresauthentication,andprovidetheusernameandpassword.Howtodo
thiswilldependonyourchoiceofOSandbrowser.Onceyouvemadethesettings
change,testtheconnectionbypointingyourbrowseratawebsitethattellsyou
yourIPaddress,suchasifconfig(http://ifconfig.me),WhatismyIP
(http://www.whatismyip.com/),orbyGooglingWhatismyip
(https://www.google.com/search?q=what+is+my+ip).
7. Toremoveausersaccesstotheproxy,youmustdeletetheirentryinthe
squid_passwdfile.Eachuserisrepresentedinthefileonasinglelineintheformat
of user:passwordhash:
/etc/squid/squid_passwd
1
user1:gh48gfnouser2:9b83v5hd
IfyouareusingNano,thecommand Control+kwillremovetheentirelinewhere
thecursorrests.Onceyouvesavedandexitedthefile,restartSquid:
1
sudoservicesquidrestart
Anonymizing Traffic
InordertomaskyourIPaddressfromserversyouconnectto,youwillneedtoaddthe
followinglinestotheSquidconfigurationfile.
https://www.linode.com/docs/networking/squid/squid-http-proxy-centos-6-4
4/8
9/19/2015
Creating an HTTP Proxy Using Squid on CentOS 6.4 - Linode Guides & Tutorials
forwarded_foroff
request_header_accessAllowallowall
request_header_accessAuthorizationallowall
request_header_accessWWWAuthenticateallowall
request_header_accessProxyAuthorizationallowall
request_header_accessProxyAuthenticateallowall
request_header_accessCacheControlallowall
request_header_accessContentEncodingallowall
request_header_accessContentLengthallowall
request_header_accessContentTypeallowall
request_header_accessDateallowall
request_header_accessExpiresallowall
request_header_accessHostallowall
request_header_accessIfModifiedSinceallowall
request_header_accessLastModifiedallowall
request_header_accessLocationallowall
request_header_accessPragmaallowall
request_header_accessAcceptallowall
request_header_accessAcceptCharsetallowall
request_header_accessAcceptEncodingallowall
request_header_accessAcceptLanguageallowall
request_header_accessContentLanguageallowall
request_header_accessMimeVersionallowall
request_header_accessRetryAfterallowall
request_header_accessTitleallowall
request_header_accessConnectionallowall
request_header_accessProxyConnectionallowall
request_header_accessUserAgentallowall
request_header_accessCookieallowall
request_header_accessAlldenyall
Onceyouvesavedandexitedthefile,restartSquid:
1
sudoservicesquidrestart
More Information
https://www.linode.com/docs/networking/squid/squid-http-proxy-centos-6-4
5/8
9/19/2015
Creating an HTTP Proxy Using Squid on CentOS 6.4 - Linode Guides & Tutorials
Youmaywishtoconsultthefollowingresourcesforadditionalinformationonthistopic.
Whiletheseareprovidedinthehopethattheywillbeuseful,pleasenotethatwecannot
vouchfortheaccuracyortimelinessofexternallyhostedmaterials.
SquidOfficialSite(http://www.squidcache.org/)
ThisguideispublishedunderaCCBYND3.0(http://creativecommons.org/licenses/bynd/3.0/us/)license.
Overview (https://www.linode.com/linodes)
Plans&Pricing(https://www.linode.com/pricing)
Features(https://www.linode.com/linodes)
Backups(https://www.linode.com/backups)
NodeBalancers(https://www.linode.com/nodebalancers)
Longview(https://www.linode.com/longview)
https://www.linode.com/docs/networking/squid/squid-http-proxy-centos-6-4
6/8
9/19/2015
Creating an HTTP Proxy Using Squid on CentOS 6.4 - Linode Guides & Tutorials
Managed(https://www.linode.com/managed)
StackScripts(https://www.linode.com/stackscripts)
Mobile(https://www.linode.com/mobile)
CLI(https://www.linode.com/cli)
API(https://www.linode.com/api)
Resources (https://www.linode.com/docs)
GettingStarted(https://www.linode.com/docs/gettingstarted)
MigratingtoLinode(https://www.linode.com/docs/migratefromshared)
HostingaWebsite(https://www.linode.com/docs/hostingwebsite)
Guides&Tutorials(https://www.linode.com/docs)
SpeedTest(https://www.linode.com/speedtest)
Forum(https://forum.linode.com/)
Chat(https://www.linode.com/chat)
SystemStatus(http://status.linode.com/)
Company (https://www.linode.com/about)
AboutUs(https://www.linode.com/about)
Blog(https://blog.linode.com)
Logos(https://www.linode.com/logos)
Careers(https://www.linode.com/careers)
Contact(https://www.linode.com/contact)
Contact Us (https://www.linode.com/contact)
8554LINODE(tel:+18554546633)
https://www.linode.com/docs/networking/squid/squid-http-proxy-centos-6-4
7/8
9/19/2015
Creating an HTTP Proxy Using Squid on CentOS 6.4 - Linode Guides & Tutorials
(8554546633)(tel:+18554546633)
Emailus(mailto:support@linode.com)
Facebook(https://facebook.com/linode)
Twitter(https://twitter.com/linode)
Google+(https://plus.google.com/+linode/)
Linkedin(https://linkedin.com/company/linode)
Github(https://github.com/linode/)
2015Linode,LLC
TermsofService(https://www.linode.com/tos)
PrivacyPolicy(https://www.linode.com/privacy)
Security(https://www.linode.com/security)
https://www.linode.com/docs/networking/squid/squid-http-proxy-centos-6-4
8/8