Por algum motivo, não consigo su com root de um usuário não-root:
[rilindo@kerberos ~]$ /bin/su -
-bash: /bin/su: Permission denied
A saída em execução de /var/log/audit/audit.log retorna isso:
[root@kerberos tmp]# cat /tmp/audit
type=AVC msg=audit(1319322088.937:68012): avc: denied { execute } for pid=9794 comm="bash" name="su" dev=dm-0 ino=1048659 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:su_exec_t:s0 tclass=file
type=SYSCALL msg=audit(1319322088.937:68012): arch=c000003e syscall=59 success=no exit=-13 a0=26a7df0 a1=26c9b30 a2=269efa0 a3=18 items=0 ppid=8435 pid=9794 auid=500 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 tty=pts0 ses=4454 comm="bash" exe="/bin/bash" subj=user_u:user_r:user_t:s0 key=(null)
type=AVC msg=audit(1319322088.944:68013): avc: denied { getattr } for pid=9794 comm="bash" path="/bin/su" dev=dm-0 ino=1048659 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:su_exec_t:s0 tclass=file
type=SYSCALL msg=audit(1319322088.944:68013): arch=c000003e syscall=4 success=no exit=-13 a0=26a7df0 a1=7fff26b200d0 a2=7fff26b200d0 a3=18 items=0 ppid=8435 pid=9794 auid=500 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 tty=pts0 ses=4454 comm="bash" exe="/bin/bash" subj=user_u:user_r:user_t:s0 key=(null)
type=AVC msg=audit(1319322088.944:68014): avc: denied { getattr } for pid=9794 comm="bash" path="/bin/su" dev=dm-0 ino=1048659 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:su_exec_t:s0 tclass=file
type=SYSCALL msg=audit(1319322088.944:68014): arch=c000003e syscall=4 success=no exit=-13 a0=26a7df0 a1=7fff26b200b0 a2=7fff26b200b0 a3=18 items=0 ppid=8435 pid=9794 auid=500 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 tty=pts0 ses=4454 comm="bash" exe="/bin/bash" subj=user_u:user_r:user_t:s0 key=(null)
O que leva a essa solução do audit2allow:
[root @ kerberos tmp] # cat / tmp / audit | audit2allow
#============= user_t ==============
#!!!! This avc is allowed in the current policy
allow user_t su_exec_t:file { execute getattr };
[root@kerberos tmp]#
Ou esta saída:
type=AVC msg=audit(1319334064.195:39047): avc: denied { read open } for pid=6067 comm="bash" name="su" dev=dm-0 ino=1048587 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:su_exec_t:s0 tclass=file
type=SYSCALL msg=audit(1319334064.195:39047): arch=c000003e syscall=59 success=no exit=-13 a0=eecbd0 a1=eecbf0 a2=ec7720 a3=18 items=0 ppid=2857 pid=6067 auid=500 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 tty=pts8 ses=2 comm="bash" exe="/bin/bash" subj=user_u:user_r:user_t:s0 key=(null)
type=AVC msg=audit(1319334064.200:39048): avc: denied { read } for pid=6067 comm="bash" name="su" dev=dm-0 ino=1048587 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:su_exec_t:s0 tclass=file
type=SYSCALL msg=audit(1319334064.200:39048): arch=c000003e syscall=21 success=no exit=-13 a0=eecbd0 a1=4 a2=0 a3=18 items=0 ppid=2857 pid=6067 auid=500 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 tty=pts8 ses=2 comm="bash" exe="/bin/bash" subj=user_u:user_r:user_t:s0 key=(null)
type=AVC msg=audit(1319334064.200:39049): avc: denied { read } for pid=6067 comm="bash" name="su" dev=dm-0 ino=1048587 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:su_exec_t:s0 tclass=file
type=SYSCALL msg=audit(1319334064.200:39049): arch=c000003e syscall=2 success=no exit=-13 a0=eecbd0 a1=0 a2=43 a3=18 items=0 ppid=2857 pid=6067 auid=500 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 tty=pts8 ses=2 comm="bash" exe="/bin/bash" subj=user_u:user_r:user_t:s0 key=(null)
type=AVC msg=audit(1319334064.208:39050): avc: denied { rlimitinh } for pid=6069 comm="setroubleshootd" scontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 tclass=process
type=AVC msg=audit(1319334064.208:39050): avc: denied { siginh } for pid=6069 comm="setroubleshootd" scontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 tclass=process
type=AVC msg=audit(1319334064.208:39050): avc: denied { noatsecure } for pid=6069 comm="setroubleshootd" scontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 tclass=process
type=SYSCALL msg=audit(1319334064.208:39050): arch=c000003e syscall=59 success=yes exit=0 a0=944aa0 a1=9447e0 a2=943010 a3=1 items=0 ppid=6068 pid=6069 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="setroubleshootd" exe="/usr/bin/python" subj=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1319334064.369:39051): avc: denied { write } for pid=6069 comm="setroubleshootd" name="rpm" dev=dm-0 ino=655363 scontext=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:rpm_var_lib_t:s0 tclass=dir
type=SYSCALL msg=audit(1319334064.369:39051): arch=c000003e syscall=21 success=no exit=-13 a0=1405430 a1=2 a2=0 a3=9 items=0 ppid=6068 pid=6069 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="setroubleshootd" exe="/usr/bin/python" subj=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1319334064.370:39052): avc: denied { write } for pid=6069 comm="setroubleshootd" name="rpm" dev=dm-0 ino=655363 scontext=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:rpm_var_lib_t:s0 tclass=dir
type=SYSCALL msg=audit(1319334064.370:39052): arch=c000003e syscall=21 success=no exit=-13 a0=1405430 a1=2 a2=0 a3=5 items=0 ppid=6068 pid=6069 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="setroubleshootd" exe="/usr/bin/python" subj=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 key=(null)
Em que, audit2allow sugere o seguinte:
#============= setroubleshootd_t ==============
#!!!! The source type 'setroubleshootd_t' can write to a 'dir' of the following types:
# var_log_t, setroubleshoot_var_lib_t, setroubleshoot_var_run_t, setroubleshoot_var_log_t, var_lib_t, var_run_t, root_t
allow setroubleshootd_t rpm_var_lib_t:dir write;
#============= system_dbusd_t ==============
allow system_dbusd_t setroubleshootd_t:process { siginh rlimitinh noatsecure };
#============= user_t ==============
allow user_t su_exec_t:file { read open };
Curiosamente, ele alterna entre as duas mensagens sempre que eu tentei carregar uma nova política, como segue:
[root@kerberos tmp]# cat /tmp/audit2 | audit2allow -M local
******************** IMPORTANT ***********************
To make this policy package active, execute:
semodule -i local.pp
A tentativa de usar a opção de atualização retorna o seguinte:
[root@kerberos tmp]# semodule -u local.pp
libsemanage.get_direct_upgrade_filename: Previous module local is same or newer. (No such file or directory).
semodule: Failed on local.pp!
Destaca-se o seguinte:
-
O sistema originalmente não tinha o selinux ativado. O problema começou depois que eu ativei o selinux:
-
originalmente, foi um problema usar "sudo su -", que durante a solução de problemas levou a esse problema.
-
Novos hosts que eu criei depois disso tiveram o selinux habilitado por padrão - e eles não tiveram esse problema, o que significa que algo não foi ativado corretamente quando eu reverti o SELinux para "impingir" para o servidor original.
Aqui estão as permissões e facl para o comando su:
[root@kerberos tmp]# getfacl /bin/su
getfacl: Removing leading '/' from absolute path names
# file: bin/su
# owner: root
# group: root
# flags: s--
user::rwx
group::r-x
other::r-x
[root@kerberos tmp]# ls -laZ /bin/su
-rwsr-xr-x. root root system_u:object_r:su_exec_t:s0 /bin/su
[root@kerberos tmp]#
-
Curiosamente, em algum momento, eu tive que executar su com o caminho exato, mesmo que esteja no meu caminho. Também curiosamente, se eu logar como root, então su como usuário regular, eu posso então usar o comando su:
[root@kerberos tmp]# su - rilindo
[rilindo@kerberos ~]$ su -
Password:
[root@kerberos ~]#
Alguma direção é apreciada.