Annotation of wikisrc/users/mbalmer/keylock.mdwn, revision 1.5

1.2       mbalmer     1: [[!meta title="A Keylock Security Model for kauth(9)"]]
1.1       mbalmer     2: 
                      3: Recently, generic support for electro-mechanical multi-position keylocks
                      4: in the kernel has been added to NetBSD.  Such locks can be turned into
                      5: various positions, usually up to three or four position.  They come with
                      6: a set of keys that are different in so far as not all positions can be
                      7: reached with all keys (which key can go up to which position is called
                      8: the "locking program").  With the new keylock support, such locks can be
                      9: used to tinker with the kernel security, much like the traditional
                     10: securelevel variable...
                     12: The number of keylock positions, the current keylock position, and the
                     13: overall keylock state can be read within the kernel using a set of
1.2       mbalmer    14: functions defined in
                     15: [keylock.h](
                     16: and userland
1.3       mbalmer    17: can access them through the <b>hw.keylock</b> sysctl hierarchy.
1.1       mbalmer    18: 
                     19: The following components have been added:
1.5     ! mbalmer    21: * <b>[gpiolock(4)](</b>
        !            22: a driver for GPIO attached keylocks.
1.1       mbalmer    23:  The driver registers with the in-kernel keylock "subsystem". See
1.3       mbalmer    24: [gpiolock.c](
1.1       mbalmer    25: 
1.3       mbalmer    26: * <b>secmodel_keylock</b>, a {{manual page|kauth|9}} security model that
1.1       mbalmer    27: authorizes based on the keylock "closedness".  Wheter the rightmost
                     28: (default) or leftmost position of the keylock means open can be
                     29: controlled using the '''hw.keylock.order''' sysctl variable. This
                     30: variable can only be changed if the keylock state is OPEN. See
1.3       mbalmer    31: [secmodel_keylock.c](
1.1       mbalmer    32: 
                     33: The security model is started when a keylock driver registers and
                     34: stopped when there is no more keylock driver.  The keylock security
                     35: model is optional, keylock support can be used without the security
                     36: model as well (e.g. to provide keylock state to a userland applications.
                     37: Useful e.g. for POS applications).
                     39: The keylock state interpretation is done in
1.4       mbalmer    40: [keylock.c](
1.3       mbalmer    41: and not in the driver itself.  This
1.1       mbalmer    42: allows for adding support for multiple keylocks in the future.  The
                     43: hw.keylock.pos and hw.keylock.npos sysctl variable have debugging
                     44: character, the hw.keylock.state variable reflects the state and should
                     45: be used.
                     47: Currently, the keylock positions are interpreted as follows:  There are
                     48: maximum four positions, OPEN, SEMIOPEN, SEMICLOSE, CLOSE.  What exactly
                     49: that means leaves room for interpretation right now.... (experience will
                     50: show what makes sense in the end).
                     52: To enable the keylock support, the keylock security model, and the
                     53: {{manual page|gpiolock|4|}} driver, add the following lines to your
                     54: kernel configuration file:
                     56:        options KEYLOCK
                     57:        options secmodel_keylock
                     58:        gpiolock* at gpio?
                     60: Of course you must have at least one GPIO device in your system for the
                     61: {{manual page|gpiolock|4|}} driver to work and the lock must be
                     62: connected properly.
1.3       mbalmer    64: <b>Please keep in mind that this is an experimental feature...</b>

CVSweb for NetBSD wikisrc <> software: FreeBSD-CVSweb