3 ms·
Your API, in this case, is basically your Flask application so you're pretty much done. If you want to run a database securely, you configure a decent password
by jeroenhd 6y ago
Your API, in this case, is basically your Flask application so you're pretty much done.
If you want to run a database securely, you configure a decent password (should be asked during installation), create new users for each application/database (easy with tools like MySQL workbench) and make all applications running on the server (Flask, in this instance) connect to localhost/127.0.0.1. Don't expose services like databases to the outside world if you cannot in any way help it.
Then enable a firewall on your server (Ubuntu server comes with UFW by default) and lastly use a port scanning tool like nmap/zenmap to check if you have left any services other than HTTP(S) exposed.
I don't know much myself about Flask deployments specifically, but you'll probably use something like nginx or Apache to handle the actual web requests. There's an article here [0] on how to do that. After you've done that, you can secure your connections for free through Let's Encrypt clients like certbot [1] which handle most of the configuration for you.
TL;DR:
1. Configure your application to connect to localhost with a secure password
2. Enable a firewall, run "nmap <your domain>" to check if it works (should only expose HTTP(S) and probably SSH if you did it right).
3. Install nginx or Apache to handle requests for you and follow the guide at [1]
[0] https://www.digitalocean.com/community/tutorials/how-to-deploy-a-flask-application-on-an-ubuntu-vps https://www.digitalocean.com/community/tutorials/how-to-depl...
[1] https://certbot.eff.org/instructions https://certbot.eff.org/instructions