By speelman90
I recently installed the one-click app for Django and then installed OpenVPN with the follow script, https://github.com/Nyr/openvpn-install. I am able to VPN to the server and see my traffic gets routed to it. However I can not see port 5432. Is there a tutorial or previous post someone can refer me to on configuring PostgreSQL 9.3 over OpenVPN?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This question was answered by @speelman90:
I was able to figure it out. Not positive if openvpn will always bind my connection to the same ipaddress tho…
This is what I did.
- Connect to openvpn server
- Run ifconfig and ipconfig to get the ipaddress for the server and local machine over vpn
- Edit /etc/postgresql/9.3.main/postgresql.conf. Uncommented and edited line: listen_addrress = ‘[ip address from for the local machine over the vpn], localhost’.
- Edit /etc/postgresql/9.3.main/pg_hba.conf. Added ipv4 record: host all all [ip address of local machine over vpn]/24 md5
- Installed iptables-persistant and ufw. Enabled ufw.
- Added to entries to iptables and saved: iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d [local machine ip over vpn] --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT iptables -A OUTPUT -p tcp -s [local machine ip over vpn] --sport 5432 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
- Rebooted the server.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.