-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequest.php
executable file
·313 lines (308 loc) · 12.5 KB
/
request.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
<?php
/**
* @version 1.0.0
* @package cab-csr-validator
* @copyright Copyright (C) 2012. All rights reserved.
* @license Licensed under the Apache License, Version 2.0 or later; see LICENSE.md
* @author Swisscom (Schweiz) AG
*/
define('__ROOT__', dirname(__FILE__));
require_once(__ROOT__.'/helpers/app.php');
require_once(__ROOT__.'/helpers/validator-helper.php');
/* New instance of the app class */
$app = new validator_app();
/* New instance of the validator class */
$validator = new validator_helper();
/* Do the request check */
if ($validator->checkRequest()) {
$response_success = true;
}
?>
<!DOCTYPE html>
<html lang="<?php echo $app->language; ?>">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo $app->getText('TITLE'); ?></title>
<!-- Bootstrap -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/custom.css" rel="stylesheet">
</head>
<body>
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="page-header">
<h1><?php echo $app->getText('APP_TITLE'); ?></h1>
</div>
<?php if ($validator->csr_subject) { ?>
<table class="table table-bordered">
<h2><?php echo $app->getText('APP_REQUEST_SUBJECT_SUBJECT'); ?></h2>
<thead>
<tr>
<th class="col-md-5"><?php echo $app->getText('APP_REQUEST_SUBJECT_RDN'); ?></th>
<th><?php echo $app->getText('APP_REQUEST_SUBJECT_VALUE'); ?></th>
</tr>
</thead>
<tbody>
<?php if (strlen($validator->csr_cn)) { ?>
<tr>
<td><?php echo $app->getText('APP_REQUEST_SUBJECT_CN'); ?></td>
<td><?php echo $validator->csr_cn; ?></td>
</tr>
<?php } ?>
<?php if (strlen($validator->csr_email)) { ?>
<tr>
<td><?php echo $app->getText('APP_REQUEST_SUBJECT_EMAIL'); ?></td>
<td><?php echo $validator->csr_email; ?></td>
</tr>
<?php } ?>
<?php if (strlen($validator->csr_o)) { ?>
<tr>
<td><?php echo $app->getText('APP_REQUEST_SUBJECT_O'); ?></td>
<td><?php echo $validator->csr_o; ?></td>
</tr>
<?php } ?>
<?php if (count($validator->csr_ou)) { ?>
<?php foreach($validator->csr_ou as $ou) { ?>
<tr>
<td><?php echo $app->getText('APP_REQUEST_SUBJECT_OU'); ?></td>
<td><?php echo $ou; ?></td>
</tr>
<?php } ?>
<?php } ?>
<?php if (strlen($validator->csr_l)) { ?>
<tr>
<td><?php echo $app->getText('APP_REQUEST_SUBJECT_L'); ?></td>
<td><?php echo $validator->csr_l; ?></td>
</tr>
<?php } ?>
<?php if (count($validator->csr_st)) { ?>
<?php foreach($validator->csr_st as $st) { ?>
<tr>
<td><?php echo $app->getText('APP_REQUEST_SUBJECT_ST'); ?></td>
<td><?php echo $st; ?></td>
</tr>
<?php } ?>
<?php } ?>
<?php if (strlen($validator->csr_s)) { ?>
<tr>
<td><?php echo $app->getText('APP_REQUEST_SUBJECT_S'); ?></td>
<td><?php echo $validator->csr_s; ?></td>
</tr>
<?php } ?>
<?php if (strlen($validator->csr_c)) { ?>
<tr>
<td><?php echo $app->getText('APP_REQUEST_SUBJECT_C'); ?></td>
<td><?php echo $validator->csr_c; ?></td>
</tr>
<?php } ?>
<?php if ($validator->csr_keysize) { ?>
<tr>
<td><?php echo $app->getText('APP_REQUEST_KEY_SIZE'); ?></td>
<td><?php echo $validator->csr_keysize.'-bits'; ?></td>
</tr>
<?php } ?>
<?php if (count($validator->csr_sans)) { ?>
<?php $i = 1; ?>
<?php foreach($validator->csr_sans as $san) { ?>
<tr>
<td><?php echo $app->getText('APP_REQUEST_SAN').' '.$i; ?></td>
<td><?php echo $san; ?></td>
</tr>
<?php $i++; ?>
<?php } ?>
<?php } ?>
</tbody>
</table>
<?php } ?>
<?php if ($validator->csr_domains) { ?>
<table class="table table-bordered">
<h2><?php echo $app->getText('APP_REQUEST_DOMAINS'); ?></h2>
<thead>
<tr>
<th class="col-md-5"><?php echo $app->getText('APP_REQUEST_SUBJECT_RDN'); ?></th>
<th><?php echo $app->getText('APP_REQUEST_SUBJECT_VALUE'); ?></th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php foreach($validator->csr_domains as $domain) { ?>
<tr>
<td><?php echo $app->getText('APP_REQUEST_DOMAIN').' '.$i; ?></td>
<td>
<?php if (isset($domain["server"])) { ?>
<a href="#" data-toggle="modal" data-target="#modal_domains_<?php echo $i; ?>"><?php echo $domain["domain"]; ?></a>
<div class="modal fade" id="modal_domains_<?php echo $i; ?>" tabindex="-1" role="dialog" aria-labelledby="modal_domains_<?php echo $i; ?>_label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"><?php echo $domain["domain"]; ?></h4>
</div>
<div class="modal-body">
<?php echo $domain["whois"]; ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $app->getText('APP_REQUEST_DOMAIN_CLOSE'); ?></button>
</div>
</div>
</div>
</div>
<a href="<?php echo 'http://'.$domain["server"]; ?>" target="_blank" title="<?php echo $app->getText('APP_REQUEST_DOMAIN_WHOIS'); ?>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></a>
<?php } else { ?>
<?php echo $domain["domain"]; ?>
<?php } ?>
</td>
</tr>
<?php $i++; ?>
<?php } ?>
</tbody>
</table>
<?php } ?>
<?php if ($validator->csr_ips) { ?>
<table class="table table-bordered">
<h2><?php echo $app->getText('APP_REQUEST_IPS'); ?></h2>
<thead>
<tr>
<th class="col-md-5"><?php echo $app->getText('APP_REQUEST_SUBJECT_RDN'); ?></th>
<th><?php echo $app->getText('APP_REQUEST_SUBJECT_VALUE'); ?></th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php foreach($validator->csr_ips as $ip) { ?>
<tr>
<td><?php echo $app->getText('APP_REQUEST_IP').' '.$i; ?></td>
<td>
<?php if (isset($ip["server"])) { ?>
<a href="#" data-toggle="modal" data-target="#modal_ips_<?php echo $i; ?>"><?php echo $ip["domain"]; ?></a>
<div class="modal fade" id="modal_ips_<?php echo $i; ?>" tabindex="-1" role="dialog" aria-labelledby="modal_ips_<?php echo $i; ?>_label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"><?php echo $ip["domain"]; ?></h4>
</div>
<div class="modal-body">
<?php echo $ip["whois"]; ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $app->getText('APP_REQUEST_DOMAIN_CLOSE'); ?></button>
</div>
</div>
</div>
</div>
<a href="<?php echo 'http://'.$ip["server"]; ?>" target="_blank" title="<?php echo $app->getText('APP_REQUEST_DOMAIN_WHOIS'); ?>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></a>
<?php } else { ?>
<?php echo $ip["domain"]; ?>
<?php } ?>
</td>
</tr>
<?php $i++; ?>
<?php } ?>
</tbody>
</table>
<?php } ?>
<?php if ($validator->response_checks) { ?>
<table class="table table-bordered">
<h2><?php echo $app->getText('APP_REQUEST_CHECKS'); ?></h2>
<thead>
<tr>
<th class="col-md-1"><?php echo $app->getText('APP_REQUEST_TEST_HEADER_1'); ?></th>
<th class="col-md-4"><?php echo $app->getText('APP_REQUEST_TEST_HEADER_2'); ?></th>
<th><?php echo $app->getText('APP_REQUEST_TEST_HEADER_3'); ?></th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php foreach($validator->response_checks as $response_check) { ?>
<tr class="<?php echo $response_check["result"] ? 'success' : 'danger'; ?>">
<td><?php echo $i; ?></td>
<td><?php echo '<strong>'.$response_check["check"].'</strong>'; ?></td>
<td>
<?php if (isset($response_check["detail"])) { ?>
<?php echo '<em>'.$response_check["result_msg"].'</em>, '.$response_check["detail"]; ?>
<?php } else { ?>
<?php echo '<em>'.$response_check["result_msg"].'</em>'; ?>
<?php } ?>
</td>
</tr>
<?php $i++; ?>
<?php } ?>
</tbody>
</table>
<?php } ?>
<?php if ($validator->response_results) { ?>
<table class="table table-bordered">
<h2><?php echo $app->getText('APP_REQUEST_RESULTS'); ?></h2>
<thead>
<tr>
<th class="col-md-1"><?php echo $app->getText('APP_REQUEST_TEST_HEADER_1'); ?></th>
<th class="col-md-4"><?php echo $app->getText('APP_REQUEST_TEST_HEADER_2'); ?></th>
<th><?php echo $app->getText('APP_REQUEST_TEST_HEADER_3'); ?></th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php foreach($validator->response_results as $response_result) { ?>
<tr class="<?php echo $response_result["result"] ? 'success' : 'danger'; ?>">
<td><?php echo $i; ?></td>
<td><?php echo '<strong>'.$response_result["check"].'</strong>'; ?></td>
<td>
<?php if (isset($response_result["detail"])) { ?>
<?php echo '<em>'.$response_result["result_msg"].'</em>, '.$response_result["detail"]; ?>
<?php } else { ?>
<?php echo '<em>'.$response_result["result_msg"].'</em>'; ?>
<?php } ?>
</td>
</tr>
<?php $i++; ?>
<?php } ?>
</tbody>
</table>
<?php } ?>
</div>
</div>
</div>
</div>
<div class="container">
<div class="span12 centered-text">
<div>
<a href="#" data-toggle="modal" data-target="#modal_openssl"><?php echo $app->getText('APP_REQUEST_OPENSSL_DETAIL'); ?></a>
<div class="modal fade" id="modal_openssl" tabindex="-1" role="dialog" aria-labelledby="modal_openssl_label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"><?php echo $validator->file_path; ?></h4>
</div>
<div class="modal-body openssl">
<?php echo $validator->openssl_output; ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $app->getText('APP_REQUEST_DOMAIN_CLOSE'); ?></button>
</div>
</div>
</div>
</div>
</div>
<div>
<p class="text-muted"><?php echo str_replace('%s', number_format($validator->duration, 3), $app->getText('APP_SUBMIT_SUCCESS_DURATION')); ?></p>
</div>
<a class="btn btn-default active" href="index.php" role="button"><?php echo $app->getText('APP_REQUEST_BACK'); ?></a>
</div>
</div>
<div class="footer">
<div class="col-md-6 col-md-offset-1 container">
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/validator.js"></script>
</body>
</html>