Révision 7ab6ad70
Ajouté par Ermal il y a plus de 9 ans
etc/inc/ipsec.inc | ||
---|---|---|
601 | 601 |
* Return dump of mobile user list |
602 | 602 |
*/ |
603 | 603 |
function ipsec_dump_mobile() { |
604 |
/* XXX: Need to be fixed */ |
|
605 |
return array(); |
|
604 |
global $g; |
|
606 | 605 |
|
607 |
$command = "/usr/local/sbin/racoonctl show-users"; |
|
608 |
$fd = @popen($command, "r"); |
|
609 |
$mobile = array(); |
|
610 |
if ($fd) { |
|
611 |
while (!feof($fd)) { |
|
612 |
$user = array(); |
|
613 |
$line = chop(fgets($fd)); |
|
614 |
if (!$line) |
|
615 |
continue; |
|
616 |
if ($line == "User|Source|Destination|CreatedOn|SPI") |
|
617 |
continue; |
|
606 |
$_gb = exec("/usr/local/sbin/ipsec stroke leases > {$g['tmp_path']}/strongswan_leases.xml"); |
|
618 | 607 |
|
619 |
// jim|192.168.20.243:4500|192.168.20.5:24146|2012-05-25 09:54:39|989d10e1e2d4eca4:7243830d5fd2afe7 |
|
620 |
$linea = explode("|", trim($line)); |
|
621 |
$user['username'] = $linea[0]; |
|
622 |
$user['local'] = $linea[1]; |
|
623 |
$user['remote'] = $linea[2]; |
|
624 |
$user['logintime'] = $linea[3]; |
|
625 |
$user['spi'] = $linea[4]; |
|
626 |
if (!empty($user['username'])) |
|
627 |
$mobile[] = $user; |
|
628 |
} |
|
629 |
pclose($fd); |
|
608 |
if (!file_exists("{$g['varrun_path']}/strongswan_leases.xml")) { |
|
609 |
log_error(gettext("IPSec daemon seems to have issues or not running! Could not display mobile user stats!")); |
|
610 |
return array(); |
|
630 | 611 |
} |
631 | 612 |
|
632 |
return $mobile; |
|
613 |
$custom_listtags = array('lease', 'pool'); |
|
614 |
$response = parse_xml_config("{$g['tmp_path']}/strongswan_leases.xml", "leases"); |
|
615 |
@unlink("{$g['tmp_path']}/strongswan_leases.xml"); |
|
616 |
unset($custom_listtags, $_gb); |
|
617 |
|
|
618 |
return $response; |
|
633 | 619 |
} |
634 | 620 |
|
635 | 621 |
function ipsec_mobilekey_sort() { |
Formats disponibles : Unified diff
Make use of the xml output from stroke leases command