terminal: /dev/pts exists in /dev filesystem
PATCH 1/2 terminal: /dev/pts exists in /dev filesystem
systemd tries to create /dev/pts directly with its context type "devpts_t", but this is not allowed:
avc: denied { associate } for pid=1 comm="systemd" name="pts" scontext=system_u:object_r:devpts_t tcontext=system_u:object_r:device_t
tclass=filesystem permissive=1
--- policy/modules/kernel/terminal.te | 1 + 1 file changed, 1 insertion(+)
policy/modules/kernel/terminal.te +1 -0
@@ -25,6 +25,7 @@ dev_node(console_device_t) # the type of the root directory of the file system. # type devpts_t; +dev_associate(devpts_t) files_mountpoint(devpts_t) fs_associate_tmpfs(devpts_t) fs_xattr_type(devpts_t)
Signature · 1 line
2.14.1
PATCH 2/2 init: allow systemd to create /dev/pts as devpts_t
This is currently denied:
avc: denied { create } for pid=1 comm="systemd" name="pts" scontext=system_u:system_r:init_t tcontext=system_u:object_r:devpts_t tclass=dir permissive=1
--- policy/modules/kernel/terminal.if | 18 ++++++++++++++++++ policy/modules/system/init.te | 2 ++ 2 files changed, 20 insertions(+)
policy/modules/kernel/terminal.if +18 -0
@@ -149,6 +149,24 @@ interface(`term_mount_devpts',` allow $1 devpts_t:filesystem mount; ') +######################################## +## <summary> +## Create directory /dev/pts. +## </summary> +## <param name="domain"> +## <summary> +## The type of the process creating the directory. +## </summary> +## </param> +# +interface(`term_create_devpts',` + gen_require(` + type devpts_t; + ') + + allow $1 devpts_t:dir create_dir_perms; +') + ######################################## ## <summary> ## Create a pty in the /dev/pts directory.
policy/modules/system/init.te +2 -0
@@ -323,6 +323,8 @@ ifdef(`init_systemd',` systemd_manage_passwd_runtime_symlinks(init_t) systemd_use_passwd_agent(init_t) + term_create_devpts(init_t) + # udevd is a "systemd kobject uevent socket activated daemon" udev_create_kobject_uevent_sockets(init_t)
Signature · 1 line
2.14.1
PATCH 1/2 terminal: /dev/pts exists in /dev filesystem
In reply to Nicolas IoossQuoted 7 lines · Nicolas Iooss via refpolicy
systemd tries to create
/dev/ptsdirectly with its context type "devpts_t", but this is not allowed:avc: denied { associate } for pid=1 comm="systemd" name="pts" scontext=system_u:object_r:devpts_t tcontext=system_u:object_r:device_t
tclass=filesystem permissive=1
There is probably a context spec that say's that the /dev/pts dir should be of type devpts_t.
if you replace that spec with something like
/dev/pts -d <<None>>
then systemd creates the dir with type device_t, then devpts fs gets mounted on it and it will show up as devpts_t
I little bit cleaner in my opinion but i suppose a matter of taste
Quoted 23 lines
--- policy/modules/kernel/terminal.te | 1 + 1 file changed, 1 insertion(+)policy/modules/kernel/terminal.te +1
-0@@ -25,6 +25,7 @@ dev_node(console_device_t) # the type of the root directory of the file system. # type devpts_t; +dev_associate(devpts_t) files_mountpoint(devpts_t) fs_associate_tmpfs(devpts_t) fs_xattr_type(devpts_t)Signature · 6 lines
2.14.1 _______________________________________________ refpolicy mailing list refpolicy at oss.tresys.com http://oss.tresys.com/mailman/listinfo/refpolicy
Signature · 10 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Dominick Grift -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 659 bytes Desc: not available Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20170812/9b034a61/attachment.bin
PATCH 1/2 terminal: /dev/pts exists in /dev filesystem
Quoted 11 lines · Dominick Grift
Quoted 7 lines · Nicolas Iooss via refpolicy
systemd tries to create
/dev/ptsdirectly with its context type "devpts_t", but this is not allowed:avc: denied { associate } for pid=1 comm="systemd" name="pts" scontext=system_u:object_r:devpts_t tcontext=system_u:object_r:device_t
tclass=filesystem permissive=1There is probably a context spec that say's that the
/dev/ptsdir should be of typedevpts_t.
Quoted 7 lines
if you replace that spec with something like
/dev/pts-d <<None>>then systemd creates the dir with type
device_t, then devpts fs gets mounted on it and it will show up asdevpts_tI little bit cleaner in my opinion but i suppose a matter of taste
Never mind, that would not work for MLS:
/dev/pts -d gen_context(system_u:object_r:devpts_t,s0-mls_systemhigh)
Quoted 29 lines
Quoted 24 lines
--- policy/modules/kernel/terminal.te | 1 + 1 file changed, 1 insertion(+)policy/modules/kernel/terminal.te +1
-0@@ -25,6 +25,7 @@ dev_node(console_device_t) # the type of the root directory of the file system. # type devpts_t; +dev_associate(devpts_t) files_mountpoint(devpts_t) fs_associate_tmpfs(devpts_t) fs_xattr_type(devpts_t)Signature · 6 lines
2.14.1 _______________________________________________ refpolicy mailing list refpolicy at oss.tresys.com http://oss.tresys.com/mailman/listinfo/refpolicySignature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Dominick Grift
Signature · 10 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Dominick Grift -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 659 bytes Desc: not available Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20170812/87b99ca2/attachment.bin
PATCH 1/2 terminal: /dev/pts exists in /dev filesystem
Quoted 16 lines · Dominick Grift via refpolicy
Quoted 15 lines · Dominick Grift
Quoted 7 lines · Nicolas Iooss via refpolicy
systemd tries to create
/dev/ptsdirectly with its context type "devpts_t", but this is not allowed:avc: denied { associate } for pid=1 comm="systemd" name="pts" scontext=system_u:object_r:devpts_t tcontext=system_u:object_r:device_t
tclass=filesystem permissive=1There is probably a context spec that say's that the
/dev/ptsdir should be of typedevpts_t.if you replace that spec with something like
/dev/pts-d <<None>>
Quoted 7 lines
Quoted 3 lines
then systemd creates the dir with type
device_t, then devpts fs gets mounted on it and it will show up asdevpts_tI little bit cleaner in my opinion but i suppose a matter of taste
Never mind, that would not work for MLS:
/dev/pts-dgen_context(system_u:object_r:devpts_t,s0-mls_systemhigh)
Thanks for your quick review! This line is indeed what is currently in
refpolicy (https://github.com/TresysTechnology/refpolicy/blob/0ba1970b7cd4a809b155c457913bcd3dad2dc039/policy/modules/kernel/terminal.fc#L26).
I guess it is needed in order for /dev/pts to have the right context
after devpts filesystem is mounted.
Nicolas
Quoted 41 lines
Quoted 19 lines
Quoted 19 lines
--- policy/modules/kernel/terminal.te | 1 + 1 file changed, 1 insertion(+)policy/modules/kernel/terminal.te +1
-1@@ -25,6 +25,7 @@ dev_node(console_device_t) # the type of the root directory of the file system. # type devpts_t; +dev_associate(devpts_t) files_mountpoint(devpts_t) fs_associate_tmpfs(devpts_t) fs_xattr_type(devpts_t) --2.14.1
Quoted 9 lines
Quoted 4 lines
_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy--
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift--
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy
PATCH 1/2 terminal: /dev/pts exists in /dev filesystem
Quoted 24 lines · Nicolas Iooss
Quoted 22 lines · Dominick Grift via refpolicy
Quoted 11 lines · Dominick Grift
Quoted 7 lines · Nicolas Iooss via refpolicy
systemd tries to create
/dev/ptsdirectly with its context type "devpts_t", but this is not allowed:avc: denied { associate } for pid=1 comm="systemd" name="pts" scontext=system_u:object_r:devpts_t tcontext=system_u:object_r:device_t
tclass=filesystem permissive=1There is probably a context spec that say's that the
/dev/ptsdir should be of typedevpts_t.Quoted 7 lines
if you replace that spec with something like
/dev/pts-d <<None>>then systemd creates the dir with type
device_t, then devpts fs gets mounted on it and it will show up asdevpts_tI little bit cleaner in my opinion but i suppose a matter of taste
Never mind, that would not work for MLS:
Quoted 8 lines
Quoted 1 line
/dev/pts-dgen_context(system_u:object_r:devpts_t,s0-mls_systemhigh)Thanks for your quick review! This line is indeed what is currently in
refpolicy (https://github.com/TresysTechnology/refpolicy/blob/0ba1970b7cd4a809b155c457913bcd3dad2dc039/policy/modules/kernel/terminal.fc#L26).
I guess it is needed in order for/dev/ptsto have the right context
after devpts filesystem is mounted.Nicolas
Hello,
If I correctly understood the discussion about this patch, there are no issues preventing it from being merged. Could it be merged (and the one I sent with it, "init: allow systemd to create /dev/pts as devpts_t") too?
Thanks,
Nicolas
Quoted 41 lines
Quoted 41 lines
Quoted 19 lines
Quoted 19 lines
--- policy/modules/kernel/terminal.te | 1 + 1 file changed, 1 insertion(+)policy/modules/kernel/terminal.te +1
-1@@ -25,6 +25,7 @@ dev_node(console_device_t) # the type of the root directory of the file system. # type devpts_t; +dev_associate(devpts_t) files_mountpoint(devpts_t) fs_associate_tmpfs(devpts_t) fs_xattr_type(devpts_t) --2.14.1
Quoted 9 lines
Quoted 4 lines
_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy--
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift--
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy
PATCH 1/2 terminal: /dev/pts exists in /dev filesystem
In reply to Nicolas IoossQuoted 16 lines · Nicolas Iooss via refpolicy
systemd tries to create
/dev/ptsdirectly with its context type "devpts_t", but this is not allowed:avc: denied { associate } for pid=1 comm="systemd" name="pts" scontext=system_u:object_r:devpts_t tcontext=system_u:object_r:device_t
tclass=filesystem permissive=1--- policy/modules/kernel/terminal.te | 1 + 1 file changed, 1 insertion(+)policy/modules/kernel/terminal.te +0
-0
policy/modules/kernel/terminal.te dev_node(console_device_t) · line 31
Quoted 7 lines
policy/modules/kernel/terminal.te +1
-0@@ -25,6 +25,7 @@ dev_node(console_device_t) # the type of the root directory of the file system. # type devpts_t; +dev_associate(devpts_t) files_mountpoint(devpts_t) fs_associate_tmpfs(devpts_t) fs_xattr_type(devpts_t)
Merged.
Signature · 1 line
Chris PeBenito