All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dominick Grift <dac.override@gmail.com>
To: David Sugar <dsugar@tresys.com>
Cc: "selinux-refpolicy@vger.kernel.org"  <selinux-refpolicy@vger.kernel.org>
Subject: Re: [PATCH 2/2] pam_faillock creates files in /run/faillock
Date: Fri, 21 Dec 2018 11:34:16 +0100	[thread overview]
Message-ID: <20181221103416.GA4520@brutus.lan> (raw)
In-Reply-To: <20181221014026.2867-2-dsugar@tresys.com>

[-- Attachment #1: Type: text/plain, Size: 5226 bytes --]

On Fri, Dec 21, 2018 at 01:41:25AM +0000, David Sugar wrote:
> These are changes needed when pam_fallock created files in /run/faillock
> (which is labeled faillog_t).  sudo and xdm (and probably other domains)
> will create files in this directory for successful and failed logins
> attempts.

The pam stuff has become a bit broken in my view.

We use to use auth_use_pam() for these kinds of things but the interface was forgotten and not updated properly.

So for example sudo does not even call auth_use_pam() and a lot of stuff was added directly to the login_pgm domain that should have been added to auth_use_pam() instead.

My opinion is that this belongs in auth_use_pam()


> 
> type=AVC msg=audit(1545153126.899:210): avc:  denied  { search } for pid=8448 comm="lightdm" name="faillock" dev="tmpfs" ino=39318 scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:faillog_t:s0 tclass=dir permissive=1
> type=AVC msg=audit(1545153131.090:214): avc:  denied  { write } for pid=8448 comm="lightdm" name="faillock" dev="tmpfs" ino=39318 scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:faillog_t:s0 tclass=dir permissive=1
> type=AVC msg=audit(1545153131.090:214): avc:  denied  { add_name } for pid=8448 comm="lightdm" name="dsugar" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:faillog_t:s0 tclass=dir permissive=1
> type=AVC msg=audit(1545153131.090:214): avc:  denied  { create } for pid=8448 comm="lightdm" name="dsugar" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:faillog_t:s0 tclass=file permissive=1
> type=AVC msg=audit(1545153131.091:215): avc:  denied  { setattr } for pid=8448 comm="lightdm" name="dsugar" dev="tmpfs" ino=87599 scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:faillog_t:s0 tclass=file permissive=1
> 
> type=AVC msg=audit(1545167205.531:626): avc:  denied  { search } for pid=8264 comm="sudo" name="faillock" dev="tmpfs" ino=35405 scontext=sysadm_u:sysadm_r:cleaner_applyconfig_sudo_t:s0-s0:c0.c1023 tcontext=system_u:object_r:faillog_t:s0 tclass=dir permissive=1
> type=AVC msg=audit(1545167205.531:627): avc:  denied  { write } for pid=8264 comm="sudo" name="faillock" dev="tmpfs" ino=35405 scontext=sysadm_u:sysadm_r:cleaner_applyconfig_sudo_t:s0-s0:c0.c1023 tcontext=system_u:object_r:faillog_t:s0 tclass=dir permissive=1
> type=AVC msg=audit(1545167205.531:627): avc:  denied  { add_name } for pid=8264 comm="sudo" name="root" scontext=sysadm_u:sysadm_r:cleaner_applyconfig_sudo_t:s0-s0:c0.c1023 tcontext=system_u:object_r:faillog_t:s0 tclass=dir permissive=1
> type=AVC msg=audit(1545167205.531:627): avc:  denied  { create } for pid=8264 comm="sudo" name="root" scontext=sysadm_u:sysadm_r:cleaner_applyconfig_sudo_t:s0-s0:c0.c1023 tcontext=sysadm_u:object_r:faillog_t:s0 tclass=file permissive=1
> 
> Signed-off-by: Dave Sugar <dsugar@tresys.com>
> ---
>  policy/modules/admin/sudo.if       |  1 +
>  policy/modules/services/xserver.te |  1 +
>  policy/modules/system/authlogin.if | 20 ++++++++++++++++++++
>  3 files changed, 22 insertions(+)
> 
> diff --git a/policy/modules/admin/sudo.if b/policy/modules/admin/sudo.if
> index 7661a2f3..5fab0d04 100644
> --- a/policy/modules/admin/sudo.if
> +++ b/policy/modules/admin/sudo.if
> @@ -113,6 +113,7 @@ template(`sudo_role_template',`
>  	term_relabel_all_ttys($1_sudo_t)
>  	term_relabel_all_ptys($1_sudo_t)
>  
> +	auth_create_faillog($1_sudo_t)
>  	auth_run_chk_passwd($1_sudo_t, $2)
>  	# sudo stores a token in the pam_pid directory
>  	auth_manage_pam_pid($1_sudo_t)
> diff --git a/policy/modules/services/xserver.te b/policy/modules/services/xserver.te
> index 12ad3a87..fd89a95b 100644
> --- a/policy/modules/services/xserver.te
> +++ b/policy/modules/services/xserver.te
> @@ -481,6 +481,7 @@ term_setattr_console(xdm_t)
>  term_use_unallocated_ttys(xdm_t)
>  term_setattr_unallocated_ttys(xdm_t)
>  
> +auth_create_faillog(xdm_t)
>  auth_domtrans_pam_console(xdm_t)
>  auth_manage_pam_pid(xdm_t)
>  auth_manage_pam_console_data(xdm_t)
> diff --git a/policy/modules/system/authlogin.if b/policy/modules/system/authlogin.if
> index 7f8c002e..5521aec3 100644
> --- a/policy/modules/system/authlogin.if
> +++ b/policy/modules/system/authlogin.if
> @@ -744,6 +744,26 @@ interface(`auth_append_faillog',`
>  	allow $1 faillog_t:file append_file_perms;
>  ')
>  
> +########################################
> +## <summary>
> +##	Create fail log lock (in /run/faillock).
> +## </summary>
> +## <param name="domain">
> +##	<summary>
> +##	Domain allowed access.
> +##	</summary>
> +## </param>
> +#
> +interface(`auth_create_faillog',`
> +	gen_require(`
> +		type faillog_t;
> +	')
> +
> +	auth_rw_faillog($1)
> +	create_files_pattern($1, faillog_t, faillog_t)
> +	setattr_files_pattern($1, faillog_t, faillog_t)
> +')
> +
>  ########################################
>  ## <summary>
>  ##	Read and write the login failure log.
> -- 
> 2.19.2
> 

-- 
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2018-12-21 10:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-21  1:41 [PATCH 1/2] Allow greeter to start dbus and transition David Sugar
2018-12-21  1:41 ` [PATCH 2/2] pam_faillock creates files in /run/faillock David Sugar
2018-12-21 10:34   ` Dominick Grift [this message]
2018-12-22  2:58     ` Sugar, David
2018-12-22 19:20       ` Chris PeBenito
2018-12-23 10:20       ` Dominick Grift
2018-12-23 10:46         ` Dominick Grift
2018-12-23 16:09           ` Dominick Grift
2018-12-23 16:16             ` Dominick Grift
2018-12-22 19:28 ` [PATCH 1/2] Allow greeter to start dbus and transition Chris PeBenito
2018-12-23 16:33   ` Dominick Grift
2018-12-23 16:45     ` Dominick Grift
2018-12-23 16:52       ` Dominick Grift
2018-12-23 16:55         ` Dominick Grift
2018-12-23 17:02           ` Dominick Grift

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181221103416.GA4520@brutus.lan \
    --to=dac.override@gmail.com \
    --cc=dsugar@tresys.com \
    --cc=selinux-refpolicy@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.