diff options
author | Jeff Leung <jleung@v10networks.ca> | 2015-01-27 00:23:43 -0800 |
---|---|---|
committer | Jeff Leung <jleung@v10networks.ca> | 2015-01-27 01:14:05 -0800 |
commit | c3240731283eb3128bf5654b3e4ffb1ae81a0718 (patch) | |
tree | 1dba77f5656f3b44c9dd74cbde1f7ff180067e04 /scripts | |
parent | d72efb828bd9bb88a6fb6d219b2b1cb88406507e (diff) | |
download | vyatta-cfg-vpn-c3240731283eb3128bf5654b3e4ffb1ae81a0718.tar.gz vyatta-cfg-vpn-c3240731283eb3128bf5654b3e4ffb1ae81a0718.zip |
Add get_dh_cipher_result submodule
By adding this submodule we can reduce the amount of code we need to
maintain by having a single submodule that takes in a Diffie-Hellman group
number and translates it to what strongSwan expects.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vpn-config.pl | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/vpn-config.pl b/scripts/vpn-config.pl index 5edd148..bffe9a1 100755 --- a/scripts/vpn-config.pl +++ b/scripts/vpn-config.pl @@ -1551,4 +1551,43 @@ EOS close $dhcp_hook; } +sub get_dh_cipher_result { + my ($cipher) = @_; + my $ciph_out; + if ($cipher eq '2' || $cipher eq 'dh-group2') { + $ciph_out = 'modp1024'; + } elsif ($cipher eq '5' || $cipher eq 'dh-group5') { + $ciph_out = 'modp1536'; + } elsif ($cipher eq '14' || $cipher eq 'dh-group14') { + $ciph_out = 'modp2048'; + } elsif ($cipher eq '15' || $cipher eq 'dh-group15') { + $ciph_out = 'modp3072'; + } elsif ($cipher eq '16' || $cipher eq 'dh-group16') { + $ciph_out = 'modp4096'; + } elsif ($cipher eq '17' || $cipher eq 'dh-group17') { + $ciph_out = 'modp6144'; + } elsif ($cipher eq '18' || $cipher eq 'dh-group18') { + $ciph_out = 'modp8192'; + } elsif ($cipher eq '19' || $cipher eq 'dh-group19') { + $ciph_out = 'ecp256'; + } elsif ($cipher eq '20' || $cipher eq 'dh-group20') { + $ciph_out = 'ecp384'; + } elsif ($cipher eq '21' || $cipher eq 'dh-group21') { + $ciph_out = 'ecp521'; + } elsif ($cipher eq '22' || $cipher eq 'dh-group22') { + $ciph_out = 'modp1024s160'; + } elsif ($cipher eq '23' || $cipher eq 'dh-group23') { + $ciph_out = 'modp2048s224'; + } elsif ($cipher eq '24' || $cipher eq 'dh-group24') { + $ciph_out = 'modp2048s256'; + } elsif ($cipher eq '25' || $cipher eq 'dh-group25') { + $ciph_out = 'ecp192'; + } elsif ($cipher eq '26' || $cipher eq 'dh-group26') { + $ciph_out = 'ecp224'; + } else { + $ciph_out = 'unknown'; + } + return $ciph_out; +} + # end of file |