summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@ubnt.com>2013-12-18 11:36:50 -0800
committerDaniil Baturin <daniil@baturin.org>2014-01-29 04:19:49 +0100
commitb321dc01f533b0ed7359327a2b3bd53b583155b8 (patch)
tree728f2169bf1eac2d663b0a5a45540fb06fd4f73d /scripts
parent86140b53bfc5bbb1e0f7ef9b244951303d55ec1e (diff)
downloadvyatta-cfg-vpn-b321dc01f533b0ed7359327a2b3bd53b583155b8.tar.gz
vyatta-cfg-vpn-b321dc01f533b0ed7359327a2b3bd53b583155b8.zip
Move %any peers to the end in ipsec.secrets
Signed-off-by: Daniil Baturin <daniil@baturin.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vpn-config.pl9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/vpn-config.pl b/scripts/vpn-config.pl
index 9079148..4870d48 100755
--- a/scripts/vpn-config.pl
+++ b/scripts/vpn-config.pl
@@ -1329,6 +1329,15 @@ sub write_config {
print ${output_config} $genout;
close $output_config;
+ my @lines = split("\n", $genout_secrets);
+ my @any = grep(/%any/, @lines);
+ if (scalar(@any) > 0) {
+ my @noany = grep(!/%any/, @lines);
+ @lines = (@noany, @any);
+ $genout_secrets = join("\n", @lines);
+ $genout_secrets .= "\n";
+ }
+
open my $output_secrets, '>', $secrets_file
or die "Can't open $secrets_file: $!";
print ${output_secrets} $genout_secrets;