Blame README.krb5

Packit Service b38f0b
This version of net-snmp supports an experimental SNMPv3 security model
Packit Service b38f0b
using Kerberos 5 for authentication.  The protocol is described in an
Packit Service b38f0b
up-and-coming IETF Internet-Draft.
Packit Service b38f0b
Packit Service b38f0b
This document describes a brief overview of the Kerberos Security Model
Packit Service b38f0b
and how to use it.
Packit Service b38f0b
Packit Service b38f0b
DESCRIPTION:
Packit Service b38f0b
Packit Service b38f0b
The Kerberos Security Model does not use USM; it is completely seperate
Packit Service b38f0b
and is not tied to USM in any way.  It works by placing the following
Packit Service b38f0b
ASN.1 sequence inside of the SNMPv3 msgSecurityParameters:
Packit Service b38f0b
Packit Service b38f0b
ksmSecurityParameters ::= SEQUENCE {
Packit Service b38f0b
-- The Kerberos 5 checksum type used to checksum this message
Packit Service b38f0b
    ksmChecksumType		INTEGER(0..2147483647),
Packit Service b38f0b
-- The actual keyed checksum data returned by Kerberos
Packit Service b38f0b
    ksmChecksum			OCTET STRING,
Packit Service b38f0b
-- The Kerberos 5 message (either an AP_REQ or AP_REP)
Packit Service b38f0b
    ksmKerberosMsg		OCTET STRING,
Packit Service b38f0b
-- The cached ticket identifier
Packit Service b38f0b
    ksmCachedTicket		INTEGER(0..2147483647)
Packit Service b38f0b
}
Packit Service b38f0b
Packit Service b38f0b
Note that the whole SEQUENCE is BER encoded as an OCTET STRING.
Packit Service b38f0b
Packit Service b38f0b
ksmChecksumType is an integer which corresponded to the checksum algorithm
Packit Service b38f0b
used to secure this message as defined by Kerberos (see section 8.3 of
Packit Service b38f0b
RFC1510).
Packit Service b38f0b
Packit Service b38f0b
ksmChecksum is the output of the checksum algoritm defined by ksmChecksumtype
Packit Service b38f0b
(with all NULs in the space for the checksum).
Packit Service b38f0b
Packit Service b38f0b
ksmKerberosMsg is a Kerberos 5 AP_REQ or AP_REP message, depending on
Packit Service b38f0b
whether or not it is a request or a response (AP_REQ for requests, AP_REP
Packit Service b38f0b
for responses).
Packit Service b38f0b
Packit Service b38f0b
ksmCachedTicket is a integer which uniquely identifies a ticked already
Packit Service b38f0b
cached on the agent to save the overhead of transferring a whole AP_REQ/AP_REP.
Packit Service b38f0b
If there is no such cached ticket, it is left at zero.
Packit Service b38f0b
Packit Service b38f0b
An agent, upon receiving a message using the KSM, will decode the AP_REQ
Packit Service b38f0b
contained within the security parameters and thus validate the client's
Packit Service b38f0b
identity.  Using the subkey contained within the AP_REQ, the agent will
Packit Service b38f0b
validate the checksum (after first clearing the checksum bytes to zero),
Packit Service b38f0b
and issue a response, encoding the appropriate AP_REP message in the
Packit Service b38f0b
ksmSecurityParameters.
Packit Service b38f0b
Packit Service b38f0b
If the securityLevel of the message is set to AuthPriv, the scopedPdu
Packit Service b38f0b
payload will be encrypted using the encryption key and algorithm of the
Packit Service b38f0b
AP_REQ subkey.  Note that in this case, the msgData will be a BER-encoded
Packit Service b38f0b
OCTET STRING corresponding to the "cipher" element of the EncryptedData
Packit Service b38f0b
sequence defined in RFC 1510, section 6.1.
Packit Service b38f0b
Packit Service b38f0b
Since this security model is experimental, the number assigned to this
Packit Service b38f0b
security model is taken from the recommendations of RFC 2271, section 5,
Packit Service b38f0b
which specify enterprise-specific Security Models of the form:
Packit Service b38f0b
Packit Service b38f0b
	SnmpSecurityModel = enterpriseID * 256 + security model number
Packit Service b38f0b
						 in that enterprise ID;
Packit Service b38f0b
Packit Service b38f0b
In the case of KSM this gives us:
Packit Service b38f0b
Packit Service b38f0b
	SnmpSecurityModel = 8072 * 256 + 0 = 2066432
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
USAGE:
Packit Service b38f0b
Packit Service b38f0b
To actually USE the Kerberos Security Model, do the following:
Packit Service b38f0b
Packit Service b38f0b
0) Install Kerberos
Packit Service b38f0b
Packit Service b38f0b
   Let it be stated up front - Installing Kerberos completely "cold", without
Packit Service b38f0b
   any Kerberos experience at all, can be daunting (to say the least).  If you
Packit Service b38f0b
   already have a Kerberos infrastructure at your site, then all of the hard
Packit Service b38f0b
   work has been done.  If you do NOT, but you still want to tackle it,
Packit Service b38f0b
   you might be interested in the Kerberos FAQ, which can be found at:
Packit Service b38f0b
Packit Service b38f0b
   http://www.nrl.navy.mil/CCS/people/kenh/kerberos-faq.html
Packit Service b38f0b
Packit Service b38f0b
   Currently the code in net-snmp only supports using MIT Kerberos
Packit Service b38f0b
   libraries to link against (you should be able to use any kind of Kerberos
Packit Service b38f0b
   server, however).
Packit Service b38f0b
Packit Service b38f0b
1) Compile net-snmp with Kerberos.
Packit Service b38f0b
Packit Service b38f0b
   This assumes that you already have Kerberos libraries in place.
Packit Service b38f0b
Packit Service b38f0b
   Configure net-snmp to include the Kerberos Security Model (ksm) and
Packit Service b38f0b
   use --with-cflags and --with-ldflags to specify the location and names
Packit Service b38f0b
   of Kerberos header files and libraries.  For example, on my system I
Packit Service b38f0b
   run:
Packit Service b38f0b
Packit Service b38f0b
   ./configure --with-cflags='-I/usr/krb5/include' \
Packit Service b38f0b
      --with-ldflags='-L/usr/krb5/lib -lkrb5 -lcrypto -lcom_err -R/usr/krb5/lib'
Packit Service b38f0b
Packit Service b38f0b
   Note that this is on Solaris, and that -R is required to set the correct
Packit Service b38f0b
   shared library path.  If you have a newer version of Kerberos, you might
Packit Service b38f0b
   instead have to use:
Packit Service b38f0b
Packit Service b38f0b
   -lkrb5 -lk5crypto -lcom_err
Packit Service b38f0b
Packit Service b38f0b
   as the libraries to link against.  If you get errors (for example, you
Packit Service b38f0b
   get a message that says the compiler isn't working) you can check
Packit Service b38f0b
   config.log for the output of the compiler.
Packit Service b38f0b
Packit Service b38f0b
2) Configure Kerberos and SNMP
Packit Service b38f0b
Packit Service b38f0b
   Currently, net-snmp uses the "host" principal assigned to a host.  This
Packit Service b38f0b
   may change in the future.  You will want to create host principals of
Packit Service b38f0b
   the form:
Packit Service b38f0b
Packit Service b38f0b
   host/f.q.d.n@YOUR.REALM
Packit Service b38f0b
Packit Service b38f0b
   For example:
Packit Service b38f0b
Packit Service b38f0b
   host/mydesktop.example.org@EXAMPLE.ORG
Packit Service b38f0b
Packit Service b38f0b
   and place the encryption keys for these principals on every machine you
Packit Service b38f0b
   wish to run a SNMP agent (you place each key on it's corresponding machine).
Packit Service b38f0b
   Your Kerberos documentation should explain how to do this (in the case
Packit Service b38f0b
   of MIT Kerberos, you want to look at the "ktadd" command inside of
Packit Service b38f0b
   kadmin).
Packit Service b38f0b
Packit Service b38f0b
   If you have a Kerberos infrastructure, you likely already have these
Packit Service b38f0b
   principals in place on your systems.
Packit Service b38f0b
Packit Service b38f0b
   If you're installing Kerberos for the first time as well, you also
Packit Service b38f0b
   need to create client principals corresponding to your userid.  See
Packit Service b38f0b
   your Kerberos documentation.
Packit Service b38f0b
Packit Service b38f0b
   On the SNMP _agent_ side, you'll want to place in your snmpd.conf file
Packit Service b38f0b
   (the one that lives in /usr/local/share/snmp/snmpd.conf, or whereever
Packit Service b38f0b
   you have configured on your system):
Packit Service b38f0b
Packit Service b38f0b
   rwuser -s ksm userid@YOUR.REALM
Packit Service b38f0b
Packit Service b38f0b
   to allow the Kerberos principal 'userid@YOUR.REALM' read/write access to
Packit Service b38f0b
   the MIB tree.
Packit Service b38f0b
Packit Service b38f0b
3) Run the agent and client applications
Packit Service b38f0b
Packit Service b38f0b
   Note that before you do any of this, you will have to have valid Kerberos
Packit Service b38f0b
   credentials (generally acquired with the "kinit" program).
Packit Service b38f0b
Packit Service b38f0b
   The agent should run without any additional flags.
Packit Service b38f0b
Packit Service b38f0b
   You should run the client apps with the following flags:
Packit Service b38f0b
Packit Service b38f0b
   -Y defSecurityModel=ksm
Packit Service b38f0b
   -v 3
Packit Service b38f0b
   -u username
Packit Service b38f0b
   -l authNoPriv
Packit Service b38f0b
Packit Service b38f0b
   for example:
Packit Service b38f0b
Packit Service b38f0b
   snmpget -v 3 -Y defSecurityModel=ksm -u myname -l authNoPriv testhost \
Packit Service b38f0b
						system.sysDescr.0
Packit Service b38f0b
Packit Service b38f0b
   If you wish to encrypt the payload, change the -l argument to "authPriv".
Packit Service b38f0b
Packit Service b38f0b
   If you run into problems, you can add the -Dksm flag to both the manager
Packit Service b38f0b
   applications and the agent to get more detailed Kerberos error messages.
Packit Service b38f0b
   Note that this setup assumes a working Kerberos infrastructure; if you
Packit Service b38f0b
   run into problems, check to make sure Kerberos is working for you.