Skip to content

Instantly share code, notes, and snippets.

@Manouchehri
Last active August 29, 2015 14:22
Show Gist options
  • Save Manouchehri/ee07bb9cf6ba59322636 to your computer and use it in GitHub Desktop.
Save Manouchehri/ee07bb9cf6ba59322636 to your computer and use it in GitHub Desktop.
Setting up OpenVPN VPS

ssh as root

Disable password auth in /etc/ssh/sshd_config

Pick random port

shuf -i 49152-65000 -n 1

Disable root login

adduser dave

adduser dave sudo

sudo su - dave

mkdir ~/.ssh/

cat .ssh/key.pub

nano ~/.ssh/authorized_keys

chmod 700 ~/.ssh && chmod 600 ~/.ssh/*

exit (go back to dave)

sudo restart ssh

apt-get update/upgrade

https://help.ubuntu.com/lts/serverguide/openvpn.html

https://wiki.archlinux.org/index.php/OpenVPN#iptables

iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o venet0 -j MASQUERADE

https://stackoverflow.com/questions/9330694/how-to-permanently-update-iptables

https://askubuntu.com/questions/9/how-do-i-enable-automatic-updates

sudo apt-get install unattended-upgrades
sudo dpkg-reconfigure unattended-upgrades

Edit /etc/apt/apt.conf.d/50unattended-upgrades

openvpn --genkey --secret ta.key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment