Sorry natagalan ginagawa ko pa yung Reseller Panel
ginagawa ko na yung tutorial.
Hindi po ko full time sa sharing kaya "pasensya" na may iba ding ginagawa po kase.
Sorry natagalan ginagawa ko pa yung Reseller Panel
ginagawa ko na yung tutorial.
Hindi po ko full time sa sharing kaya "pasensya" na may iba ding ginagawa po kase.
$ 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)
$ 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)
(The variables below marked in red should be changed according to your preference.)
export KEY_COUNTRY="PH"
export KEY_PROVINCE="MNL"
export KEY_CITY="Manila"
export KEY_ORG="M4VPN"
export KEY_EMAIL="m4rshall@phcorner.net"
export KEY_OU="PHCorner"
(Then change export KEY_NAME value to server)
export KEY_NAME="server"
(The variables below marked in red should be changed according to your preference.)
export KEY_COUNTRY="PH"
export KEY_PROVINCE="MNL"
export KEY_CITY="Manila"
export KEY_ORG="M4VPN"
export KEY_EMAIL="m4rshall@phcorner.net"
export KEY_OU="PHCorner"
(Then change export KEY_NAME value to server)
export KEY_NAME="server"
boss may ksma nabang access sa database yan?ung invisible database kaya ba i access anung ittype?and anung database gamit mo hehe peace... sorry na di nako mag OCS haha