How can I connect to a remote server? - flask

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

Related

Is it possible to "fool" getpeername using a VPN server on localhost?

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.

How to use an AWS instance to connect to a server on my local computer?

I have an HTTP server running on my local computer, and I would like to be able to connect to it remotely. I would like to connect to a port on the aws instance and have it forwarded to my local computer. This is because my local computer can't be connected to directly. I would like to create a connection from my computer to the instance, and forward an incoming connection to my computer over that connection.
Edit: I am able to curl the website from the AWS instance, so the port forwarding works, but I can't connect to that port from outside.

Accessing a dev server when doing remote / cloud development

I'm attempting to find a completely remote / cloud-based development workflow.
I've created an aws free-tier ec2 instance and on that box I've been developing a gatsby site (the framework doesn't matter, the solution I'm looking for should be framework agnostic). Since the code is on another box, I can't run the dev server and then from the local computer hit localhost as I would normally.
So,
What do I need to do so that I can run gatsby develop and hit my dev server that's hosted on the ec2 box?
How do I provide public access to that endpoint?
Is it possible to provide temporary access so that when I log off of the box, it's no longer accessible?
Is there some mechanism I can put into place so that I'm the only one that can hit that endpoint?
Are there other features that I should be taking advantage to secure that endpoint?
Thanks.
I can't run the dev server and then from the local computer hit localhost as I would normally
You can. You can use ssh to tunnel your remote port to your localhost, and access the server from your localhost.
What do I need to do so that I can run gatsby develop and hit my dev server that's hosted on the ec2 box?
ssh into the dev server, run gatsby develop and either access it on localhost through ssh tunnel or make it public to access through its public IP address.
Use sshfs to mount a development folder on the dev server onto your localhost.
Alternatively, you can setup vncserver on the dev server, tunnel vnc connection using ssh, and access the dev server using through a remove desktop. Something liteweight would be good, e.g. fluxbox as a desktop environment for vnc.
Is it possible to provide temporary access so that when I log off of the box, it's no longer accessible?
yes. through ssh tunnel. You close tunnel and the access is finished.
Is there some mechanism I can put into place so that I'm the only one that can hit that endpoint?
ssh tunnel along with security group to allow ssh for your IP address only.
Are there other features that I should be taking advantage to secure that endpoint?
Security groups and ssh tunneling would be primary choices to ensure secure access to the dev server.
You can also make the endpoint public, but set security group of your dev server to allow internet access only from your IP.
You could also put the dev server in a private subnet for full separation from the internet. Use bastion host to access it or setup double ssh tunnel to your localhost.
Other way is to do all development on localhost, push code to CodeCommit and have CodePipeline manage deployment of your code to your dev server using CodeDeploy.
You can also partially eliminate ssh by using SSM Session Manager.
Hope this helps.

Cannot connect to the ip provided by the OWASP BWA

I have installed owasp bwa in virtual box. And when I run the vm I got an IP address to connect to.But, when I'm trying to access it using http://ip-address, it failed to connect. And I'm not able to ping it from my host network.
Go to VM Network settings and and change it to Bridge Adapter.

Tableau desktop not connecting to DB server on AWS instance

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