In the prior post, Building Configuration Policy Checks, Part 1 I explained why configuration policies are needed. Now it is time to discuss how to build policies. I like to start with the written policies, because that tells me what was intended. An example is:
“All network devices will be configured to send syslog messages to the syslog server located at 10.1.200.5. The logging source should be the loopback0 and the level should be ‘informational’ and the default facility of local7 should be used.”
From this policy, I can create the device configuration statements and then create the rules and policies. The desired configuration for IOS and CatOS for logging would be:
IOS: logging 10.1.200.5 CatOS: set logging server enable set logging server 10.1.200.5 set logging level sys 6 default
Now I can start to build the rules and policies. There are several design choices that must be made when creating policies. A policy is comprised of multiple rules which are combined using boolean logic. Most tools, including NetMRI, includes a mechanism for building rules and policies.
It is best to use rules that check for the presence (or absence) of one or more configuration statements. In NetMRI, each rule can have a device filter applied that specifies the device configurations to which the rule should be applied. For example, checking that logging to a syslog server uses different syntax in IOS than in CatOS or JunOS. One way to build the check is to build separate policies for each OS type, using rules with the syntax that applies to the OS being checked. Using the is method creates a lot of policies, one for each OS type. In this case, no device filter is needed on each rule. The device filter is applied to the policy. Here is an example:
Rule 1: logging 10.1.200.5 Policy IOS Logging: Rule 1 Policy IOS Logging filter: IOS devices only Rule 2: set logging server enable Rule 3: set logging server 10.1.200.5 Rule 4: set logging level sys 6 default Policy CatOS Logging: Rule 2 and Rule 3 and Rule 4 Policy CatOS Logging filter: CatOS devices only
The above method creates two policies. I find that having too many policies clutters the policy reports, making the reports more difficult to read.
I prefer to have a single policy that checks for the correct logging configuration. A single policy is constructed a bit differently and relies on device filters on each rule. Here is its example:
Rule 1: logging 10.1.200.5 Rule 1 filter: IOS devices Rule 2: set logging server enable Rule 2 filter: CatOS devices Rule 3: set logging server 10.1.200.5 Rule 3 filter: CatOS devices Rule 4: set logging level sys 6 default Rule 4 filter: CatOS devices Policy Logging: Rule 1 and Rule 2 and Rule 3 and Rule 4
There is no policy filter needed, except perhaps to specify Cisco devices.
Rule 1 will only apply to IOS devices while Rule 2, Rule 3, and Rule 4 will only apply to IOS devices. All exceptions to the logging configuration will appear in the policy report specific to logging.
Policies can get complex as you deal with differences in OS versions. I sometimes have to make a command specific to a particular platform, such as the authentication attempts command, which is not found on certain platforms (3550/2950).
aaa authentication attempts login 5
The NetMRI issue display shows how many devices don’t match each policy, making it is easy to identify the configurations that need correction and quickly get to a compliant network.
Re-posted with Permission
NetCraftsmen would like to acknowledge Infoblox for their permission to re-post this article which originally appeared in the Applied Infrastructure blog under http://www.infoblox.com/en/communities/blogs.html