Skip to contentSkip to conversation

Logrotate, ssh_agent - read selinux_config_t

DISCUSSION Ivan Gyurdiev 3 participants 6 messages Mar 31, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

logrotate and ssh_agent try to read /etc/selinux/config and fail. I thought it would be reasonable to allow that, but I see this:

apache_macros.te:dontaudit httpd_$1_script_t selinux_config_t:dir search;
crontab_macros.te:dontaudit $1_crontab_t selinux_config_t:dir search; inetd_macros.te:dontaudit $1_t selinux_config_t:dir search; ssh_agent_macros.te:dontaudit $1_ssh_agent_t selinux_config_t:dir search;
ssh_macros.te:dontaudit $1_ssh_keysign_t selinux_config_t:dir search; xserver_macros.te:dontaudit $1_xserver_t selinux_config_t:dir search;

Why?

Signature · 8 lines
Ivan Gyurdiev <[email protected]>
Cornell University


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw
Quoted 12 lines · Ivan Gyurdiev

logrotate and ssh_agent try to read /etc/selinux/config and fail. I thought it would be reasonable to allow that, but I see this:

apache_macros.te:dontaudit httpd_$1_script_t selinux_config_t:dir search;
crontab_macros.te:dontaudit $1_crontab_t selinux_config_t:dir search; inetd_macros.te:dontaudit $1_t selinux_config_t:dir search; ssh_agent_macros.te:dontaudit $1_ssh_agent_t selinux_config_t:dir search;
ssh_macros.te:dontaudit $1_ssh_keysign_t selinux_config_t:dir search; xserver_macros.te:dontaudit $1_xserver_t selinux_config_t:dir search;

Quoted 1 line

Why?

libselinux reads /etc/selinux/config from a constructor to set up the paths to the policy files for later use internally or by the application. This ends up triggering a lot of unnecessary attempts to read it by programs that happen to link with libselinux but don't ever need to access a policy path.

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
Quoted 13 lines · Stephen Smalley
Quoted 12 lines · Ivan Gyurdiev

logrotate and ssh_agent try to read /etc/selinux/config and fail. I thought it would be reasonable to allow that, but I see this:

apache_macros.te:dontaudit httpd_$1_script_t selinux_config_t:dir search;
crontab_macros.te:dontaudit $1_crontab_t selinux_config_t:dir search; inetd_macros.te:dontaudit $1_t selinux_config_t:dir search; ssh_agent_macros.te:dontaudit $1_ssh_agent_t selinux_config_t:dir search;
ssh_macros.te:dontaudit $1_ssh_keysign_t selinux_config_t:dir search; xserver_macros.te:dontaudit $1_xserver_t selinux_config_t:dir search;

Quoted 7 lines
Quoted 1 line

Why?

libselinux reads /etc/selinux/config from a constructor to set up the paths to the policy files for later use internally or by the application. This ends up triggering a lot of unnecessary attempts to read it by programs that happen to link with libselinux but don't ever need to access a policy path.

[phantom@cobra ~]$ SYMBOLS=cat /usr/include/selinux/*|grep extern|sed -e s/\(.*//|sed -e s/.*" "//|grep ^[a-zA-Z]
[phantom@cobra ~]$ for SYMBOL in $SYMBOLS; do if [ ! -z "grep $SYMBOL /usr/sbin/logrotate" ]; then echo $SYMBOL; fi; done; is_selinux_enabled
freecon
getfscreatecon
setfscreatecon
getfilecon
fgetfilecon
selinux_getenforcemode
[phantom@cobra ~]$ for SYMBOL in $SYMBOLS; do if [ ! -z "grep $SYMBOL /usr/bin/ssh-agent" ]; then echo $SYMBOL; fi; done;

What does that mean - should they both be blocked, or only ssh-agent?

Signature · 8 lines
Ivan Gyurdiev <[email protected]>
Cornell University


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#3 lore raw
Quoted 14 lines · Ivan Gyurdiev

[phantom@cobra ~]$ SYMBOLS=cat /usr/include/selinux/*|grep extern|sed -e s/\(.*//|sed -e s/.*" "//|grep ^[a-zA-Z]
[phantom@cobra ~]$ for SYMBOL in $SYMBOLS; do if [ ! -z "grep $SYMBOL /usr/sbin/logrotate" ]; then echo $SYMBOL; fi; done; is_selinux_enabled
freecon
getfscreatecon
setfscreatecon
getfilecon
fgetfilecon
selinux_getenforcemode
[phantom@cobra ~]$ for SYMBOL in $SYMBOLS; do if [ ! -z "grep $SYMBOL /usr/bin/ssh-agent" ]; then echo $SYMBOL; fi; done;

Quoted 1 line

What does that mean - should they both be blocked, or only ssh-agent?

Of those functions, only selinux_getenforcemode() would need to read /etc/selinux/config, and I'm not sure why logrotate is using it instead of security_getenforce(), i.e. checking the current enforcing/permissive status rather than the one specified for boot-time in /etc/selinux/config.

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#4 lore raw
Quoted 21 lines · Stephen Smalley
Quoted 14 lines · Ivan Gyurdiev

[phantom@cobra ~]$ SYMBOLS=cat /usr/include/selinux/*|grep extern|sed -e s/\(.*//|sed -e s/.*" "//|grep ^[a-zA-Z]
[phantom@cobra ~]$ for SYMBOL in $SYMBOLS; do if [ ! -z "grep $SYMBOL /usr/sbin/logrotate" ]; then echo $SYMBOL; fi; done; is_selinux_enabled
freecon
getfscreatecon
setfscreatecon
getfilecon
fgetfilecon
selinux_getenforcemode
[phantom@cobra ~]$ for SYMBOL in $SYMBOLS; do if [ ! -z "grep $SYMBOL /usr/bin/ssh-agent" ]; then echo $SYMBOL; fi; done;

Quoted 3 lines

What does that mean - should they both be blocked, or only ssh-agent?

Quoted 8 lines

Of those functions, only selinux_getenforcemode() would need to read /etc/selinux/config, and I'm not sure why logrotate is using it instead of security_getenforce(), i.e. checking the current enforcing/permissive status rather than the one specified for boot-time in /etc/selinux/config.

logrotate patch is fixed, will be in tomorrow's build. I believe logrotate will need to read these files, not sshd.

Signature · 4 lines
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#5 lore raw
Quoted 3 lines · Daniel J Walsh

logrotate patch is fixed, will be in tomorrow's build. I believe logrotate will need to read these files,
not sshd.

If the patch is fixed, then logrotate shouldn't need access to /etc/selinux/config or the policy paths either.

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.