]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
apparmor: add mount mediation
authorJohn Johansen <john.johansen@canonical.com>
Wed, 19 Jul 2017 06:04:47 +0000 (23:04 -0700)
committerSeth Forshee <seth.forshee@canonical.com>
Tue, 5 Sep 2017 12:34:47 +0000 (07:34 -0500)
commit21fad8c32fa78ea951d20e0208ec9b143385e05f
tree87a3ef2e613b5b72e3c409be2092aad019e404e2
parent84632f19b97051f24dbadb69237288fe26865b61
apparmor: add mount mediation

Add basic mount mediation. That allows controlling based on basic
mount parameters. It does not include special mount parameters for
apparmor, super block labeling, or any triggers for apparmor namespace
parameter modifications on pivot root.

default userspace policy rules have the form of
  MOUNT RULE = ( MOUNT | REMOUNT | UMOUNT )

  MOUNT = [ QUALIFIERS ] 'mount' [ MOUNT CONDITIONS ] [ SOURCE FILEGLOB ]
          [ '->' MOUNTPOINT FILEGLOB ]

  REMOUNT = [ QUALIFIERS ] 'remount' [ MOUNT CONDITIONS ]
            MOUNTPOINT FILEGLOB

  UMOUNT = [ QUALIFIERS ] 'umount' [ MOUNT CONDITIONS ] MOUNTPOINT FILEGLOB

  MOUNT CONDITIONS = [ ( 'fstype' | 'vfstype' ) ( '=' | 'in' )
                       MOUNT FSTYPE EXPRESSION ]
       [ 'options' ( '=' | 'in' ) MOUNT FLAGS EXPRESSION ]

  MOUNT FSTYPE EXPRESSION = ( MOUNT FSTYPE LIST | MOUNT EXPRESSION )

  MOUNT FSTYPE LIST = Comma separated list of valid filesystem and
                      virtual filesystem types (eg ext4, debugfs, etc)

  MOUNT FLAGS EXPRESSION = ( MOUNT FLAGS LIST | MOUNT EXPRESSION )

  MOUNT FLAGS LIST = Comma separated list of MOUNT FLAGS.

  MOUNT FLAGS = ( 'ro' | 'rw' | 'nosuid' | 'suid' | 'nodev' | 'dev' |
                  'noexec' | 'exec' | 'sync' | 'async' | 'remount' |
  'mand' | 'nomand' | 'dirsync' | 'noatime' | 'atime' |
  'nodiratime' | 'diratime' | 'bind' | 'rbind' | 'move' |
  'verbose' | 'silent' | 'loud' | 'acl' | 'noacl' |
  'unbindable' | 'runbindable' | 'private' | 'rprivate' |
  'slave' | 'rslave' | 'shared' | 'rshared' |
  'relatime' | 'norelatime' | 'iversion' | 'noiversion' |
  'strictatime' | 'nouser' | 'user' )

  MOUNT EXPRESSION = ( ALPHANUMERIC | AARE ) ...

  PIVOT ROOT RULE = [ QUALIFIERS ] pivot_root [ oldroot=OLD PUT FILEGLOB ]
                    [ NEW ROOT FILEGLOB ]

  SOURCE FILEGLOB = FILEGLOB

  MOUNTPOINT FILEGLOB = FILEGLOB

eg.
  mount,
  mount /dev/foo,
  mount options=ro /dev/foo -> /mnt/,
  mount options in (ro,atime) /dev/foo -> /mnt/,
  mount options=ro options=atime,

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
(cherry picked from commit fa488437d0f95b2e5db1e624341fe0d5a233f729 linux-next)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
security/apparmor/Makefile
security/apparmor/apparmorfs.c
security/apparmor/domain.c
security/apparmor/include/apparmor.h
security/apparmor/include/audit.h
security/apparmor/include/domain.h
security/apparmor/include/mount.h [new file with mode: 0644]
security/apparmor/lsm.c
security/apparmor/mount.c [new file with mode: 0644]