SELinux-Refpolicy Archive on lore.kernel.org
 help / color / Atom feed
* [RFC] ssh: remove unconfined_shell_domtrans(sshd_t)
@ 2019-08-31 17:27 Dominick Grift
  2019-08-31 20:54 ` Chris PeBenito
  0 siblings, 1 reply; 4+ messages in thread
From: Dominick Grift @ 2019-08-31 17:27 UTC (permalink / raw)
  To: selinux-refpolicy; +Cc: Dominick Grift

This call allows sshd_t associated processes with run shell with an automatic domain transition to unconfined_t.
I was unable to make sense of the commit that added this:

https://github.com/SELinuxProject/refpolicy/commit/708aab13932bb8830a2d37850cc0a5c72a5d4df4

Debian's motd dynamic pam module makes sshd run a shell, we want this shell to run with sshd_t instead of unconfined_t

This patch will make the ssh_sysadm_login boolean apply to unconfined ssh logins.
To me this makes sense, as unconfined_t is targeted equivalent to the strict sysadm_t.
The boolean could however be renamed to the more generic ssh_priv_login name.

Signed-off-by: Dominick Grift <dac.override@gmail.com>
---
 policy/modules/services/ssh.te | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/policy/modules/services/ssh.te b/policy/modules/services/ssh.te
index 4e75b6e1..a99ad912 100644
--- a/policy/modules/services/ssh.te
+++ b/policy/modules/services/ssh.te
@@ -328,10 +328,6 @@ optional_policy(`
 	systemd_dbus_chat_logind(sshd_t)
 ')
 
-optional_policy(`
-	unconfined_shell_domtrans(sshd_t)
-')
-
 optional_policy(`
 	xserver_domtrans_xauth(sshd_t)
 	xserver_link_xdm_keys(sshd_t)
-- 
2.23.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] ssh: remove unconfined_shell_domtrans(sshd_t)
  2019-08-31 17:27 [RFC] ssh: remove unconfined_shell_domtrans(sshd_t) Dominick Grift
@ 2019-08-31 20:54 ` Chris PeBenito
  2019-09-01 11:19   ` Nicolas Iooss
  0 siblings, 1 reply; 4+ messages in thread
From: Chris PeBenito @ 2019-08-31 20:54 UTC (permalink / raw)
  To: Dominick Grift, selinux-refpolicy

On 8/31/19 1:27 PM, Dominick Grift wrote:
> This call allows sshd_t associated processes with run shell with an automatic domain transition to unconfined_t.
> I was unable to make sense of the commit that added this:
> 
> https://github.com/SELinuxProject/refpolicy/commit/708aab13932bb8830a2d37850cc0a5c72a5d4df4
> 
> Debian's motd dynamic pam module makes sshd run a shell, we want this shell to run with sshd_t instead of unconfined_t
> 
> This patch will make the ssh_sysadm_login boolean apply to unconfined ssh logins.
> To me this makes sense, as unconfined_t is targeted equivalent to the strict sysadm_t.
> The boolean could however be renamed to the more generic ssh_priv_login name.
> 
> Signed-off-by: Dominick Grift <dac.override@gmail.com>
> ---
>   policy/modules/services/ssh.te | 4 ----
>   1 file changed, 4 deletions(-)
> 
> diff --git a/policy/modules/services/ssh.te b/policy/modules/services/ssh.te
> index 4e75b6e1..a99ad912 100644
> --- a/policy/modules/services/ssh.te
> +++ b/policy/modules/services/ssh.te
> @@ -328,10 +328,6 @@ optional_policy(`
>   	systemd_dbus_chat_logind(sshd_t)
>   ')
>   
> -optional_policy(`
> -	unconfined_shell_domtrans(sshd_t)
> -')
> -
>   optional_policy(`
>   	xserver_domtrans_xauth(sshd_t)
>   	xserver_link_xdm_keys(sshd_t)

I don't have any objections to this.

-- 
Chris PeBenito

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] ssh: remove unconfined_shell_domtrans(sshd_t)
  2019-08-31 20:54 ` Chris PeBenito
@ 2019-09-01 11:19   ` Nicolas Iooss
  2019-09-01 11:36     ` Dominick Grift
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Iooss @ 2019-09-01 11:19 UTC (permalink / raw)
  To: Chris PeBenito, Dominick Grift; +Cc: selinux-refpolicy

On Sat, Aug 31, 2019 at 10:54 PM Chris PeBenito <pebenito@ieee.org> wrote:
>
> On 8/31/19 1:27 PM, Dominick Grift wrote:
> > This call allows sshd_t associated processes with run shell with an automatic domain transition to unconfined_t.
> > I was unable to make sense of the commit that added this:
> >
> > https://github.com/SELinuxProject/refpolicy/commit/708aab13932bb8830a2d37850cc0a5c72a5d4df4
> >
> > Debian's motd dynamic pam module makes sshd run a shell, we want this shell to run with sshd_t instead of unconfined_t
> >
> > This patch will make the ssh_sysadm_login boolean apply to unconfined ssh logins.
> > To me this makes sense, as unconfined_t is targeted equivalent to the strict sysadm_t.
> > The boolean could however be renamed to the more generic ssh_priv_login name.
> >
> > Signed-off-by: Dominick Grift <dac.override@gmail.com>
> > ---
> >   policy/modules/services/ssh.te | 4 ----
> >   1 file changed, 4 deletions(-)
> >
> > diff --git a/policy/modules/services/ssh.te b/policy/modules/services/ssh.te
> > index 4e75b6e1..a99ad912 100644
> > --- a/policy/modules/services/ssh.te
> > +++ b/policy/modules/services/ssh.te
> > @@ -328,10 +328,6 @@ optional_policy(`
> >       systemd_dbus_chat_logind(sshd_t)
> >   ')
> >
> > -optional_policy(`
> > -     unconfined_shell_domtrans(sshd_t)
> > -')
> > -
> >   optional_policy(`
> >       xserver_domtrans_xauth(sshd_t)
> >       xserver_link_xdm_keys(sshd_t)
>
> I don't have any objections to this.

Would it be possible to extend this patch to other callers of
unconfined_shell_domtrans, like the patch below? It will help fix
issues with Debian's PAM module that generates the MOTD (Message Of
The Day) in a dynamic way, using shell commands (cf.
https://wiki.debian.org/motd for more information: calling system()
triggers a transition to system_u:system_r:unconfined_t because of
unconfined_shell_domtrans).

diff --git a/policy/modules/services/remotelogin.te
b/policy/modules/services/remotelogin.te
index bc2292e37892..c7c9c5646785 100644
--- a/policy/modules/services/remotelogin.te
+++ b/policy/modules/services/remotelogin.te
@@ -91,10 +91,6 @@ optional_policy(`
  telnet_use_ptys(remote_login_t)
 ')

-optional_policy(`
- unconfined_shell_domtrans(remote_login_t)
-')
-
 optional_policy(`
  usermanage_read_crack_db(remote_login_t)
 ')
diff --git a/policy/modules/services/rshd.te b/policy/modules/services/rshd.te
index 0f4caffc4f33..196ed2848e4b 100644
--- a/policy/modules/services/rshd.te
+++ b/policy/modules/services/rshd.te
@@ -74,6 +74,5 @@ optional_policy(`
 ')

 optional_policy(`
- unconfined_shell_domtrans(rshd_t)
  unconfined_signal(rshd_t)
 ')
diff --git a/policy/modules/system/locallogin.te
b/policy/modules/system/locallogin.te
index a56f3d1fbe16..632d2542972d 100644
--- a/policy/modules/system/locallogin.te
+++ b/policy/modules/system/locallogin.te
@@ -200,10 +200,6 @@ optional_policy(`
  systemd_write_inherited_logind_sessions_pipes(local_login_t)
 ')

-optional_policy(`
- unconfined_shell_domtrans(local_login_t)
-')
-
 optional_policy(`
  usermanage_read_crack_db(local_login_t)
 ')


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] ssh: remove unconfined_shell_domtrans(sshd_t)
  2019-09-01 11:19   ` Nicolas Iooss
@ 2019-09-01 11:36     ` Dominick Grift
  0 siblings, 0 replies; 4+ messages in thread
From: Dominick Grift @ 2019-09-01 11:36 UTC (permalink / raw)
  To: Nicolas Iooss; +Cc: Chris PeBenito, selinux-refpolicy

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

On Sun, Sep 01, 2019 at 01:19:56PM +0200, Nicolas Iooss wrote:
> On Sat, Aug 31, 2019 at 10:54 PM Chris PeBenito <pebenito@ieee.org> wrote:
> >
> > On 8/31/19 1:27 PM, Dominick Grift wrote:
> > > This call allows sshd_t associated processes with run shell with an automatic domain transition to unconfined_t.
> > > I was unable to make sense of the commit that added this:
> > >
> > > https://github.com/SELinuxProject/refpolicy/commit/708aab13932bb8830a2d37850cc0a5c72a5d4df4
> > >
> > > Debian's motd dynamic pam module makes sshd run a shell, we want this shell to run with sshd_t instead of unconfined_t
> > >
> > > This patch will make the ssh_sysadm_login boolean apply to unconfined ssh logins.
> > > To me this makes sense, as unconfined_t is targeted equivalent to the strict sysadm_t.
> > > The boolean could however be renamed to the more generic ssh_priv_login name.
> > >
> > > Signed-off-by: Dominick Grift <dac.override@gmail.com>
> > > ---
> > >   policy/modules/services/ssh.te | 4 ----
> > >   1 file changed, 4 deletions(-)
> > >
> > > diff --git a/policy/modules/services/ssh.te b/policy/modules/services/ssh.te
> > > index 4e75b6e1..a99ad912 100644
> > > --- a/policy/modules/services/ssh.te
> > > +++ b/policy/modules/services/ssh.te
> > > @@ -328,10 +328,6 @@ optional_policy(`
> > >       systemd_dbus_chat_logind(sshd_t)
> > >   ')
> > >
> > > -optional_policy(`
> > > -     unconfined_shell_domtrans(sshd_t)
> > > -')
> > > -
> > >   optional_policy(`
> > >       xserver_domtrans_xauth(sshd_t)
> > >       xserver_link_xdm_keys(sshd_t)
> >
> > I don't have any objections to this.
> 
> Would it be possible to extend this patch to other callers of
> unconfined_shell_domtrans, like the patch below? It will help fix
> issues with Debian's PAM module that generates the MOTD (Message Of
> The Day) in a dynamic way, using shell commands (cf.
> https://wiki.debian.org/motd for more information: calling system()
> triggers a transition to system_u:system_r:unconfined_t because of
> unconfined_shell_domtrans).

Not sure about remotelogin and rshd (are people still using this?), but I do believe one should be able to remove it from local_login_t.

> 
> diff --git a/policy/modules/services/remotelogin.te
> b/policy/modules/services/remotelogin.te
> index bc2292e37892..c7c9c5646785 100644
> --- a/policy/modules/services/remotelogin.te
> +++ b/policy/modules/services/remotelogin.te
> @@ -91,10 +91,6 @@ optional_policy(`
>   telnet_use_ptys(remote_login_t)
>  ')
> 
> -optional_policy(`
> - unconfined_shell_domtrans(remote_login_t)
> -')
> -
>  optional_policy(`
>   usermanage_read_crack_db(remote_login_t)
>  ')
> diff --git a/policy/modules/services/rshd.te b/policy/modules/services/rshd.te
> index 0f4caffc4f33..196ed2848e4b 100644
> --- a/policy/modules/services/rshd.te
> +++ b/policy/modules/services/rshd.te
> @@ -74,6 +74,5 @@ optional_policy(`
>  ')
> 
>  optional_policy(`
> - unconfined_shell_domtrans(rshd_t)
>   unconfined_signal(rshd_t)
>  ')
> diff --git a/policy/modules/system/locallogin.te
> b/policy/modules/system/locallogin.te
> index a56f3d1fbe16..632d2542972d 100644
> --- a/policy/modules/system/locallogin.te
> +++ b/policy/modules/system/locallogin.te
> @@ -200,10 +200,6 @@ optional_policy(`
>   systemd_write_inherited_logind_sessions_pipes(local_login_t)
>  ')
> 
> -optional_policy(`
> - unconfined_shell_domtrans(local_login_t)
> -')
> -
>  optional_policy(`
>   usermanage_read_crack_db(local_login_t)
>  ')
> 

-- 
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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-31 17:27 [RFC] ssh: remove unconfined_shell_domtrans(sshd_t) Dominick Grift
2019-08-31 20:54 ` Chris PeBenito
2019-09-01 11:19   ` Nicolas Iooss
2019-09-01 11:36     ` Dominick Grift

SELinux-Refpolicy Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/selinux-refpolicy/0 selinux-refpolicy/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 selinux-refpolicy selinux-refpolicy/ https://lore.kernel.org/selinux-refpolicy \
		selinux-refpolicy@vger.kernel.org
	public-inbox-index selinux-refpolicy

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.selinux-refpolicy


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git