Stop managing your network one node at a time!
[Home]
[Download]
[Project Page]
[Bugs]
[SVN]
[email Lists]
[Tutorials]
[Screenshots]
Net-Policy tutorial
This assumes a fresh install of the net-policy system, including
a clean database with a freshly run np-setup and np-setupMIBtables.
See the INSTALL document that comes with the net-policy package for
details.
Defining some network policies
Let's start with a quick overview of some terminology.
A Policy is a collection of rules and filters
applied to packets to determine what actions are necessary for
that packet. Think of a policy as a grouping of data that makes
something happen.
Policies are assigned to roles, and any number of
roles can be assigned to a host. You can think of roles as how you
would like to group your hosts. All of your network nodes will
eventually be put into one or more roles. Example role names might be
something like: router, firewall, switch, web server, workstation, unix
and linux. The net-policy policy distribution
daemon (np-distd) will apply the appropriate rules, filters and actions
to a host when it is assigned to a new role.
Now that we have some basic terminology, let's create a policy that will
set SNMP trap notification destinations.
- Create hosts and their roles. For this example, we will assume
that we have a host, west, which will receive notifications.
A second host, east, will send notifications.
- Click on Manage clients/hosts, and click Next.
- Select Create_New, and click Next.
- Enter
west
(must resolve to an address) as
the Client Name, and Click Next.
- Select Create_New for the role, and click Next.
- Enter
notification receiver
as the role
name and Click Next.
- Click Commit to commit your changes to the database.
- Click Return to top to go back to the main menu.
- Click on Manage clients/hosts, and click Next.
- Select Create_New, and click Next.
- Enter
east
(must resolve to an address) as
the Client Name, and Click Next.
- Select Create_New for the role, and click Next.
- Enter
notification generator
as the role
name and Click Next.
- Click Commit to commit your changes to the database.
- Click Return to top to go back to the main menu.
- Create the policy.
- Select Create a new policy and click Next.
- Enter
send notifications
as the policy
name and Click Next.
- Click Commit to commit your changes to the database.
- Click Return to top to go back to the main menu.
- Now that we have a policy, we need to make it do something. We will
add a policy to send traps to the notification receiver.
- Click on the Add notification logging destination
button, and click Next.
-
Select the destination for your SNMP notifications by
selecting the host you previously defined (west), and then select
inform
and SNMP version 2c
, and click
Next.
-
Select the community name for the notifications to use
when they're being sent. If you actually have a notification
receiver on your host, enter the appropriate community name.
For this example, we will use
notification
.
Click Next.
-
This screen shows extra parameters that can be set. If you
actually have a notification receiver, you may change these
values. Otherwise, leave the defaults and click Next.
-
Click Commit to commit your changes to the database.
-
Click Return to top to go back to the main menu.
- No that we have a policy configured, we need to associate our role
with the policy, so the system will know which hosts need to be
configured with the policy.
- Select Manage host roles, and click Next.
- Select
notification generator
and click
Next.
- Check the box to add the
notification generator
policy and click Next.
- Click Commit to commit your changes to the database.
- Click Return to top to go back to the main menu.
Sending out the policies to the hosts
To send out the policies to the hosts, run the following
commands. This will do a one-time run of the database. Further
below, we'll tell you how to run these as daemons so that network
policies will take effect immediately.
The np-datad script does background database
processing. Run it as follows:
- np-datad -u SQLUSER -p SQLPASS -d -i
When that finishes, you'll then need to run np-distd to
send your network configuration policy data out to your network
nodes. Do this as follows:
- np-distd -u SQLUSER -p SQLPASS -s 0
When this finishes, all of your policies should be distributed to
your hosts. Check to make sure everything went ok.
Running the policy distribution agents as daemons
If you want the policy distribution agents to run continuously,
run them as follows:
- np-datad -u SQLUSER -p SQLPASS &
- np-distd -u SQLUSER -p SQLPASS &
Filters and Actions: A more complex example
We all know that telnet is an insecure protocol, so lets create a
policy that requires telnet traffic to be encrypted. In this example
we will create a role, a policy, a preconfiured action, an ESP
transform, keys, a rule and a filter. Make sure you have a fresh
cup of your favorite caffeinated beverage (I'll wait), and then
begin.
- Create the
telnet server
role.
- If you have done the notification example, and already have the
host west as a client:
- Click on Manage host roles, and click Next.
- Select Create_New, and click Next.
- Enter
telnet server
and click Next.
- Select the host
west
to be a member of the
new role, and click Next.
- If you have NOT done the notification example, and do not have the
host west as a client:
- Click on Manage clients/hosts, and click Next.
- Select Create_New, and click Next.
- Enter
west
and click Next.
- Select Create_New role, and click Next.
- Enter
telnet server
as the role name,
and click Next.
- Click Commit to commit your changes to the database.
- Click Return to top to go back to the main menu.
- Create a rule to create the preconfigured Action.
- Select Create a new firewall rule and Click
Next.
- Enter
encrypt telnet
for the policy name,
and Click Next.
- Select the
telnet server
role for the
policy, and Click Next.
- Enter the following values for the new rule:
Administrative name |
encrypt telnet |
Description |
start preconfigured action on telnet |
Priority |
100 |
Filter type |
IP Header Filter |
Action type |
Establish a Preconfigured-key IPsec connection |
and Click Next.
- Select Create_New preconfigured action and Click
Next.
- Enter the following values for the preconfigured action,
leaving other values at their defaults:
Administrative name |
esp-sha-12hrs |
Description |
12 hour esp-sha SA |
SA Direction |
both |
SA encapsulation mode |
tunnel |
SA Peer Gateway |
None |
SA Direction |
both |
Maximum SA Lifetime |
43200 |
Choose an ESP transform to protect this SA |
Create New |
ESP SPI value |
2003 |
and Click Next.
- Enter the following values for the ESP transform:
Administrative name |
3des-sha-12hrs |
Lifetime (seconds) |
43200 |
Authentication mode |
sha |
Encryption cipher |
Triple DES |
and Click Next.
- Select
Create_New
for both keys and Click
Next.
- You may choose to enter your own key value, or use the default.
Enter the following values for the ESP Authentication key:
Administrative name |
sha-key-one |
and Click Next.
- You may choose to enter your own key value, or use the default.
Enter the following values for the ESP Encryption key:
Administrative name |
3des-key-one |
and Click Next.
- Click Next to create a new IP filter.
- Enter the following values for the filter:
Administrative name |
is telnet |
IP version |
ipV4 |
Filter on destination port range |
X |
Low Destination Port |
23 |
High Destination Port |
23 |
Filter on protocol |
X |
Protocol |
6 |
and Click Next.
- Click Commit to commit your changes to the database.
- Click Return to top to go back to the main menu.
- Add hosts to the
telnet server
role.
- If you have not already created a host, do so now.
- Click on Create a new host, and click Next.
- Enter host name (must resolve to an address), and click
Next. In our example, we are using the host
west
.
- Click Commit to commit your changes to the database.
- Click Return to top to go back to the main menu.
- Select Manage clients/hosts and Click Next.
- Select a host to manage (
west
) and Click
Next.
- Select a role to add (
telnet server
) and
Click Next.
- Click Commit to commit your changes to the database.
- Click Return to top to go back to the main menu.
Verifying results
Now that we have data in the database, run np-datad and np-distd,
as shown above. If both complete without errors, we can verify that
the policy is actually enforced. This assumes you have hosts west
and east in the telnet server role.
- Log into west via ssh or on a local terminal (don't use
telnet!).
- Verify ping to east works
- telnet to east. You can hit ctrl-c pretty quickly, as we
don't care if it really works. As soon as it reports
Trying host..., press control-c.
- Verify ping to east now fails. This is because west is now
sending encrypted packets that east doesn't understand.
- Log into east via ssh or on a local terminal (don't use
telnet!).
- telnet to west. You can hit ctrl-c pretty quickly, as we
don't care if it really works. As soon as it reports
Trying host..., press control-c.
- From either host, verify ping now works again.
- That's it! You are done.
IKE and IPSEC: A more complex example
Instead of setting up a preconfigured action, we could just let the
hosts negotiate the details themselves. In this example, we will
set up a policy to do just that.
This example assumes that the preconfigured action example has already
been completed.
- Select Create a new firewall rule and Click
Next.
- Select the existing
encrypt telnet
policy,
and Click Next.
- Enter the following values for the new rule:
Administrative name |
encrypt telnet via ike |
Description |
Negotiate IKE and establish phase II SA on telnet |
Priority |
42 |
Filter type |
IP Header Filter |
Action type |
Negotiate IKE and establish phase II SA |
and Click Next.
- Enter the following values for the IKE/IPSEC pair,
leaving other values at their defaults:
Administrative name |
ike-ipsec |
Phase I action to use: |
Create New |
Phase II action to use: |
Create New |
and Click Next.
- Enter the following values for the IKE action:
Administrative name |
3des-md5-12hrs |
Select responder negotiation parameters |
min 1h; refresh 90%; can idle |
Peer |
None |
make sure both Identity fileds are blank, and Click Next.
- Enter the following values for the IKE proposal:
Proposal name |
Create_New |
Proposal priority |
10 |
and Click Next.
- Enter the following values for the IKE proposal, leaving any
other fileds with their default values:
Administrative name |
3des-md5-768-psk |
IKE CBC Cipher algorithm: |
Triple DES |
Cipher Key Length: |
24 |
IKE has algorithm: |
MD5 |
IKE authentication method: |
pre-shared key |
IKE Diffie-Hellman group: |
768-bit MODP group |
and Click Next.
- Enter the following values for the IPSEC action:
Administrative name |
blowfish-md5-12hrs |
Select responder negotiation parameters |
min 1h; refresh 90%; can idle |
Encapsulation mode |
tunnel |
Ipsec Peer Gateway |
None |
and Click Next.
- Enter the following values for the IPSEC proposal:
Administrative name |
esp proposal |
Priority |
10 |
Protocol |
ESP |
and Click Next.
- Enter the following values for the IPSEC transform:
Administrative name |
esp transform |
Priority |
10 |
Transform |
Create New |
and Click Next.
- Enter the following values for the ESP transform:
Administrative name |
blowfish-md5-12hrs |
Lifetime (seconds) |
43200 |
Authentication mode |
MD5 |
Encryption cipher |
Blowfish |
and Click Next.
- Enter the following values for the filter:
IP filter to use: |
is telnet |
and Click Next.
- Click Commit to commit your changes to the database.
- Click Return to top to go back to the main menu.
Please send comments, suggestions or (heaven forbid) corrections to
the net-policy-users mailing list. Click
here for
more information.
Last modified: Tue Mar 18 10:56:15 EST 2003
Powered by: