Skip to content

Commit 9825111

Browse files
authored
Merge pull request #20 from Wutze/devel
fix Request #19
2 parents 934fd2a + f459cca commit 9825111

File tree

9 files changed

+86
-35
lines changed

9 files changed

+86
-35
lines changed

include/config.sample.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121

2222
(stripos($_SERVER['PHP_SELF'], basename(__FILE__)) === false) or die('access denied?');
2323

24-
$host = '';
25-
$port = '3306';
26-
$db = '';
27-
$user = '';
28-
$pass = '';
24+
$dbhost = '';
25+
$dbport = '3306';
26+
$dbname = '';
27+
$dbuser = '';
28+
$dbpass = '';
2929
$dbtype = 'mysqli';
3030
$dbdebug = FALSE;
3131
$sessdebug = FALSE;

include/load.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636

3737
require_once(REAL_BASE_DIR."/include/config.php");
3838
## User and Database Data
39-
define('_DB_UNAME',$user);
40-
define('_DB_PW',$pass);
41-
define('_DB_DB',$db);
42-
define('_DB_SERVER',$host);
39+
define('_DB_UNAME',$dbuser);
40+
define('_DB_PW',$dbpass);
41+
define('_DB_DB',$dbname);
42+
define('_DB_SERVER',$dbhost);
4343
define('_DB_TYPE',$dbtype);
44-
define('_DB_PORT',$port);
44+
define('_DB_PORT',$dbport);
4545
define('_DB_DEBUG',$dbdebug);
4646
define('_SESSION_DEBUG',$sessdebug);
4747

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22

33
# MySQL credentials
4-
HOST=''
5-
PORT='3306'
6-
USER=''
7-
PASS=''
8-
DB=''
4+
DBHOST=''
5+
DBPORT='3306'
6+
DBUSER=''
7+
DBPASS=''
8+
DBNAME=''

installation/scripts/connect.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fi
2424

2525

2626
# We insert data in the log table
27-
mysql -h$HOST -P$PORT -u$USER -p$PASS $DB -e "INSERT INTO log (log_id, user_id, log_trusted_ip, log_trusted_port, log_remote_ip, log_remote_port, log_start_time, log_end_time, log_received, log_send) VALUES(NULL, '$common_name','$trusted_ip', '$trusted_port','$ifconfig_pool_remote_ip', '$remote_port_1', now(),NULL, '$bytes_received', '$bytes_sent')"
27+
mysql -h$DBHOST -P$DBPORT -u$DBUSER -p$DBPASS $DBNAME -e "INSERT INTO log (log_id, user_id, log_trusted_ip, log_trusted_port, log_remote_ip, log_remote_port, log_start_time, log_end_time, log_received, log_send) VALUES(NULL, '$common_name','$trusted_ip', '$trusted_port','$ifconfig_pool_remote_ip', '$remote_port_1', now(),NULL, '$bytes_received', '$bytes_sent')"
2828

2929
# We specify that the user is online
30-
mysql -h$HOST -P$PORT -u$USER -p$PASS $DB -e "UPDATE user SET user_online=1 WHERE user_id='$common_name'"
30+
mysql -h$DBHOST -P$DBPORT -u$DBUSER -p$DBPASS $DBNAME -e "UPDATE user SET user_online=1 WHERE user_id='$common_name'"

installation/scripts/disconnect.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ trusted_ip=$(echap "$trusted_ip")
99
trusted_port=$(echap "$trusted_port")
1010

1111
# We specify the user is offline
12-
mysql -h$HOST -P$PORT -u$USER -p$PASS $DB -e "UPDATE user SET user_online=0 WHERE user_id='$common_name'"
12+
mysql -h$DBHOST -P$DBPORT -u$DBUSER -p$DBPASS $DBNAME -e "UPDATE user SET user_online=0 WHERE user_id='$common_name'"
1313

1414
# We insert the deconnection datetime
15-
mysql -h$HOST -P$PORT -u$USER -p$PASS $DB -e "UPDATE log SET log_end_time=now(), log_received='$bytes_received', log_send='$bytes_sent' WHERE log_trusted_ip='$trusted_ip' AND log_trusted_port='$trusted_port' AND user_id='$common_name' AND log_end_time IS NULL"
15+
mysql -h$DBHOST -P$DBPORT -u$DBUSER -p$DBPASS $DBNAME -e "UPDATE log SET log_end_time=now(), log_received='$bytes_received', log_send='$bytes_sent' WHERE log_trusted_ip='$trusted_ip' AND log_trusted_port='$trusted_port' AND user_id='$common_name' AND log_end_time IS NULL"
16+
17+
echo $(date '+%a %b %d %H:%M:%S %Y')" [ovpn] disconnect $common_name: [QUIT]"

installation/scripts/login.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,24 @@
55
username=$(echap "$username")
66
password=$(echap "$password")
77

8+
echo $(date '+%a %b %d %H:%M:%S %Y')" [ovpn] Start Login Process for: $username: [INFO]"
9+
810
# Authentication
9-
user_pass=$(mysql -h$HOST -P$PORT -u$USER -p$PASS $DB -sN -e "SELECT user_pass FROM user WHERE user_id = '$username' AND user_enable=1 AND (TO_DAYS(now()) >= TO_DAYS(user_start_date) OR user_start_date IS NULL) AND (TO_DAYS(now()) <= TO_DAYS(user_end_date) OR user_end_date IS NULL)")
11+
user_pass=$(mysql -h$DBHOST -P$DBPORT -u$DBUSER -p$DBPASS $DBNAME -sN -e "SELECT user_pass FROM user WHERE user_id = '$username' AND user_enable=1 AND (TO_DAYS(now()) >= TO_DAYS(user_start_date) OR user_start_date IS NULL) AND (TO_DAYS(now()) <= TO_DAYS(user_end_date) OR user_end_date IS NULL)")
1012

1113
# Check the user
14+
# write log entry
1215
if [ "$user_pass" == '' ]; then
13-
echo "$username: bad account."
16+
echo $(date '+%a %b %d %H:%M:%S %Y')" [ovpn] $username: authentication: [ERROR] bad account"
1417
exit 1
1518
fi
1619

1720
result=$(php -r "if(password_verify('$password', '$user_pass') == true) { echo 'ok'; } else { echo 'ko'; }")
1821

1922
if [ "$result" == "ok" ]; then
20-
echo "$username: authentication ok."
23+
echo $(date '+%a %b %d %H:%M:%S %Y')" [ovpn] $username: authentication: [OK]"
2124
exit 0
2225
else
23-
echo "$username: authentication failed."
26+
echo $(date '+%a %b %d %H:%M:%S %Y')" [ovpn] $username: authentication: [ERROR] failed"
2427
exit 1
2528
fi

lang/de_DE

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,32 @@ SETFIN02="Um die Installation zu beenden, konfiguriere bitte Deinen Webserver (A
7878
SETFIN03="Du musst den Server neu starten, da OpenVPN sonst nicht korrekt funktioniert!"
7979
SETFIN04="Fragen, Antworten, Wünsche, Fehler bitte da mitteilen: https://github.com/Wutze/OpenVPN-WebAdmin/issues"
8080

81-
82-
83-
84-
85-
86-
87-
88-
89-
90-
91-
81+
### Update Variablen
82+
UPSEL00="Update Informationen"
83+
UPSEL01="Update von Version 0.8 zu 1.1.0"
84+
UPSEL02="Generelles Update System 1.1.x"
85+
UPSEL03=""
86+
UPSEL04="Fragen zur Installation"
87+
88+
UPVERSIO="Installierte Version "
89+
UPDBHOST="Datenbankhost * "
90+
UPDBUSER="Datenbank Benutzer * "
91+
UPDBPASS="Datenbankpasswort * "
92+
UPDBNAME="Datenbank Name * "
93+
UPWEBDIR="Webverzeichnis * "
94+
UPWEBROO="Webroot * "
95+
UPPATHOW="Eigentümer "
96+
UPMASHID="Installiert auf Machine-ID "
97+
INSTALLD="Installiert am "
98+
UPDATAOK="* Angaben erforderlich!
99+
100+
Alle Angaben korrekt?"
101+
102+
UPDATEINF01="Bitte mache VOR Beginn dieses Updates von Deinem Server ein Backup. Trotz aller Tests die ich durchführen kann,
103+
kann ich keine Fehler auf Deinem Server sehen um darauf entsprechend reagieren.
104+
105+
Mit diesem Update werden jedoch einige Funktionalitäten eingeführt, die ein späteres Backup möglich machen.
106+
107+
Weiter machen?
92108
"
109+
UPDATEINF02="Kontolle der Variablen"

lang/en_EN

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,35 @@ SETFIN03="You must restart the server, otherwise OpenVPN will not work correctly
7979
SETFIN04="Questions, answers, wishes, mistakes please communicate there: https://github.com/Wutze/OpenVPN-WebAdmin/issues"
8080

8181

82+
### Update variables
83+
UPSEL00="Update Information"
84+
UPSEL01="Update from Version 0.8 to 1.1.0"
85+
UPSEL02="General Update System 1.1.x"
86+
UPSEL03=""
87+
UPSEL04="Installation Questions"
88+
89+
UPVERSIO="Installed Version "
90+
UPDBHOST="Database host * "
91+
UPDBUSER="Database user * "
92+
UPDBPASS="Database password * "
93+
UPDBNAME="Database Name * "
94+
UPWEBDIR="Web directory * "
95+
UPWEBROO="Webroot * "
96+
UPPATHOW="Owner "
97+
UPMASHID="Installed on Machine ID "
98+
INSTALLD="Installed on "
99+
UPDATAOK="* Information required!
100+
101+
All data correct?"
102+
103+
UPDATEINF01="Please make a backup of your server BEFORE starting this update. Despite all the tests I can do,
104+
I can't see any errors on your server to react accordingly.
105+
106+
However, this update introduces some functionality that makes a later backup possible.
107+
108+
Continue?
109+
"
110+
UPDATEINF02="Control of variables"
82111

83112

84113

update.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ write_config(){
471471
main(){
472472

473473
# select language german or english
474-
sel_lang
474+
sel_lang
475475
# main logo
476476
intro
477477
if_updatefile_exist

0 commit comments

Comments
 (0)