Annotation of embedaddon/ipsec-tools/src/racoon/contrib/sp.pl, revision 1.1
1.1 ! misho 1: #! /usr/pkg/bin/perl
! 2:
! 3: die "insufficient arguments" if (scalar(@ARGV) < 2);
! 4: $src = $ARGV[0];
! 5: $dst = $ARGV[1];
! 6: $mode = 'transport';
! 7: if (scalar(@ARGV) > 2) {
! 8: $mode = $ARGV[2];
! 9: }
! 10:
! 11: open(OUT, "|setkey -c");
! 12: if ($mode eq 'transport') {
! 13: print STDERR "install esp transport mode: $src -> $dst\n";
! 14: print OUT "spdadd $src $dst any -P out ipsec esp/transport//require;\n";
! 15: print OUT "spdadd $dst $src any -P in ipsec esp/transport//require;\n";
! 16: } elsif ($mode eq 'delete') {
! 17: print STDERR "delete policy: $src -> $dst\n";
! 18: print OUT "spddelete $src $dst any -P out;\n";
! 19: print OUT "spddelete $dst $src any -P in;\n";
! 20: }
! 21: close(OUT);
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>