Add a Signature or Checksum to Multiple iRules
Problem this snippet solves:
Contributed by: citizen_elah
Introduction
In the v11.1 GUI, you can add a checksum to multiple iRules simultaneously, but not signatures. This iApp template will allow users to select a checksum or signature and then select the iRules for application.
Code :
cli admin-partitions {
update-partition Common
}
sys application template /Common/tcl_test {
actions {
definition {
html-help {
}
implementation {
if { $::genInfo__sig_or_csum == "Checksum" } {
foreach obj $::genInfo__iRulesList {
#puts "Checksum for $obj"
exec "tmsh" "generate" "ltm" "rule" "checksum" $obj
}
} elseif { $::genInfo__sig_or_csum == "Signature" } {
foreach obj $::genInfo__iRulesList {
#puts "Signature for $obj with key $::genInfo__sigKey"
exec "tmsh" "generate" "ltm" "rule" "signature" $obj "signing-key" $::genInfo__sigKey
}
}
}
presentation {
section genInfo {
choice sig_or_csum default "Checksum" { "Checksum", "Signature" }
optional (sig_or_csum == "Signature") {
choice sigKey tcl {
set objs [tmsh::get_config /sys crypto key]
foreach obj $objs {
append results [tmsh::get_name $obj]
append results "\n"
}
return $results
}
}
multichoice iRulesList tcl {
set objs [tmsh::get_config /ltm rule]
foreach obj $objs {
append results [tmsh::get_name $obj]
append results "\n"
}
return $results
}
}
text {
genInfo "Add Signature or Checksum to iRules"
genInfo.sig_or_csum "Please select Signature or Checksum."
genInfo.sigKey "Please select the key for iRule signature."
genInfo.iRulesList "Please select one or more iRules."
}
}
role-acl none
run-as none
}
}
description none
}Tested this on version:
11.1Published Mar 11, 2015
Version 1.0JRahm
Admin
Christ Follower, Husband, Father, Technologist. I love community and I especially love THIS community. My background is networking, but I've dabbled in all the F5 iStuff, I'm a recovering Perl guy, and am very much a python enthusiast. Learning alongside all of you in this accelerating industry toward modern apps and architectures.JRahm
Admin
Christ Follower, Husband, Father, Technologist. I love community and I especially love THIS community. My background is networking, but I've dabbled in all the F5 iStuff, I'm a recovering Perl guy, and am very much a python enthusiast. Learning alongside all of you in this accelerating industry toward modern apps and architectures.No CommentsBe the first to comment
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)