Mar 30

Quick – I Need an OpenVPN Server!

Tags:

#This install assumes CentOS/Redhat/Fedora

 

SERVER SETUP:
sudo yum update
# net-tools install resolves errors explained later
sudo yum install net-tools vim screen wget firewalld
sestatus
#change selinux=disabled
sudo vim /etc/selinux/config

 

FIREWALL SETUP:
sudo systemctl enable firewalld
sudo service firewalld start
sudo firewall-cmd –state
sudo firewall-cmd –get active zones
sudo firewall-cmd –list-all
sudo firewall-cmd –zone=public –permanent –add-port=22/tcp
#if you want to change your connection ports (recommended):
sudo firewall-cmd –zone=public –permanent –add-port=10001/tcp
sudo firewall-cmd –zone=public –permanent –add-port=10002/tcp
sudo firewall-cmd –zone=public –permanent –add-port=10003/tcp
#to keep the default ports:
sudo firewall-cmd –zone=public –permanent –add-port=1194/tcp
sudo firewall-cmd –zone=public –permanent –add-port=1194/udp
sudo firewall-cmd –zone=public –permanent –add-port=943/udp
sudo firewall-cmd –zone=public –permanent –add-port=943/tcp
sudo firewall-cmd –add-masquerade –permanent
sudo firewall-cmd –reload

 

CHANGE SSHD PORT:
sudo vim /etc/ssh/sshd_config
#insert Port 10001
sudo service sshd restart

 

INSTALL OPENVPN:
cd
mkdir temp
cd temp/
wget https://…URL…to…openvpn.rpm
sudo rpm -i openvpn…rpm
sudo passwd openvpn
#enter new password
reboot

 

AFTER TRYING TO START OPENVPN SERVER:
Error:
process started and then immediately exited:
[‘Tue Feb 27 11:40:05 2018 Linux ifconfig failed: could not execute external program’]
service failed to start or returned error status
process started and then immediately exited:
[‘Tue Feb 27 11:40:05 2018 Linux ifconfig failed: could not execute external program’]
service failed to start or returned error status
#Looks like it needs ifconfig

ANSWER:
sudo yum install net-tools

 

—————————————————————-
WOULD YOU LIKE IPTABLES INSTEAD? …use this:
—————————————————————-

 

SERVER SETUP:
sudo yum -y update
# net-tools install resolves errors explained later
sudo yum install vim screen wget iptables-services net-tools
sestatus
#change selinux=disabled
sudo vim /etc/selinux/config

 

 

IPTABLES SETUP:
#…iptables commands
sudo systemctl start iptables
sudo systemctl enable iptables
sudo iptables -I INPUT -m tcp -p tcp –dport 22 -j ACCEPT
sudo iptables -I INPUT -m tcp -p tcp –dport 80 -j ACCEPT
sudo iptables -I INPUT -m tcp -p tcp –dport 443 -j ACCEPT
sudo iptables -I INPUT -m tcp -p tcp –dport 943 -j ACCEPT
sudo iptables -I INPUT -m tcp -p tcp –dport 1194 -j ACCEPT
sudo iptables -I INPUT -p udp –dport 1194 -j ACCEPT
sudo iptables -I INPUT -p udp –dport 943 -j ACCEPT
sudo iptables -I INPUT -m tcp -p tcp –dport 10867 -j ACCEPT
sudo service iptables save
sudo iptables -L
reboot

 

INSTALL OPENVPN:
mkdir temp
cd temp/
wget https://…URL…to…openvpn.rpm
sudo rpm -i openvpn.rpm
sudo passwd openvpn
#enter new password
reboot

 

AFTER TRYING TO START OPENVPN SERVER:
process started and then immediately exited:
[‘Tue Feb 27 12:42:38 2018 Linux ifconfig failed: could not execute external program’]
service failed to start or returned error status
process started and then immediately exited:
[‘Tue Feb 27 12:42:38 2018 Linux ifconfig failed: could not execute external program’]
service failed to start or returned error status

ANSWER:
sudo yum install net-tools