-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.php
151 lines (111 loc) · 3.1 KB
/
server.php
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
include __DIR__ . '/assets/header.php';
$RandomBytes = false;
$OpenSSL = false;
$Secure = false;
//// RandomBytes
$RandomBytes_Block = '
<div class="clear"></div>
<div class="left">
<p>RandomBytes</p>
</div>
<div class="right">
<p>RandomBytes is used for secure key generation.</p>';
if (function_exists('random_bytes')) {
$RandomBytes = true;
$Secure = true;
$RandomBytes_Block .= '
<p class="color-flatui-nephritis">Available</p>';
} else {
$RandomBytes_Block .= '
<p class="color-flatui-pomegranate">Not Available</p>';
}
$RandomBytes_Block .= '
</div>';
//// OpenSSL
$OpenSSL_Block = '
<div class="clear"></div>
<div class="left">
<p>OpenSSL</p>
</div>
<div class="right">
<p>OpenSSL is used as a fallback for secure key generation.</p>';
if (function_exists('openssl_random_pseudo_bytes')) {
openssl_random_pseudo_bytes(1, $Strong);
if ($Strong) {
$OpenSSL = true;
$Secure = true;
$OpenSSL_Block .= '
<p class="color-flatui-nephritis">Installed, Secure.</p>';
} else {
$OpenSSL_Block .= '
<p class="color-flatui-pomegranate">Installed, Insecure.</p>';
}
} else {
$OpenSSL_Block .= '
<p class="color-flatui-pomegranate">Not Installed</p>';
}
$OpenSSL_Block .= '
</div>';
//// Security
$Security_Block = '
<div class="clear break"></div>
<div class="left">
<h3> </h3>
<p>Status</p>
<p>Information</p>
</div>
<div class="right">
<h3>Security</h3>';
if ($RandomBytes) {
$Security_Block .= '
<p class="color-flatui-nephritis"><strong>Your installation will use RandomBytes.</strong></p>';
if ($MCrypt) {
$Security_Block .= '
<p>MCrypt is available as a fallback if necessary.</p>';
}
if ($OpenSSL) {
$Security_Block .= '
<p>OpenSSL is available as a fallback if necessary.</p>';
}
} elseif ($OpenSSL) {
$Security_Block .= '
<p class="color-flatui-nephritis"><strong>Your installation will use OpenSSL.</strong></p>
<p>This is the second best option, maybe try upgrading to PHP 8.x or installing <code>php[version]-mcrypt</code> ?</p>';
} else {
$Security_Block .= '
<p class="color-flatui-pomegranate"><strong>Your installation will not work.</strong></p>
<p>Maybe try upgrading your PHP version, or installing <code>php[version]-mcrypt</code> or <code>openssl</code> ?</p>';
}
$Security_Block .= '
</div>';
//// GD
$GD_Block = '
<div class="clear break"></div>
<div class="left">
<h3> </h3>
<p>Status</p>
<p>Information</p>
</div>
<div class="right">
<h3>GD</h3>';
if (
extension_loaded('gd') &&
function_exists('gd_info')
) {
$GD_Block .= '
<p class="color-flatui-nephritis">The GD functions are loaded. You can create QR Codes.</p>
<p>The GD extension is used for generating a secure QR code.</p>';
} else {
$GD_Block .= '
<p class="color-flatui-pomegranate">The GD functions are not loaded. You cannot create QR Codes.</p>
<p>The GD extension is used for generating a secure QR code.</p>
<p>Try installing <code>php[version]-gd</code> in Ubuntu.</p>';
}
$GD_Block .= '
</div>';
echo $Security_Block;
echo $RandomBytes_Block;
echo $OpenSSL_Block;
echo $GD_Block;
include __DIR__ . '/assets/footer.php';