cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.
JRahm
Community Manager
Community Manager

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.1
Version history
Last update:
‎11-Mar-2015 14:25
Updated by:
Contributors