Révision 17402c63
Ajouté par Ermal il y a plus de 9 ans
usr/local/www/diag_ipsec.php | ||
---|---|---|
52 | 52 |
include("head.inc"); |
53 | 53 |
require("ipsec.inc"); |
54 | 54 |
|
55 |
if ($_GET['act'] == "connect") { |
|
56 |
if (is_ipaddrv4($_GET['remoteid']) && is_ipaddrv4($_GET['source'])) { |
|
57 |
exec("/sbin/ping -S " . escapeshellarg($_GET['source']) . " -c 1 " . escapeshellarg($_GET['remoteid'])); |
|
55 |
if ($_GET['act'] == 'connect') { |
|
56 |
if (ctype_digit($_GET['ikeid'])) { |
|
57 |
mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid'])); |
|
58 |
mwexec("/usr/local/sbin/ipsec up con" . escapeshellarg($_GET['ikeid'])); |
|
58 | 59 |
} |
59 |
else if (is_ipaddrv6($_GET['remoteid']) && is_ipaddrv6($_GET['source'])) { |
|
60 |
exec("/sbin/ping6 -S " . escapeshellarg($_GET['source']) . " -c 1 " . escapeshellarg($_GET['remoteid'])); |
|
60 |
} else if ($_GET['act'] == 'ikedisconnect') { |
|
61 |
if (ctype_digit($_GET['ikeid'])) { |
|
62 |
mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid'])); |
|
61 | 63 |
} |
62 |
} |
|
63 |
|
|
64 |
if ($_GET['act'] == "disconnect") { |
|
64 |
} else if ($_GET['act'] == 'disconnect') { |
|
65 | 65 |
if (!empty($_GET['user'])) { |
66 | 66 |
ipsec_disconnect_mobile($_GET['user']); |
67 | 67 |
sleep(1); |
... | ... | |
107 | 107 |
<th class="listhdrr nowrap"><?php echo gettext("Remote IP");?></th> |
108 | 108 |
<th class="listhdrr nowrap"><?php echo gettext("Role");?></th> |
109 | 109 |
<th class="listhdrr nowrap"><?php echo gettext("Status");?></th> |
110 |
<td class="list nowrap"></td> |
|
110 | 111 |
</tr> |
111 | 112 |
</thead> |
112 | 113 |
<tbody> |
113 | 114 |
<?php |
114 | 115 |
if (is_array($status['query']) && is_array($status['query']['ikesalist']) && is_array($status['query']['ikesalist']['ikesa'])) { |
115 | 116 |
foreach ($status['query']['ikesalist']['ikesa'] as $ikeid => $ikesa) { |
117 |
if (ipsec_phase1_status($status['query']['ikesalist']['ikesa'], $ikesa['id'])) { |
|
118 |
$icon = "pass"; |
|
119 |
} elseif(!isset($config['ipsec']['enable'])) { |
|
120 |
$icon = "block"; |
|
121 |
} else { |
|
122 |
$icon = "reject"; |
|
123 |
} |
|
116 | 124 |
?> |
117 | 125 |
<tr> |
118 | 126 |
<td class="listlr"> |
119 |
<?php echo htmlspecialchars(ipsec_get_descr_by_peerconfig($ikesa['peerconfig']));?>
|
|
127 |
<?php echo "({$ikesa['id']}) " . htmlspecialchars(ipsec_get_descr($ikesa['id']));?>
|
|
120 | 128 |
</td> |
121 | 129 |
<td class="listr"> |
122 | 130 |
<?php if (!is_array($ikesa['local'])) |
123 | 131 |
echo "Unknown"; |
124 | 132 |
else { |
125 | 133 |
if (!empty($ikesa['local']['identification'])) |
126 |
echo htmlspecialchars($ikesa['local']['identification']) . '<br />' . htmlspecialchars($ikesa['local']['spi']);
|
|
134 |
echo htmlspecialchars($ikesa['local']['identification']); |
|
127 | 135 |
else |
128 | 136 |
echo 'Unknown'; |
129 | 137 |
} |
... | ... | |
137 | 145 |
echo htmlspecialchars($ikesa['local']['address']) . ':' . htmlspecialchars($ikesa['local']['port']); |
138 | 146 |
else |
139 | 147 |
echo 'Unknown'; |
140 |
if ($ikesa['local']['nat']) |
|
148 |
if ($ikesa['local']['nat'] != 'false')
|
|
141 | 149 |
echo " NAT-T"; |
142 | 150 |
} |
143 | 151 |
?> |
... | ... | |
147 | 155 |
echo "Unknown"; |
148 | 156 |
else { |
149 | 157 |
if (!empty($ikesa['remote']['identification'])) |
150 |
echo htmlspecialchars($ikesa['remote']['identification']) . '<br />' . htmlspecialchars($ikesa['remote']['spi']);
|
|
158 |
echo htmlspecialchars($ikesa['remote']['identification']); |
|
151 | 159 |
else |
152 | 160 |
echo 'Unknown'; |
153 | 161 |
} |
... | ... | |
161 | 169 |
echo htmlspecialchars($ikesa['remote']['address']) . ':' . htmlspecialchars($ikesa['remote']['port']); |
162 | 170 |
else |
163 | 171 |
echo 'Unknown'; |
164 |
if ($ikesa['remote']['nat']) |
|
172 |
if ($ikesa['remote']['nat'] != 'false')
|
|
165 | 173 |
echo " NAT-T"; |
166 | 174 |
} |
167 | 175 |
?> |
... | ... | |
170 | 178 |
<?php echo htmlspecialchars($ikesa['role']);?> |
171 | 179 |
</td> |
172 | 180 |
<td class="listr"> |
173 |
<?php echo htmlspecialchars($ikesa['status']);?> |
|
181 |
<center> |
|
182 |
<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_<?php echo $icon; ?>.gif" title="<?php echo $ikesa['status']; ?>" alt=""/> |
|
183 |
<br/><?php echo htmlspecialchars($ikesa['status']);?> |
|
184 |
</center> |
|
174 | 185 |
</td> |
175 |
<td class="listbg"> |
|
176 |
<?php ?> |
|
186 |
<td > |
|
187 |
<?php if ($icon != "pass"): ?> |
|
188 |
<center> |
|
189 |
<a href="diag_ipsec.php?act=connect&ikeid=<?php echo $ikesa['id']; ?>"> |
|
190 |
<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_service_start.gif" alt="Connect VPN" title="Connect VPN" border="0"/> |
|
191 |
</a> |
|
192 |
</center> |
|
193 |
<?php else: ?> |
|
194 |
<center> |
|
195 |
<a href="diag_ipsec.php?act=ikedisconnect&ikeid=<?php echo $ikesa['id']; ?>"> |
|
196 |
<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_service_stop.gif" alt="Disconnect VPN" title="Disconnect VPN" border="0"/> |
|
197 |
</a> |
|
198 |
</center> |
|
199 |
<?php endif; ?> |
|
177 | 200 |
</td> |
178 | 201 |
<td valign="middle" class="list nowrap"> |
179 | 202 |
<table border="0" cellspacing="0" cellpadding="1" summary=""> |
Formats disponibles : Unified diff
Correct the ipsec status pages to show proper information as needed.