From a566e4c18da64a05ef79e9b044ac3b1c5a1ba959 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Mon, 11 Feb 2008 17:11:10 -0800 Subject: Fix 2810 ospf authentications gets truncated to 8 characters - Add syntax checks to verify length of passwords. --- .../node.tag/authentication/md5/key-id/node.def | 2 +- .../md5/key-id/node.tag/md5-key/node.def | 7 +++++++ .../node.tag/authentication/md5/node.def | 17 ++++++++++------- .../node.tag/authentication/simple/node.def | 21 +++++++++++++++++---- 4 files changed, 35 insertions(+), 12 deletions(-) (limited to 'templates/protocols') diff --git a/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/key-id/node.def b/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/key-id/node.def index d73b4404..1710e6d2 100644 --- a/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/key-id/node.def +++ b/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/key-id/node.def @@ -2,7 +2,7 @@ tag: type: u32 help: Configure MD5 key id syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 255; "ID must be between (1-255)" -commit:expression: $VAR(md5-key/) != ""; "must add the md5-key for key-id $VAR(@)" +commit:expression: $VAR(md5-key/) != ""; "Must add the md5-key for key-id $VAR(@)" delete:expression: "touch /tmp/ospf-md5.$PPID" end:expression: "\ if [ -f \"/tmp/ospf-md5.$PPID\" ]; then \ diff --git a/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/key-id/node.tag/md5-key/node.def b/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/key-id/node.tag/md5-key/node.def index 3efdfdd3..7cbcad83 100644 --- a/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/key-id/node.tag/md5-key/node.def +++ b/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/key-id/node.tag/md5-key/node.def @@ -1,2 +1,9 @@ type: txt help: Configure md5 key +syntax:expression: exec " \ + if [ `echo -n $VAR(@) | wc -c` -gt 16 ]; then \ + echo MD5 key must be 16 characters or less ; \ + exit 1 ; \ + fi ; " +comp_help: possible completions: + MD5 Key (16 characters or less) diff --git a/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/node.def b/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/node.def index d7760159..ec24b76b 100644 --- a/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/node.def +++ b/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/node.def @@ -1,11 +1,14 @@ help: Configure MD5 key id -create:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ +create:expression: "${vyatta_sbindir}/vyatta-vtysh.pl \ + -c \"configure terminal\" \ + -c \"router ospf\" \ -c \"no area $VAR(../../../@) virtual-link $VAR(../../@) \ - authentication-key\" \ - -c \"area $VAR(../../../@) virtual-link $VAR(../../@) \ - authentication message-digest\"; " -delete:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ + authentication-key\" \ + -c \"area $VAR(../../../@) virtual-link $VAR(../../@) \ + authentication message-digest\"; " + +delete:expression: "${vyatta_sbindir}/vyatta-vtysh.pl \ + -c \"configure terminal\" \ -c \"router ospf\" \ -c \"area $VAR(../../../@) virtual-link $VAR(../../@) \ - authentication null\"; " + authentication null\"; " diff --git a/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/simple/node.def b/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/simple/node.def index 36a924d2..ab694398 100644 --- a/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/simple/node.def +++ b/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/simple/node.def @@ -1,7 +1,20 @@ type: txt help: Configure simple password -update:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" -c \"router ospf\" \ - -c \"area $VAR(../../../@) virtual-link $VAR(../../@) authentication authentication-key $VAR(@) \"; " -delete:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" -c \"router ospf\" \ - -c \"no area $VAR(../../../@) virtual-link $VAR(../../@) authentication authentication-key \"; " +syntax:expression: exec " \ + if [ `echo -n $VAR(@) | wc -c` -gt 8 ]; then \ + echo Password must be 8 characters or less ; \ + exit 1 ; \ + fi ; " +update:expression: "${vyatta_sbindir}/vyatta-vtysh.pl \ + -c \"configure terminal\" -c \"router ospf\" \ + -c \"area $VAR(../../../@) virtual-link $VAR(../../@) \ + authentication authentication-key $VAR(@) \"; " + +delete:expression: "${vyatta_sbindir}/vyatta-vtysh.pl \ + -c \"configure terminal\" -c \"router ospf\" \ + -c \"no area $VAR(../../../@) virtual-link $VAR(../../@) \ + authentication authentication-key \"; " + +comp_help: possible completions: + Simple password (8 characters or less) -- cgit v1.2.3