-
Notifications
You must be signed in to change notification settings - Fork 5
/
action-downloadconfigfile.inc
70 lines (63 loc) · 1.81 KB
/
action-downloadconfigfile.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
if (!defined ("LOCAL_SECURITY_KEY"))
die ();
include_once ('include/openvpn-functions.inc');
include_once ('include/openssl-functions.inc');
openvpn_load_server_conf ();
if (!isset ($openvpn['Server'])) html_error ("The OpenVPN server has no configuration file");
openvpn_load_status ();
if (!isset ($openvpn['Server']['Title'])) html_error ("The OpenVPN server has no status file");
openssl_load_database ();
// Check permissions :)
//if (($sCertificateFile = openssl_get_filename ($GETid)) == '') html_error ("You are not authorized to download that certificate");
if (isset ($GETid))
{
if ($GETid == 'DH' )
{
$sFile = $openvpn['Server']['DH']['File'];
$bFile = $openvpn['Server']['DH']['Exists'];
}
elseif ($GETid == 'CA' )
{
$sFile = $openssl['Server']['CA']['File'];
$bFile = $openssl['Server']['CA']['Exists'];
}
elseif ($GETid == 'CRT')
{
$sFile = $openvpn['Server']['Certificate']['File'];
$bFile = $openvpn['Server']['Certificate']['Exists'];
}
elseif ($GETid == 'KEY')
{
$sFile = $openvpn['Server']['Private_Key']['File'];
$bFile = $openvpn['Server']['Private_Key']['Exists'];
}
elseif ($GETid == 'TLS')
{
$sFile = $openvpn['Server']['TLS_Auth']['File'];
$bFile = $openvpn['Server']['TLS_Auth']['Exists'];
}
elseif ($GETid == 'CRL')
{
$sFile = $openvpn['Server']['CRL_Verify']['File'];
$bFile = $openvpn['Server']['CRL_Verify']['Exists'];
}
else
{
$sFile = '';
$bFile = '';
}
if ($sFile != '')
if ($bFile)
if (is_readable ($sFile))
html_download ($sFile, basename ($sFile));
else
html_error ("Can't read the file '$sFile'.<br>Probably it should not be read by anybode except it's owner?");
else
html_error ("The file '$sFile' does not exist.");
else
html_error ('Wrong ID. Stop hacking.');
}
else
html_error ('The ID is not defined. Stop hacking.');
?>