🔒 Closed [release] simple openvpn panel (m4vpn)

Status
Not open for further replies.
boss na access ko na yung phpmyadmin ko.. saan ko iimport yan? sorry pi newbie kasi.. hehe thanks

1. Create Database
upload_2019-1-11_17-25-2.png
2. click your newly created database
upload_2019-1-11_17-25-44.png
3. Navigate to Import Tab
upload_2019-1-11_17-26-12.png
4. Browse the file you wish to import and click GO
upload_2019-1-11_17-26-40.png
 
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)


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?
 
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
Code:
$ su
$ cp -r /usr/share/easy-rsa/ /etc/openvpn
$ mkdir /etc/openvpn/easy-rsa/keys
$ nano /etc/openvpn/easy-rsa/vars
(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.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
idaan mo na lng boss sa autoscript.
 
Status
Not open for further replies.

About this Thread

  • 105
    Replies
  • 8K
    Views
  • 54
    Participants
Last reply from:
lilpatotie

Online now

Members online
1,014
Guests online
1,339
Total visitors
2,353

Forum statistics

Threads
2,272,845
Posts
28,945,751
Members
1,236,436
Latest member
leonard12312
Back
Top