I have some code that uses getpeername to check if the server it's connecting to is hosted locally (127.0.0.1)
What I'm wondering is if it's possible to fool this by hosting a VPN server on the machine and connecting to the remote server through this?
If not, is there any other way a user might be able to fool this while still connecting to the remote server?
Environment is Windows 10.
Edit to clarify: I have an application running locally and connecting to a remote server, I want to know if it's possible to fool that application into thinking it's connecting to a server that's on the local machine while still actually connecting to the remote server.
Related
So I have been using the cloud_sql_proxy for a while now for a local development environment and never had any issues (over a year). I tried to connect today, and it authenticates fine. Yet, connecting to the local port gives a connectex error:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
I authenticate with a service account at a location specified in my environmental variables. I connect with the command cloud_sql_proxy -instances="XXXXX.XXXXX.XXXXX"=tcp:5432
Windows 10
The Cloud SQL instance works fine and communicates (over a similar proxy) with the production server.
I tried connecting with Django, get connectex error.
I tried to ping the local network, get connectex error.
I tried adding a firewall rule that allows all outbound traffic to port 3307
Any ideas what could've broken my proxy?
If the connection to the Cloud SQL proxy times out, it means the connection to the proxy itself didn't work. That means either the proxy is not listening, or that something it blocking the connection.
I would suggest looking in the proxy logs to see if it reports any start up errors.
I have an application running on my local network (localhost). I want to connect to some external sever (outside of my local network) on a non-standard port.
The only way I can think of is to create an EC2 instance and have a nodejs server running on port 1024 for example.
The problem with this is that I don't want the expensive cost of an EC2 instance for a server that I will be using very sporadically. I don't think I can run a lambda on a specific port or create an api in api gateway to be served over a specific port.
Do you know what will be the best way to run some server on a specific port? The only thing I need is an OK response. I just need to make sure that I can make a connection from my app to a service outside of my local network running on a non-standard port.
I'd say maybe you are looking for ngrok.
It lets you expose a secure port to something that is hosted locally.
I just need to make sure that I can make a connection from my app to a service outside of my local network running on a non-standard port.
Could you clarify on the application here? Are you just trying to check that there is a connection to an outside resource? If so, then you could just ping almost any external resource and see if you get a 200 back.
I'm trying to deploy a flask app to a ubuntu server. When I'm in local network of place A, if I want to connect to ubuntu server of this place, I just simply type ssh username#192.168.1.IP
But when I'm in another network of place B. How can I connect to ubuntu server of place A? I can't connect to it by ssh username#192.168.1.IP command anymore.
You need to use the public ip of the other network and you need to configure port forwarding on the router
My postgres DB is in AWS instance running windows server 2012.
My tableau desktop is in local machine.
While connecting to the DB using external instance IP and default postgres PORT 5432 , it shows the error
Unable to connect to the ODBC Data Source.
Check that the necessary drivers are installed and that the connection properties are valid.
Unable to connect to the server "ec2-xx.xx.xx.xx.ap-south-1.compute.amazonaws.com".
Check that the server is running and that you have access privileges to the requested database.
I have made sure that:
AWS security group is configured for all incoming ports
Windows server 2012 firewall is accepting all inbound traffic.
My local desktop is allowing to send traffic to remote server.And I can telnet hostIP/hostname PORT successfully.
Postgres service is running on 5432 port.
Going by the points you mentioned, I would suggest to see if you have the required drivers installed for postgres. Also, if possible for you for the time being you can install any client temporarily like sqldeveloper(later you can remove this) on the tableau desktop.
Now because you are able to telnet Ip 5432, you can test your connection from the client, If this doesnt work u know that the problem is in configuration else we need to dig more into that.
It seems like I have not set the pg_hba.conf file correctly for postgres. Allowing the connection request from all external IPs let me resolve the issue.
Adding the line at the end of the file,
host all postgres 0.0.0.0 md5
I had to stop then start my ec2 database server running postgresql. Now after it is started, i get the following error message from my django web server
could not connect to server: Connection refused Is the server
running on host "54.235.119.193" and accepting TCP/IP connections on
port 5432?
However because I use elastic IPs and reassigned the same IP (54.235.119.193) I don't think that is the issue. I also am using the same security groups as before, which allow 5432.
I think the only thing that changes when you start/stop is the internal IP but I don't remember using that anywhere in configuration
Any Ideas?
Are you using iptables or selinux? These usually get in the way on restart if not configured properly.