1. 23 9月, 2017 6 次提交
    • J
      apparmor: add mount mediation · 2ea3ffb7
      John Johansen 提交于
      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: NJohn Johansen <john.johansen@canonical.com>
      Acked-by: NSeth Arnold <seth.arnold@canonical.com>
      2ea3ffb7
    • J
      apparmor: add the ability to mediate signals · cd1dbf76
      John Johansen 提交于
      Add signal mediation where the signal can be mediated based on the
      signal, direction, or the label or the peer/target. The signal perms
      are verified on a cross check to ensure policy consistency in the case
      of incremental policy load/replacement.
      
      The optimization of skipping the cross check when policy is guaranteed
      to be consistent (single compile unit) remains to be done.
      
      policy rules have the form of
        SIGNAL_RULE = [ QUALIFIERS ] 'signal' [ SIGNAL ACCESS PERMISSIONS ]
                      [ SIGNAL SET ] [ SIGNAL PEER ]
      
        SIGNAL ACCESS PERMISSIONS = SIGNAL ACCESS | SIGNAL ACCESS LIST
      
        SIGNAL ACCESS LIST = '(' Comma or space separated list of SIGNAL
                                 ACCESS ')'
      
        SIGNAL ACCESS = ( 'r' | 'w' | 'rw' | 'read' | 'write' | 'send' |
                          'receive' )
      
        SIGNAL SET = 'set' '=' '(' SIGNAL LIST ')'
      
        SIGNAL LIST = Comma or space separated list of SIGNALS
      
        SIGNALS = ( 'hup' | 'int' | 'quit' | 'ill' | 'trap' | 'abrt' |
                    'bus' | 'fpe' | 'kill' | 'usr1' | 'segv' | 'usr2' |
      	      'pipe' | 'alrm' | 'term' | 'stkflt' | 'chld' | 'cont' |
      	      'stop' | 'stp' | 'ttin' | 'ttou' | 'urg' | 'xcpu' |
      	      'xfsz' | 'vtalrm' | 'prof' | 'winch' | 'io' | 'pwr' |
      	      'sys' | 'emt' | 'exists' | 'rtmin+0' ... 'rtmin+32'
                  )
      
        SIGNAL PEER = 'peer' '=' AARE
      
      eg.
        signal,                                 # allow all signals
        signal send set=(hup, kill) peer=foo,
      Signed-off-by: NJohn Johansen <john.johansen@canonical.com>
      Acked-by: NSeth Arnold <seth.arnold@canonical.com>
      cd1dbf76
    • J
    • D
      apparmor: Fix an error code in aafs_create() · 5d314a81
      Dan Carpenter 提交于
      We accidentally forgot to set the error code on this path.  It means we
      return NULL instead of an error pointer.  I looked through a bunch of
      callers and I don't think it really causes a big issue, but the
      documentation says we're supposed to return error pointers here.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: NSerge Hallyn <serge@hallyn.com>
      Signed-off-by: NJohn Johansen <john.johansen@canonical.com>
      5d314a81
    • C
      apparmor: Fix logical error in verify_header() · 86aea56f
      Christos Gkekas 提交于
      verify_header() is currently checking whether interface version is less
      than 5 *and* greater than 7, which always evaluates to false. Instead it
      should check whether it is less than 5 *or* greater than 7.
      Signed-off-by: NChristos Gkekas <chris.gekas@gmail.com>
      Signed-off-by: NJohn Johansen <john.johansen@canonical.com>
      86aea56f
    • G
      apparmor: Fix shadowed local variable in unpack_trans_table() · 19fe43a5
      Geert Uytterhoeven 提交于
      with W=2:
      
          security/apparmor/policy_unpack.c: In function ‘unpack_trans_table’:
          security/apparmor/policy_unpack.c:469: warning: declaration of ‘pos’ shadows a previous local
          security/apparmor/policy_unpack.c:451: warning: shadowed declaration is here
      
      Rename the old "pos" to "saved_pos" to fix this.
      
      Fixes: 5379a331 ("apparmor: support v7 transition format compatible with label_parse")
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Reviewed-by: NSerge Hallyn <serge@hallyn.com>
      Signed-off-by: NJohn Johansen <john.johansen@canonical.com>
      19fe43a5
  2. 28 6月, 2017 1 次提交
  3. 11 6月, 2017 33 次提交