Skip to content

Commit

Permalink
apparmor: move permissions into their own file to be more easily shared
Browse files Browse the repository at this point in the history
Signed-off-by: John Johansen <[email protected]>
  • Loading branch information
John Johansen committed Jun 8, 2017
1 parent c961ee5 commit fc7e0b2
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 19 deletions.
20 changes: 1 addition & 19 deletions security/apparmor/include/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,11 @@

#include "domain.h"
#include "match.h"
#include "perms.h"

struct aa_profile;
struct path;

/*
* We use MAY_EXEC, MAY_WRITE, MAY_READ, MAY_APPEND and the following flags
* for profile permissions
*/
#define AA_MAY_CREATE 0x0010
#define AA_MAY_DELETE 0x0020
#define AA_MAY_META_WRITE 0x0040
#define AA_MAY_META_READ 0x0080

#define AA_MAY_CHMOD 0x0100
#define AA_MAY_CHOWN 0x0200
#define AA_MAY_LOCK 0x0400
#define AA_EXEC_MMAP 0x0800

#define AA_MAY_LINK 0x1000
#define AA_LINK_SUBSET AA_MAY_LOCK /* overlaid */
#define AA_MAY_ONEXEC 0x40000000 /* exec allows onexec */
#define AA_MAY_CHANGE_PROFILE 0x80000000
#define AA_MAY_CHANGEHAT 0x80000000 /* ctrl auditing only */

#define AA_AUDIT_FILE_MASK (MAY_READ | MAY_WRITE | MAY_EXEC | MAY_APPEND |\
AA_MAY_CREATE | AA_MAY_DELETE | \
Expand Down
40 changes: 40 additions & 0 deletions security/apparmor/include/perms.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* AppArmor security module
*
* This file contains AppArmor basic permission sets definitions.
*
* Copyright 2017 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, version 2 of the
* License.
*/

#ifndef __AA_PERM_H
#define __AA_PERM_H

#include <linux/fs.h>

/*
* We use MAY_EXEC, MAY_WRITE, MAY_READ, MAY_APPEND and the following flags
* for profile permissions
*/
#define AA_MAY_CREATE 0x0010
#define AA_MAY_DELETE 0x0020
#define AA_MAY_META_WRITE 0x0040
#define AA_MAY_META_READ 0x0080

#define AA_MAY_CHMOD 0x0100
#define AA_MAY_CHOWN 0x0200
#define AA_MAY_LOCK 0x0400
#define AA_EXEC_MMAP 0x0800

#define AA_MAY_LINK 0x1000
#define AA_LINK_SUBSET AA_MAY_LOCK /* overlaid */
#define AA_MAY_ONEXEC 0x40000000 /* exec allows onexec */
#define AA_MAY_CHANGE_PROFILE 0x80000000
#define AA_MAY_CHANGEHAT 0x80000000 /* ctrl auditing only */


#endif /* __AA_PERM_H */
1 change: 1 addition & 0 deletions security/apparmor/include/policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "domain.h"
#include "file.h"
#include "lib.h"
#include "perms.h"
#include "resource.h"


Expand Down
1 change: 1 addition & 0 deletions security/apparmor/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "include/audit.h"
#include "include/apparmor.h"
#include "include/lib.h"
#include "include/perms.h"
#include "include/policy.h"

/**
Expand Down

0 comments on commit fc7e0b2

Please sign in to comment.