Neste post será apresentado como configurar o Apache para se autenticar via Kerberos, nos nossos testes estaremos usando a ferramenta freeIPA (Redhat IdM) , caso tenha dúvidas sobre a ferramenta clique no link abaixo para saber mais :
http://fajlinux.com.br/linux/freeipa-configuracao-do-servidor/
1) Requisitos :
Instale o módulo Kerberos do Apache :
yum -y install mod_auth_kerb
2) Configurações iniciais :
Adicione o serviço no freeIPA :
Gere o keytab :
cd /etc/httpd/conf.d/ ipa-getkeytab -s freeipa.example.com -p HTTP/client-04.example.com -k keytab
Dê permissão ao Apache
chown apache.apache /etc/httpd/conf.d/keytab
Configuração do Apache :
Em nosso teste o diretório com autenticação será o /var/www/html/ipa
Gere um arquivo de configuração chamado auth_ipa.conf :
vi /etc/httpd/conf.d/auth_ipa.conf
<Directory /var/www/html/ipa> AuthName "IPA Authentication" AuthType Kerberos KrbServiceName HTTP KrbMethodK5Passwd On KrbSaveCredentials On KrbMethodNegotiate On KrbAuthRealms EXAMPLE.COM Krb5KeyTab /etc/httpd/conf.d/keytab Require valid-user </Directory>
3) Testes finais :
Crie um arquivo chamado index.html em /var/www/html/ipa :
vim /var/www/html/ipa/index.html
<html> <body> <div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"> freeIPA Redhat IdM Teste </div> </body> </html>
Chame a url http://client-04.example.com/ipa/ :
Após autenticar com algum usuário com permissão :