Como posso bloquear o su acesso a alguns usuários apenas no linux

3

Eu quero configurar o pam de uma forma que meus usuários possam su para apenas alguns usuários.

No RHEL4, usei

/etc/pam.d/su

auth       required     /lib/security/$ISA/pam_stack.so service=system-auth 
auth       sufficient   /lib/security/$ISA/pam_stack.so service=suroot-members 
auth       required     /lib/security/$ISA/pam_deny.so

/etc/pam.d/suroot-members

auth       required     /lib/security/$ISA/pam_wheel.so use_uid group=suroot
auth       required     /lib/security/$ISA/pam_listfile.so item=user sense=allow onerr=fail file=/etc/security/sumembers-access

Com a configuração acima, os usuários no surto de grupo só podem su para o nome de usuário mencionado no acesso aos sumários. Mas com OEL6 pam_stack.so é obsoleto. Eu tentei configurar como abaixo, mas não está funcionando como esperado.

/etc/pam.d/su

auth      sufficient  pam_rootok.so
auth      include     system-auth
auth      include     group2-members
auth      include     group1-members
auth      required    pam_deny.so
account   sufficient  pam_succeed_if.so uid = 0 use_uid quiet
account   include     system-auth
password  include     system-auth
session   include     system-auth
session   optional    pam_xauth.so

/etc/pam.d/group2-members

auth required pam_wheel.so use_uid group=group2
auth required pam_listfile.so item=user sense=allow onerr=fail file=/etc/security/su-group2-access

Acima não está funcionando. Todos os usuários podem responder a todos. Alguém pode dizer o que estou fazendo errado?

    
por user1116993 07.01.2012 / 12:33

1 resposta

0

Espero que isso ajude.

# cat /etc/pam.d/su
auth            sufficient      pam_rootok.so
auth            [default=1 success=ok ignore=ignore] pam_wheel.so trust use_uid group=group1
auth            [success=2 default=die] pam_listfile.so item=user sense=allow onerr=fail file=/etc/security/su-group1-access
auth            [default=die success=ok ignore=ignore] pam_wheel.so trust use_uid group=group2
auth            requisite pam_listfile.so item=user sense=allow onerr=fail file=/etc/security/su-group2-access
auth            include system-auth
account              sufficient        pam_succeed_if.so uid = 0 use_uid quiet
account              include                system-auth
password             include                system-auth
session              include                system-auth
session              optional        pam_xauth.so

# cat /etc/security/su-group1-access |egrep -v "^#|^$"
oracle
user

# cat /etc/security/su-group2-access |egrep -v "^#|^$"
root

Resposta original: use abaixo

# cat /etc/pam.d/su |egrep -v "^#|^$"
auth        sufficient  pam_rootok.so
auth        [success=2 default=ignore] pam_succeed_if.so use_uid user notingroup group1
auth        required pam_wheel.so use_uid group=group1
auth        required pam_listfile.so item=user sense=allow onerr=fail file=/etc/security/su-group1-access
auth        [success=2 default=ignore] pam_succeed_if.so use_uid user notingroup group2
auth        required pam_wheel.so use_uid group=group2
auth        required pam_listfile.so item=user sense=allow onerr=fail file=/etc/security/su-group2-access
auth        include     system-auth
account     sufficient  pam_succeed_if.so uid = 0 use_uid quiet
account     include     system-auth
password    include     system-auth
session     include     system-auth
session     optional    pam_xauth.so

# cat /etc/security/su-group1-access |egrep -v "^#|^$"
oracle
user

# cat /etc/security/su-group2-access |egrep -v "^#|^$"
root
    
por 07.03.2012 / 20:14

Tags