HP-UX CMGR A.02.00 Administrator's and Developer's Guide
Example 3-1 IPFilter Template
<?xml version="1.0" ?>
<!DOCTYPE template SYSTEM "/opt/hpcmgr/etc/templates/cmgr.dtd">
<template xmlns:xi="http://www.w3.org/2001/XInclude">
<!--
=============================================================================
This example template demonstrates managing dynamic IPFilter rules to block
trafic from source a IP addresses to a local tcp port. Each rule has it's
own ID, so you can add, replace, or delete individual rules. As the rules
are changed, the action is logged to syslog.
To add a rule:
cmgr -a -t <this file> ip_address=<Address> tcp_port=<port> rule_id=<string>
To delete a rule:
cmgr -r -t <this file> ip_address=<Address> tcp_port=<port> rule_id=<string>
To delete a rule:
cmgr -d -t <this file> rule_id=<string>
To list the rules in effect:
cmgr -l -t <this file> -v
=============================================================================
-->
<!--
========================================================
Template Head: declare variables [2]
=========================================================
-->
<head>
<!--
===================================================
Since this is an example, set internal variables to:
use example instance of IPFilter config file.
validate, but don't activate.
===================================================
-->
<var name="ipf_file" value="/tmp/example_ipf.conf" internal="yes"/>
<var name="validate" value="yes" internal="yes"/>
<var name="activate" value="no" internal="yes"/>
<!--
===================================================
Declare variables and assign default values
===================================================
-->
<var name="ip_address" value="" validate="ipVerify" >
<prompt>Source IP address:</prompt>
<help if="$interactive">
The IP address to block traffic from.
</help>
</var>
<var name="tcp_port" value="" validate="regexp('\d+')" >
<prompt>TCP port:</prompt>
<help if="$interactive">
The TCP port to block for the specified IP address.
</help>
</var>
<var name="rule_id" value="" validate="regexp('[\w\-]+')" >
<prompt>IPFilter Rule ID :</prompt>
<help if="$interactive">
User supplied identifier for this IPFilter rule.
</help>
34 Building a Template