apparmor.d/profiles/cppw-cpgr

43 lines
1.2 KiB
Text
Raw Normal View History

# vim:syntax=apparmor
# ------------------------------------------------------------------
#
2021-01-10 16:35:07 +01:00
# Copyright (C) 2019-2021 Mikhail Morfikov
#
# 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-12-10 22:33:39 +01:00
include <tunables/global>
@{exec_path} = /{usr/,}sbin/cp{pw,gr}
profile cppw-cpgr @{exec_path} {
2020-12-10 22:33:39 +01:00
include <abstractions/base>
# To set the right permission to the files in the /etc/ dir.
capability chown,
capability fsetid,
@{exec_path} mr,
/etc/{passwd,shadow,gshadow,group} rw,
/etc/{passwd,shadow,gshadow,group}.@{pid} rw,
/etc/{passwd,shadow,gshadow,group}.new rw,
/etc/passwd.lock wl -> /etc/passwd.@{pid},
/etc/shadow.lock wl -> /etc/shadow.@{pid},
/etc/gshadow.lock wl -> /etc/gshadow.@{pid},
/etc/group.lock wl -> /etc/group.@{pid},
# A process first uses lckpwdf() to lock the lock file, thereby gaining exclusive rights to
# modify the /etc/passwd or /etc/shadow password database.
/etc/.pwd.lock rwk,
# Source of the files to be replaced
owner /root/* r,
2020-12-10 22:33:39 +01:00
include if exists <local/cppw-cpgr>
}