From 7c1643c7b7032a9d599156e5f02bde7d932e0fd5 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 23 Apr 2020 17:15:32 +0200 Subject: [PATCH] patch ipsec palo alto ssh --- network/paloalto/ssh/mode/ipsec.pm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/network/paloalto/ssh/mode/ipsec.pm b/network/paloalto/ssh/mode/ipsec.pm index a11e89aea..f1d752066 100644 --- a/network/paloalto/ssh/mode/ipsec.pm +++ b/network/paloalto/ssh/mode/ipsec.pm @@ -121,10 +121,21 @@ sub manage_selection { $self->{global}->{total_ipsec}++; } + $result = $options{custom}->execute_command(command => 'show vpn ipsec-sa', ForceArray => ['entry']); + foreach (@{$result->{entries}->{entry}}) { + if (defined($self->{tunnels}->{$_->{gwid}})) { + $self->{tunnels}->{$_->{gwid}}->{tid} = $_->{tid}; + } + } + $result = $options{custom}->execute_command(command => 'show vpn flow', ForceArray => ['entry']); - foreach (@{$result->{IPSec}->{entry}}) { - $self->{tunnels}->{$_->{gwid}}->{state} = $_->{state}; - $self->{tunnels}->{$_->{gwid}}->{monitor_status} = $_->{mon}; + foreach my $gwid (keys %{$self->{tunnels}}) { + next if (!defined($self->{tunnels}->{$gwid}->{tid})); + foreach (@{$result->{IPSec}->{entry}}) { + next if ($self->{tunnels}->{$gwid}->{tid} ne $_->{id}); + $self->{tunnels}->{$_->{gwid}}->{state} = $_->{state}; + $self->{tunnels}->{$_->{gwid}}->{monitor_status} = $_->{mon}; + } } }