I am making a webapp that allows users to connect to their own database and run various commands. How do I make it so that they can connect to anything BUT localhost (I don't want them messing with my database)? I do need to have localhost access for my website backend stuff so I can't simply disable it in one of the config files.
I am using Golang if that makes any difference.
They would be connecting to their own remote hosts and not a database connected to localhost.
Add pg_hba.conf entries that reject connections from Unix sockets and all local IP addresses.
Related
I am working on a job interview exercise to create a React CRUD application and a PHP API that accesses a mySQL database. The work is to be done on their work server environment that I have to SSH into.
How do I choose which port of their that I want my API to "live" on and then run it so that it accesses their phpmyadmin mySQL server? Then my React application must then run and access the API. They have given me their phpmyadmin port, and a port to use for my UI, and say I must choose the API port.
I was able to create the React app and API on my local machine and have it access my own local my phpmyadmin mySQL running on my local WAMP server. However when trying to run it on their remote environment I ran into a few problems. One of them I believe was running the PHP API through SSH. Do I have to set up tunneling or something? How can I run them both through SSH and have them know which ports theirs to use?
Do you foresee any other potential issues I have not mentioned? More details inc.
Thanks
I am developing an app with a login system in flutter. Using postgresql I can access to an external database located in a raspberry. All works perfect until the network of the device changes. So here are my questions:
How can I access to a database from a device connected to a different network? Is that possible?
If not, how could it be the correct way to do it? or what should I read and/or learn to apply this funcionality?
Thank you.
This question is not Postgres specific.
You connect to servers over TCP/IP protocol using servers IP address or it's FQDN, fully qualified domain name. If your device is mobile and changes network, you can use some dynamic IP service or your own name servers.
Setting up a port forwarding system is also possible.
I created an ASP.NET Core Web API using VS2017. After that I enabled the Docker support for my application.
Next, I was implemented the EF Core feature. After that I tested application locally then it’s working fine, database also created. But whenever I run the application inside local Docker or local Kubernetes the application won't work properly as I expected. because I used the Local SQL Server so, whatever the container running inside either Docker or Kubernetes it doesn't know the SQL Server or SQL Server database.
Can anyone suggest how to use the local database in the container running inside either Docker or Kubernetes?
You need to give the host's IP. In linux, you can use "host.docker.internal" hostname to connect to the host machine. It is supposedly working in Windows, however it has many, many, far too many problems in Windows.
If this hostname does not work for you, you have 2 IP addresses. One is the docker's gateway, that should start with 10...* or 172...* depending on how you set it up. Normally to learn this one, use docker inspect <container> and you can see the default gateway in the network section. However, Kubernetes might change these and it might be providing a better means to access the host. I did not use Kubernetes, so I don't know.
The other option is to use the IP address of the host, assigned by your network using DHCP. It should normally start with 192.168...
Your containers should be able to access applications on your host using these IP addresses. If the problem persists, turn off your firewall, and try pinging from inside the containers.
I am new to AWS. I have created a Spring Web app and a database(MySql) in a EC2 instance (which is working fine). In my web application, I am connecting to a database that is in another server to read and write to this other database.
So, This database is not a MYSQL database. The network admin has opened up the port 3306 for this EC2 instance to access the database from EC2. So, the problem is in my end.
I have opened up the 3306 port (My SQL) in the security group. But when I telnet the port, the connection fails. I can see that in EC2 127.0.0.1:3306 is listening just like 80.
So my question is, what am I missing here?
What are the options to trouble shoot this issue?
Do I have to authorize the tomcat user or Bitnami user to access ports to connect to an outer database?
Anything relevant to this issue would be helpful
thanks in advance :)
If its listening on 127.0.0.1:3306 it is listening locally only and is not accessible form outside. If you change that to 0.0.0.0:3306 make sure your security groups are configured to only allow access to your database from your own instances. Dont just "open up 3306", open up 3306 only to the same security group or the security group your application spring server is in.
You say its not a mysql db, yet it uses mysql default port 3306. Thats a bit confusing. If its mysql you need to change the bind-address in my.cnf.
I think you need to give permissions to user like "dbuser#192.168.1.5" where IP is the IP from dbuser is trying to access the database.
Krish
It seems, This question is stupid, But then, This was a real problem. So, I will summarize what I learned and answer the question. IP Addresses are categorized into types, minimize the exhaustion of IP addresses (That is why we moved from IPV4 to IPV6). Anyways, there are Public IP addresses and Private IP addresses. Private IP addresses are for local networks and Public IP addresses are for accessing through the internet. So, What I did was, I opened up the port for the connecting Servers public IP address (It turned out to be PORT is not 3306, It was 2001 in my case, You only have to do it through Security Groups because my default all the outbound ports are open for EC2) and also, from the other end TCT PORT was opened for EC2. To do that I had to create a Elastic IP address for my EC2 (What Elastic IP address do is, it assigns a Public IP address that will not change when EC2 get restarted or changed). Then it should connect, For me it did not work till I created the Elastic IP
I am making some application and I need to connect to database which is on Amazon server.
It works fine from local but I need direct access to database without ssl tunneling.
On AWS console 3306 port is opened