2020-09-12 17:19:23 +02:00
|
|
|
# vim:syntax=apparmor
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
#
|
2021-01-10 16:35:07 +01:00
|
|
|
# Copyright (C) 2019-2021 Mikhail Morfikov
|
2020-09-12 17:19:23 +02:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of version 2 of the GNU General Public
|
|
|
|
# License published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
|
2020-12-10 22:33:39 +01:00
|
|
|
abi <abi/3.0>,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2020-12-10 22:33:39 +01:00
|
|
|
include <tunables/global>
|
2020-09-12 17:19:23 +02:00
|
|
|
|
|
|
|
@{exec_path} = /{usr/,}sbin/add{user,group}
|
|
|
|
profile adduser @{exec_path} {
|
2020-12-10 22:33:39 +01:00
|
|
|
include <abstractions/base>
|
|
|
|
include <abstractions/consoles>
|
|
|
|
include <abstractions/perl>
|
|
|
|
include <abstractions/nameservice-strict>
|
2020-09-12 17:19:23 +02:00
|
|
|
|
|
|
|
# To create a user home dir and give it proper permissions:
|
|
|
|
# mkdir("/home/user", 0755) = 0
|
|
|
|
# chown("/home/user", 1001, 1001) = 0
|
|
|
|
# chmod("/home/user", 0755) = 0
|
|
|
|
capability chown,
|
|
|
|
capability fowner,
|
|
|
|
|
|
|
|
# To set the set-group-ID bit for the user home dir (SETGID_HOME=yes).
|
|
|
|
capability fsetid,
|
|
|
|
|
|
|
|
# To copy files from the /etc/skel/ dir to the newly created user dir, which now has a different
|
|
|
|
# owner.
|
|
|
|
capability dac_read_search,
|
|
|
|
capability dac_override,
|
|
|
|
|
|
|
|
@{exec_path} r,
|
|
|
|
/{usr/,}bin/perl r,
|
|
|
|
|
2020-12-09 10:30:52 +01:00
|
|
|
/{usr/,}bin/{,ba,da}sh rix,
|
|
|
|
/{usr/,}bin/find rix,
|
|
|
|
/{usr/,}bin/rm rix,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
2020-12-09 10:30:52 +01:00
|
|
|
/{usr/,}sbin/useradd rPx,
|
|
|
|
/{usr/,}sbin/userdel rPx,
|
|
|
|
/{usr/,}sbin/groupdel rPx,
|
|
|
|
/{usr/,}sbin/groupadd rPx,
|
|
|
|
/{usr/,}sbin/usermod rPx,
|
|
|
|
/{usr/,}bin/passwd rPx,
|
|
|
|
/{usr/,}bin/gpasswd rPx,
|
|
|
|
/{usr/,}bin/chfn rPx,
|
|
|
|
/{usr/,}bin/chage rPx,
|
2020-09-12 17:19:23 +02:00
|
|
|
|
|
|
|
/etc/{group,passwd,shadow} r,
|
|
|
|
|
|
|
|
/etc/adduser.conf r,
|
|
|
|
|
|
|
|
# To create user dirs
|
|
|
|
@{HOME}/ rw,
|
|
|
|
|
|
|
|
# To copy files from /etc/skel/ to user dirs
|
|
|
|
@{HOME}/.* w,
|
|
|
|
/etc/skel/{,.*} r,
|
|
|
|
|
|
|
|
# What's this for? (#FIXME#)
|
|
|
|
/var/lib/lightdm/{,*} w,
|
|
|
|
/var/lib/sddm/{,*} w,
|
|
|
|
|
2020-12-10 22:33:39 +01:00
|
|
|
include if exists <local/adduser>
|
2020-09-12 17:19:23 +02:00
|
|
|
}
|