CentOS with AutoSSH 127.0.0.1 versus * - centos

I'm using autossh and set it up like shown in the following example: http://surniaulula.com/2012/12/10/autossh-startup-script-for-multiple-tunnels/
I found it works really well, but need some clarification. Particularly, the difference between 127.0.0.1 and * in the following examples:
ForwardPort=(
"L 127.0.0.1:3397:127.0.0.1:3306"
)
versus
ForwardPort=(
"L *:3397:127.0.0.1:3306"
)
The first one seems to do the redirect if coming from the host machine itself, where the 2nd seems to forward from anywhere. To me this translated as if the * was for any IP to forward the traffic through, but someone told me that it just says for any adapter on the machine. I'm curious is it any IP, or any adapter? I assume the end result is the same, but would like clarification for my own understanding.
Update
I updated my test to include a specific IP of a network I'm using and then tried to connect to the port and found that it did not work with the specific port specified, e.g.
ForwardPort=(
"L x.x.x.x:3397:127.0.0.1:3306"
"L 127.0.0.1:3397:127.0.0.1:3306"
)
Since this did not work, it makes me believe my buddy was right about the adapters. I am thus seeking details of how the adapter stuff works.

Figured out my answer, figured I would post my answer, in case anyone is interested or googles an answer like I did and not find it.
So when I did x.x.x.x this was the WAN IP of my remote server. The autossh has not clue of this as the IP is not one of its adapters. If you run ifconfig on the server then you'll get your local loopback of 127.0.0.1 and other adapters like eth0, which would have the WAN IP. By doing the *, it does the forwarding for any requests comes from the local loop back as well as from the WAN. So * routes all requests, where 127.0.0.1 only does the ones that come from the machine itself.
If you wanted to allow external forwards, but limit who could do it, you could achieve this by doing * and then limiting communication of the server via iptables.

Related

ssh not working when changing static ip address in dhcpcd.conf (raspberry pi)

This is probably a basic question for anyone versed in networks, but very esoteric for me.
I have two raspberry pi 4 (connected in a local network throught a fast switch (netgear fs108). If i read the ip adresses given by default to the raspberries (via hostname -I) i obtain a address that allows me to do ssh betwen the raspberries without any problem (the degault adresses are the same provided that i always connect the raspberries to the same switch ports), but i would like to asign different ip addresses. Following several tutorials, i modify the dhcpcd.conf by adding the lines
interface eth0
static ip_address=192.168.5.11/24. #192.168.5.12/24 in the second raspberry
after reboting, if i verify the new up address
hostname -I
i obtain the assigned address, but when i try to connect via ssh, with:
ssh pi#192.168.5.11
the terminal does nothing (not asking password, neither failing)
In some tutorials, i see that also the fields
static routers, and static domain_name_servers are added to the dhcpcd file, but i do not know what they are, and obviously adding the sme numbers that i see in tutorials (just to try) makes that event the
hostname -I
command does not give the address anymore.
Are those two fiels necessary, and if yes, how can Iknow which values I sould give? there is nothing written in my switch.
follwowing on this, if i change the switch and use a 'proper' router, i would need to change those values?
Thanks in advance.

VirtualBox port redirection issues with non standard HTTPS ports

I have setup a CentOS VM to test Hadoop. I set a network interface in NAT mode with a paravirtualized network type interface. Port redirection for SSH (TCP 22) works without issues. However some other ports do not seem to fully work (9870, 8042, 9864). I can see some "action" happening. Let me give an example for port 9870.
These are my rules (remember I said the SSH rule works without issues):
RulesX TCP 127.0.0.1 59870 10.0.3.15 9870
When I try to access http://127.0.0.1:59870 I get automatically redirected to https://127.0.0.1:59870 but eventually I get a ERR_TIMED_OUT error.
Tracing the traffic on the VM, I can see the traffic coming in but I cannot see any response back (I have one single network interface):
I am not sure what else to look at.
Any idea is highly welcome. Thank you!
More than likely, you need to open the non-standard ports on Centos firewall.
Open firewall port on CentOS 7

Hosting a website using server software

How can i host a website through my computer using server softwares?
I tried to host a website through my own computer using apache tomcat server but it didnt work ( please briefly explain every point )
The main issue that you need to deal with is getting the clients to your computer.
Yes, it is possible and yes I have done it, albeit a while ago.
You need to see if you can browse to your computers website from another device on your network, this will ensure that apache is working. Try another computer/laptop/tablet/whatever to see if this site reachable by other computers using the IP Address and possibly port number. If you cannot get to the site, there are settings in apache to deny certain ip's, google it to get the exact steps for your version. If it works, move on to step 2.
You will need a static IP Address to ensure that all further steps stay working, google this if you are not sure how to do it
You need to have the external IP address of your router(whatsmyip.org) or use Dynamic DNS to route traffic from an address to your ip and there are services that allow this. I can recommend no-ip.com - This is all assuming that you have access to the router.
You would be required to set up port forwarding on your router. This will direct the internet traffic to your computer. You will need to get the exact instructions for your specific model of router.
Please be aware that you need to have proper firewalls and systems in place to prevent attacks. I am sure that you are just testing at this point though...
All the best!

How can I reach my localhost over the web from outside local? i.e ip/page?

I installed usbwebserver
everthing is running, I am trying to reach the root page index.php?
I read everything I possibly can and sorry but I still cant figure out how to reach my localhost
I reach my page with localhost:8080 and the page I want shows up but if I replace it with IP:8080 it does not.
I am trying to reach this page outside of my local network.
I'm sorry, I need to provide you a separate answer for your reformatted question for the "down the street" scenario. I can troubleshoot a few of the issues you're probably having.
ISP's don't typically allow residential internet connections to serve resources over port 8080, or 80. Even if you were to configure your computer as needed, if you're on a standard internet service provider they're probably blocking you in the middle even if you have punched holes all your local security in an attempt to serve assets over port 8080/80.
Assuming they don't allow that you're going to have to first configure your outbound middleware(php in your case) to listen to calls into your ip on a different port. ( You can do this in your C:\WAMP\ folder, in the "wampserver" configuration file. Here's a good walkthrough here: (http://forum.wampserver.com/read.php?2,13744)
Now, you're going to have to drop any firewalls windows/ubuntu/macOS are providing on that port. (This is the part where you've rolled out the red carpet for hackers to get into your box(es) so be careful!) Here's a link for a short and sweet explanation on windows here: (http://yourbusiness.azcentral.com/turn-off-windows-firewall-19396.html) Note that you can open individual ports, you don't have to drop your entire firewall.
Make sure you have opened up access to any folders/mySQLdb's/resources to outside requests as well (seriously, this is a REALLY bad idea from an #home server if you don't know what you're doing)
Then figure out the correct ip and the correct port and give it a go! If it still doesn't work you can download a program like [wireshark] (https://www.wireshark.org/download.html) or [fiddler] (http://www.telerik.com/download/fiddler/fiddler2) to debug your inbound/outbound traffic and see what the machine's seeing before your browser/server gives you any user visible information.
One thing to note, if you are an amateur web developer your homepage is called "index.html" not "home.html" "home.html" only works fine locally, but internet browser engines look by default, for "index.html"
Lastly, and I really can't stress this enough don't host through your personal ISP and serve files from your own machine. Hosting through Fatcow, or hostgator, or any of the other hosts is really honestly dirt cheap and they know far better than you or I do about security.
That said, I hope very much that you succeed in using my answer, or at the very least learning something from it. Happy Coding!
http://www.canyouseeme.org/
--
Read the Background session
go to a command line, type "ipconfig"
Hit Enter.
Under "Ethernet adapter Ethernet:
It should be the third line down, has your following:
IPV4 Address : 192.168.1.xxx where "xxx" is your ip
address.
USE "//" + "the ip address shown for (ipv4)" plus ":8080" and your default page
should show just fine.
For example, if your cmd "ipconfig" for this process reads: "192.168.1.12"
your total URL in your browser will be "//192.168.1.12:8080"
Note that I used 2 forward slashes prior to using an IP address on your
local network. That let's your computer know it's using your network, not
the actual internet. The slashes alone may solve your problem. Also note, if you're accessing a database through your webapp, you will also need to properly configure your db settings to allow access.
First find your outside ip adress not local ip. After that go into router panel and open to use from apache server. Anyone able to access that port now. You can connect outside your local website now. If you can't do that. Try again. This is the way to doing this.

how to get server ip of PPP connection

After establishing a PPP connection using rasdial (making a dial-up call), how do I get the 'server ip' address that is given to me. It's usually a local ip, but I cannot seem to get it when I do an ipconfig.
However I can see this IP address, if I right click on the connection and select status.
This question has been asked in the past, but by .NET and C# users and their solution is using a certain available library, which I don't have.
Does anyone know how to obtain the PPP server ip? I need that IP address to initiate an FTP traffic with the modem.
I established the connection this way :
system (rasdial [connection_name]); # in perl.
Thanks!
I think your best best is to hook into the Windows API calls with Win32::API. You probably want to start with RasEnumConnections.