WraithKing0831
Elite
thanks po
yung 2.2.2.2 palitan mo ng ip ng vps molaging ganito
"Can't connect to MySQL server on '2.2.2.2' (110)
authentication failed."
Sge test ko ulityung 2.2.2.2 palitan mo ng ip ng vps mo
How to install OpenVPN Server for M4VPN Panel
Requirements:
x VPS w/ Root Access (Ubuntu 14.04)
x Server-Side Certificate & Key
x Common Sense
Note:
ctrl + x para magsave ng file sa nano
Installation:
1. Update your System Application's
Code:$ su $ apt-get update $ apt-get upgrade -y
2. Install the Required Applications
Code:$ apt-get install openvpn squid3 mysql-client ufw nano -y
3. Packet Forwarding
Code:$ echo 1 > /proc/sys/net/ipv4/ip_forward $ nano /etc/sysctl.conf (hanapin nyo yung net.ipv4.ip_forward=1 at tangalin yung #)
4. Configure Firewall
Code:$ ufw allow ssh $ ufw allow 443/tcp $ ufw allow 8080/tcp $ nano /etc/default/ufw (hanapin nyo yung DEFAULT_FORWARD_POLICY="DROP" at palitan yung "DROP" ng "ACCEPT") $ nano /etc/ufw/before.rules (idagdag nyo yung openvpn rules sa loob) # # rules.before # # Rules that should be run before the ufw command line added rules. Custom # rules should be added to one of these chains: # ufw-before-input # ufw-before-output # ufw-before-forward # # START OPENVPN RULES # NAT table rules *nat :POSTROUTING ACCEPT [0:0] # Allow traffic from OpenVPN client to eth0 -A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE COMMIT # END OPENVPN RULES # Don't delete these required lines, otherwise there will be errors *filter $ ufw enable
5. Add your Certificate, Key and Server Configuration
Code:Wait nyo yung next tutorial ko pano gumawa ng isang certificate and key para sa lahat ng server)
6. Add Authentication Script for M4VPN Panel
Code:$ mkdir /etc/openvpn/script $ cd /etc/openvpn/script $ nano database.sh #!/bin/bash HOST='2.2.2.2' PORT='3306' USER='USERNAME' #username ng database PASS='PASSWORD' #password ng database DB='m4vpn-panel' $ nano test.sh #!/bin/bash . /etc/openvpn/script/database.sh username=$1 password=$2 status=$(mysql -h$HOST -P$PORT -u$USER -p$PASS $DB -sN -e "SELECT user_name FROM user WHERE user_name = '$username' AND user_pass = '$password' AND user_duration>0") [ "$status" != '' ] && [ "$status" = "$username" ] && echo 'authentication ok' && exit 0 || echo 'authentication failed.'; exit 1 $ chmod 755 * $ ./test.sh (username sa panel) (password sa panel) (EXAMPLE: ./test.sh admin admin) (pag authentication ok, ibig sabihin ok na sya) $ nano login.sh #!/bin/bash . /etc/openvpn/script/database.sh status=$(mysql -h$HOST -P$PORT -u$USER -p$PASS $DB -sN -e "SELECT user_name FROM user WHERE user_name = '$username' AND user_pass = '$password' AND user_duration>0") [ "$status" != '' ] && [ "$status" = "$username" ] && echo 'authentication ok' && exit 0 || echo 'authentication failed.'; exit 1 $ chmod /etc/openvpn/*
7. Start OpenVPN Server
Code:$ service openvpn start $ service openvpn status (dapat running sya)
idaan mo na lng boss sa autoscript.How to Generate one Certificate and Keys for all server
Note: You must generate the certificate and keys inside one of your OpenVPN Server.
1. Prepare the Generator
(The variables below marked in red should be changed according to your preference.)Code:$ su $ cp -r /usr/share/easy-rsa/ /etc/openvpn $ mkdir /etc/openvpn/easy-rsa/keys $ nano /etc/openvpn/easy-rsa/vars
export KEY_COUNTRY="PH"
export KEY_PROVINCE="MNL"
export KEY_CITY="Manila"
export KEY_ORG="M4VPN"
export KEY_EMAIL="m4rshall@phcorner.org"
export KEY_OU="PHCorner"
(Then change export KEY_NAME value to server)
export KEY_NAME="server"
2. Generate Diffie-Hellman
Code:$ openssl dhparam -out /etc/openvpn/dh2048.pem 2048
3. Generate the Certificate
Code:$ ./build-ca $ ./build-key-server server $ ./build-key client
4. Move the Certificates and Keys to OpenVPN Directory
Code:$ mv /etc/openvpn/easy-rsa/keys /etc/openvpn
sir don sa section na database.sh
#!/bin/bash
HOST='2.2.2.2'
PORT='3306'
USER='USERNAME' #username ng database
PASS='PASSWORD' #password ng database
DB='m4vpn-panel'
2.2.2.2 bha talaga ito or VPSIP?
testing VPSIP not workingsame problem din sakin
testing VPSIP not working