Compartilhamento do Samba autenticando no AD
Este artigo é destinado àqueles que ainda utilizam o Windows 2003 como PDC e querem utilizar o Samba como servidor de arquivos, porém querem utilizar os usuários que já estão cadastrados no AD, dessa forma quando o usuário logar, terá acesso aos compartilhamentos que você o habilitou para ele sem a necessidade de digitar a senha novamente.
Introdução
Utilizei para este artigo o Debian 5.0 Lenny (Samba 3.2.5), Windows 2003 como PDC e WinXP e Win7 como clientes.
Comece instalando os seguintes pacotes:
# aptitude install krb5-user samba samba-common winbind ntpdate
Abaixo seguem explicações das linhas que você deverá substituir nos arquivos de configuração, conforme sua necessidade:
# vim /etc/hosts
Agora configure o resolv.conf do seu Debian:
# vim /etc/resolv.conf
Renomeei o arquivo original e depois criei um novo.
# mv /etc/krb5.conf /etc/krb5.conf.orig
# > /etc/krb5.conf
# vim /etc/krb5.conf
Agora faça o teste do Kerberos, onde "administrador" é o nome de um usuário qualquer que você tem no seu AD, é importante utilizar seu domínio completo e em MAIÚSCULO.
Para estar tudo funcionando não deverá aparecer nenhum erro nessa etapa e sim ir para linha de baixo apenas.
# kinit administrador@INTRAGOV.COM
Comece instalando os seguintes pacotes:
# aptitude install krb5-user samba samba-common winbind ntpdate
Abaixo seguem explicações das linhas que você deverá substituir nos arquivos de configuração, conforme sua necessidade:
- intranet é o nome do meu servidor (Windows 2003)
- intragov.com é o nome do meu domínio completo
- arquivos é o nome da máquina Linux
- 192.168.1.3 é o IP do meu controlador de domínio (Windows 2003)
Configurando os arquivos do Debian
Entre em /etc/hosts e edite o arquivo substituindo os nomes e IPs de acordo com suas necessidades:# vim /etc/hosts
192.168.1.3 intranet.intragov.com intranet
127.0.0.1 arquivos.intragov.com intranet
127.0.0.2 arquivos.intragov.com intranet
127.0.0.1 arquivos.intragov.com intranet
127.0.0.2 arquivos.intragov.com intranet
Agora configure o resolv.conf do seu Debian:
# vim /etc/resolv.conf
domain intragov.com
search intragov.com
nameserver 192.168.1.3
search intragov.com
nameserver 192.168.1.3
Configuração do Kerberos
Alterar o que estiver em negrito de acordo com o seu domínio, é fundamental respeitar o que estiver em MAIÚSCULO e em minúsculo.Renomeei o arquivo original e depois criei um novo.
# mv /etc/krb5.conf /etc/krb5.conf.orig
# > /etc/krb5.conf
# vim /etc/krb5.conf
[libdefaults]
default_realm = INTRAGOV.COM
dns_lookup_realm= true
dns_lookup_kdc= true
ticket_lifetime= 24h
forwardable= yes
# The following krb5.conf variables are only for MIT Kerberos.
krb4_config = /etc/krb.conf
krb4_realms = /etc/krb.realms
kdc_timesync = 1
ccache_type = 4
forwardable = true
proxiable = true
# The following encryption type specification will be used by MIT Kerberos
# if uncommented. In general, the defaults in the MIT Kerberos code are
# correct and overriding these specifications only serves to disable new
# encryption types as they are added, creating interoperability problems.
#
# Thie only time when you might need to uncomment these lines and change
# the enctypes is if you have local software that will break on ticket
# caches containing ticket encryption types it doesn't know about (such as
# old versions of Sun Java).
# default_tgs_enctypes = des3-hmac-sha1
# default_tkt_enctypes = des3-hmac-sha1
# permitted_enctypes = des3-hmac-sha1
# The following libdefaults parameters are only for Heimdal Kerberos.
v4_instance_resolve = false
v4_name_convert = {
host = {
rcmd = host
ftp = ftp
}
plain = {
something = something-else
}
}
fcc-mit-ticketflags = true
[realms]
INTRAGOV.COM= {
kdc= intranet.intragov.com
admin_server= intranet.intragov.com
default_domain= INTRAGOV.COM
}
[domain_realm]
.intragov.com= INTRAGOV.COM
intragov.com= INTRAGOV.COM
[login]
krb4_convert = true
krb4_get_tickets = false
default_realm = INTRAGOV.COM
dns_lookup_realm= true
dns_lookup_kdc= true
ticket_lifetime= 24h
forwardable= yes
# The following krb5.conf variables are only for MIT Kerberos.
krb4_config = /etc/krb.conf
krb4_realms = /etc/krb.realms
kdc_timesync = 1
ccache_type = 4
forwardable = true
proxiable = true
# The following encryption type specification will be used by MIT Kerberos
# if uncommented. In general, the defaults in the MIT Kerberos code are
# correct and overriding these specifications only serves to disable new
# encryption types as they are added, creating interoperability problems.
#
# Thie only time when you might need to uncomment these lines and change
# the enctypes is if you have local software that will break on ticket
# caches containing ticket encryption types it doesn't know about (such as
# old versions of Sun Java).
# default_tgs_enctypes = des3-hmac-sha1
# default_tkt_enctypes = des3-hmac-sha1
# permitted_enctypes = des3-hmac-sha1
# The following libdefaults parameters are only for Heimdal Kerberos.
v4_instance_resolve = false
v4_name_convert = {
host = {
rcmd = host
ftp = ftp
}
plain = {
something = something-else
}
}
fcc-mit-ticketflags = true
[realms]
INTRAGOV.COM= {
kdc= intranet.intragov.com
admin_server= intranet.intragov.com
default_domain= INTRAGOV.COM
}
[domain_realm]
.intragov.com= INTRAGOV.COM
intragov.com= INTRAGOV.COM
[login]
krb4_convert = true
krb4_get_tickets = false
Agora faça o teste do Kerberos, onde "administrador" é o nome de um usuário qualquer que você tem no seu AD, é importante utilizar seu domínio completo e em MAIÚSCULO.
Para estar tudo funcionando não deverá aparecer nenhum erro nessa etapa e sim ir para linha de baixo apenas.
# kinit administrador@INTRAGOV.COM
Valeu por compartilhar !
Abraço.