How Test to see if docker container has exposed port (in this case mariadb/mysql has 3306 exposed)
Be careful when running docker containers, even if you have firewall installed for example csf.
If you expose port in docker compose like this:
or in wanted to use container like this:
docker run -p 3306:3306 blabla/blabla-mariadb/mysql
you open your site to a vulnerability.
If you want to test if you have exposed port on your server then, install on localhost TELNET. This is done like this:
sudo apt-get install telnet (if you are on debian/ubuntu)
sudo yum install telnet (Redhat/Centos)
Some default ports so you know what you’re looking for:
-Microsoft SQL Server 1433,
-Firebird & Interbase 3050
To test connection run:
telnet ip port
example: telent 188.8.131.52 3306
If connection is successful you should see something like this:
Connected to mydb.
Escape character is '^]'.
If connection is unsuccesful you’ll see something like:
telnet: Unable to connect to remote host: Connection timed out
Fix for exposed port: Fix exposed port in docker container