How to Create a Proxy // Squid (HTTP) and SOCKS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
are you blocked from accessing your favorite content or perhaps you're curious about the data that your personal devices are sending out to the internet or are you looking for a better way to browse the internet privately well in this video i'll show you how you can do that by creating your own proxy welcome back to dev odyssey a developer's journey through it where i cover tutorials and reviews of it tools and technologies i'm your host forrest and in this episode we're going to be creating a proxy first what are proxies well a proxy server is simply an intermediary or a middleman that processes outgoing requests to its destination thereby acting as a client on your behalf there are many different protocols and proxy services that we can use however in this example we're going to be going through the two most common ones an http proxy and a socket secure proxy let's go ahead and see how they work proxy servers are quite easy to understand in this example let's say you have a client laptop a proxy server and a website in a normal scenario your laptop will make a https request to the website and it will respond back now when you make that request you're actually sending a bit of metadata from your computer to the website and in this metadata you expose certain information such as ip address operating system browser and more now with the proxy server we just put something in between that connection so first your client is going to make a request to the proxy server then the proxy server will make its own request to the website the website will respond back and then the proxy server will respond back to the client now here we're only exposing the metadata on the proxy server and not on the client laptop this provides us a number of benefits one being anonymity two is access to different content three we can monitor web traffic with this proxy and four is parental blocks where we can block specific websites these benefits all come down to two things one being the proxy server metadata and two being the proxy server location or its supposed location now that we understand http proxies let's go ahead and take a look at a sox proxy sox proxies are very similar to http proxies with a few differences let's use the example that we had before so the way it differs first is we start off by using an ssh application that lives on our client computer and here we make a connection to our proxy server using ssh mac and linux computers have ssh by default but if you have windows you can install application like putty to do this so first our client laptop will make a web request to the ssh application then that http connection will be sent through the existing ssh connection that we have with the proxy server this process here is called tunneling then the proxy server will send that https connection to the website the website will respond the proxy server will then tunnel that connection back to the ssh application and then the ssh application will return that response to the computer now here we get the same benefits that we do with an http proxy where the metadata is exposed on the proxy server but not on the client laptop and that about covers it for http proxies and socks proxies now to recap some of the benefits of proxies are increased anonymity access to different types of content a way to analyze web traffic and parental blocks for this demonstration i'm going to be using an ubuntu server with a free and open source http proxy called squid and for the sox proxy i'll be using an open ssh server let's go ahead and configure our proxies in this demonstration i'm going to show you how you can create your own http proxy using a free and open source tool called squid then after that i'm going to show you how you can use this same server to run a sox proxy i'll be using ubuntu 20.04 ltes server to run this example first i'm going to show you that right now i'm not connected to the internet on this network and then once i connect to the proxy you'll see that i do get an internet connection so as you can see i typed in yahoo.com into firefox and it looks like it's just taking its time and therefore this will timeout and shows you that i'm not connected we'll go ahead and stop that and now we'll get started in our terminal first connecting to our squid proxy server now that i've connected to my proxy server we're going to run the first command which is sudo apt install squid here we'll click yes and then it'll perform the install looks like that installed successfully and we're almost ready to go but first we need to make one configuration change in the configuration file first we're going to make a copy of it just so that if we ever need to revert to the default settings we could do that easily we could find this configuration file under etc squid squid.conf now that we've made that change let's go ahead and open it up in this file we're going to be looking for something called http access allow you can see the setting is now commented out but we're going to uncomment it so that it gives us access to the proxy server now that we've done that we're going to run a restart of the proxy server so that we can have those changes take effect looks like the restart finished now i'm going to be sure that it's running and looks like it is where we see active running now we're going to test this out using postman in postman first i'm going to go to my settings go to the proxy tab do add custom proxy configuration remove use system proxy for the proxy server i'm going to use my ip address which is 192.168.70.4 and this is the ip address of the proxy server then for the port i'm going to use 3128 which is the default port that squid runs on now that we've applied those changes i'm going to go ahead and make a request to a website called ifconfig.me which will tell us the public ip address that we're using and as you can see we get a 200 response back and if we scroll down we can actually see the ip address that we're using here that's one nine three three two one two seven two one three now just to confirm this worked we could also look at an access log that squid has here in the terminal i'm going to type in the following sudo vim var log squid access dot log and as you can see here we have a 200 which indicates that it was a success now let's add a little bit more security to this first we're going to add some authentication using basic authentication let's go ahead and open up this configuration file once more now that we are at the acl section i'm going to go ahead and add some configuration options of my own i'm going to copy and paste these in as it's much easier to explain that way first we're adding off param basic program which is telling us the basic authentication that we're going to be using next we add off param basic realm squid proxy caching web server and that's just telling us the name that we're giving to this authentication and this is the name that you will have displayed when you're logging into a browser or anytime you need to be prompted to log in next we're creating our own access control list or acl called authenticated proxy required and in this case proxy auth is telling us that this acl requires authentication we're adding another acl here called authenticated underscore ips with the source being my computer's ip address and that's 192.168.45.5 and then lastly we're going to go back to that http underscore access section that we changed earlier and we're going to change it to allow these acls that we just configured now that we're here we're going to go ahead and change this acl name from localnet to authenticated and authenticated underscore ips and here i'm putting in two acls meaning that in order to get access to this proxy server i will need to follow or be using these two access control lists otherwise if i do not meet the criteria for both of them it will not allow me to use the proxy server let's go ahead and save and close this file and we're going to need to do one more thing and that is create a password file for our proxy server to use here i'm printing out a command or the output of it where i have a username and text and then i use the command open ssl and then the password option to create a hashed password and then we're going to pipe that into a file called htpasswd but first i need to give it a password and a username so for the password i'll do test1234 and that's because i can only use eight characters otherwise it'll truncate if i use more than a then the username here we'll choose as squidward now that i've done that i'll run the command using sudo and there you go we see we've printed out the output of the command where we have the username a colon separating it and the hashed password so now i've done that i'm going to just restart the proxy server once more for these changes to take effect looks like that finished restarting so now let's go to postman once more and we're going to add some authentication back to our settings proxy then within here we're going to do proxy auth and turn it on here we're going to type in the username of squidward and then here we're going to type in the password of test1234 looks good now we'll exit out of here and we'll create a new request going to that same website looks like we got a 200 again so we could see that it worked and just to look at the ip address one more time looks like it is the same one that we had before that basically covers http proxies now we'll do a sax proxy example where it's much simpler first i'm going to disconnect from this server now i'm going to reconnect to the server but i'm going to add an extra option to connect to it and i'm going to open a port in doing that here this hyphen d command means dynamic port forwarding and here i'm giving it the port option of 40932 and in this case i'll be opening up this port to the ssh application that it'll listen on for any incoming connections looks like we've logged in and i'm going to show you in another tab here how we have a new open port this is a shortcut i have created for checking open ports and as you can see here we have 127.0.0.1 40932 and it's on listen right now so it's waiting for an incoming connection with that information i'm going to go to firefox to test out the stocks proxy using a plugin called foxy proxy which allows me to only proxy the connection from my firefox browser here i'm going to go ahead and click that and then do options we're going to add here we're going to name the proxy type of sox5 we're going to give it the ip address of 127.0.0.1 and all this means is my local interface or my loopback interface that identifies my computer and this is universal to all computers here the port number will be what i chose before which is 40932 we have no username and password and here i'm going to call this test socks now that i've done all that i'll click save and here i'm going to open up a new tab and then in the foxy proxy plugin i'm going to change it to use this test socks proxy then in google i'm going to type what is my ip address and as you can see it's that same ip address as we saw in postman and that about covers it for configuring your own http proxy and socks proxy thanks again for following me in my journey i really appreciate it if you got some value out of this video go ahead and give it a thumbs up and if you like this type of content and content around it tools and technologies networking and security go ahead and subscribe to my channel and click that bell for notifications so you don't miss the next one so what do you use proxies for drop me a comment down below and i'll be sure to answer thanks again and i'll see you in the next video you
Info
Channel: Dev Odyssey
Views: 3,157
Rating: 4.9480519 out of 5
Keywords: create my own proxy server at home, how to create a http proxy server, how to create a proxy server, how to create a proxy server linux, how to create a proxy server ubuntu, how to make own proxy server for free, proxy server configure at home, socks proxy, socks proxy explained, socks proxy server, squid proxy server configuration, what is a proxy server, squid proxy server, socks5 proxy, how to configure squid proxy server in ubuntu, postman proxy settings, foxyproxy socks5
Id: g2iSPBmRZ7M
Channel Id: undefined
Length: 14min 4sec (844 seconds)
Published: Tue Jun 08 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.