Итак, первым делом необходимо установить самбу. Но по умолчанию самба компилируется без поддержки ads, что меня немного напрягало. Недолгие поиски в инете дали патчик для Makefil'а. Он оказался какой-то кривоватый, хотя может мои кривые руки. Короче пришлось самому патчить. ))) После чего все заработало. Приступим:
# cd /usr/ports/net/samba
# ftp https://www.tiifp.org/quentin/samba_winbind.patch
Trying 212.112.249.34...
Requesting https://www.tiifp.org/quentin/samba_winbind.patch
100% |**************************************************| 220800:00
Successfully retrieved file.
# patch -p1 < samba_winbind.patch
Hmm... Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -r -u -N samba/Makefile samba_winbind/Makefile
|--- samba/Makefile Tue Oct 316:07:102006
|+++ samba_winbind/Makefile Tue Sep 2605:51:142006
--------------------------
Patching file Makefile using Plan A...
Hunk #1 succeeded at 63 with fuzz 1 (offset 2 lines).
Hunk #2 failed at 82.
Hunk #3 succeeded at 105 (offset -3 lines).
1 out of 3 hunks failed--saving rejects to Makefile.rej
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -r -u -N samba/files/krb5-config samba_winbind/files/krb5-config
|--- samba/files/krb5-config Thu Jan 101:00:001970
|+++ samba_winbind/files/krb5-config Tue Sep 2602:08:422006
--------------------------
(Creating file files/krb5-config...)
Patching file files/krb5-config using Plan A...
Empty context always matches.
Hunk #1 succeeded at 1.
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -r -u -N samba/files/krb5-config.orig samba_winbind/files/krb5-config.orig
|diff -r -u -N samba/pkg/PFRAG.winbind samba_winbind/pkg/PFRAG.winbind
|--- samba/pkg/PFRAG.winbind Thu Jan 101:00:001970
|+++ samba_winbind/pkg/PFRAG.winbind Tue Sep 2606:47:562006
--------------------------
(Creating file pkg/PFRAG.winbind...)
Patching file pkg/PFRAG.winbind using Plan A...
Empty context always matches.
Hunk #1 succeeded at 1.
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -r -u -N samba/pkg/PLIST samba_winbind/pkg/PLIST
|--- samba/pkg/PLIST Tue Oct 316:07:102006
|+++ samba_winbind/pkg/PLIST Tue Sep 2607:29:332006
--------------------------
File to patch: pkg/PLIST-main
Patching file pkg/PLIST-main using Plan A...
Hunk #1 succeeded at 105 (offset 1 line).
done
#
Тут я начал компиляцию и ничего не получил в результате(не было бинарников wbinfo и winbindd). После недолгих поисков я добавил в Makefile следующие строки:
После этого все почистил и запустил сборку пакета заново. Все собралось успешно. Теперь добавляем:
# pkg_add /usr/ports/packages/i386/all/samba-3.0.24-main-winbind.tgz
samba-3.0.24-main-winbind: complete
--- samba-3.0.24-main-winbind -------------------
To start the Samba server and naming service enter the following commands:
$ sudo /usr/local/libexec/smbd # Start the Samba server component
$ sudo /usr/local/libexec/nmbd # Start the Samba naming service
The configuration file, found at /etc/samba/smb.conf can be used right
away for simple configurations. Local users must be added to the Samba user
database using the smbpasswd utility in order to use the Samba server.
$ sudo smbpasswd -a
To have Samba start whenever the machine boots, add the following lines to the
/etc/rc.local script:
if [ -x /usr/local/libexec/smbd ]; then
/usr/local/libexec/smbd
fi
if [ -x /usr/local/libexec/nmbd ]; then
/usr/local/libexec/nmbd
fi
For more information and complete documentation, install the samba-docs package
and check the /usr/local/share/doc/samba directory.
#
Ну теперь проверяем, есть ли у нас в системе winbindd:
# ls -la /usr/local/libexec/winbindd
-rwxr-xr-x 1 root wheel 2038782 Nov 702:38 /usr/local/libexec/winbindd
#
Отлично - все на месте. Теперь идем рихтовать /etc/samba/smb.conf:
#
# /usr/local/etc/smb.conf
#
#======================= Global Settings =======================
[global]
# netbios имя домена
workgroup = TEACHERS
# Строка комментария
server string = Teachers Proxy Server
# Режим безопасности
security = ads
# Права доступа
hosts allow = 192.168. 127.
# расположение лог файла и его размер
log file = /var/log/samba/samba.log
max log size = 500
# Указываем, откуда пароли брать. )
password server = spider.teachers.
# Контроллер домена
realm = spider.teachers.
# Храним все в файлах
passdb backend = tdbsam
# Сетевые настройки
socket options = TCP_NODELAY
# Самба не является PDC
local master = no
domain master = no
preferred master = no
domain logons = no
os level = 0
# Русский язык
display charset = koi8-r
unix charset = koi8-r
dos charset = cp866
# Шифрованные пароли
encrypt passwords = yes
# Настройки winbind
winbind use default domain = yes
winbind uid = 1-65535
winbind gid = 1-65535
winbind enum users = yes
winbind enum groups = yes
Добавляем компутер в домен и запускаем winbindd:
# net rpc join -U admin
Password:
Joined domain TEACHERS.
# /usr/local/libexec/winbindd -d 3
#
Все работает, добавляем winbindd в автозагрузку, редактируя /etc/rc.local:
# Starting winbindd
if [ -x /usr/local/libexec/winbindd ]; then
echo -n ' winbindd'
/usr/local/libexec/winbindd -d 3
fi
Теперь устанавливаем squid... С ним возникли тоже некоторые трудности: он не поддерживал ntlm аутентификацию... Он честно писал, что не знает, что такое ntlm.. Пришлось идти в порты и править Makefile изменяя:
--enable-auth="basic digest"
на
--enable-auth="basic ntlm"
После этого все собралось и установилось на ура.
Рихтуем конфиг squid'а. Я туда ничего не добавлял, кроме параметров аутентификации и acl'ов:
auth_param ntlm program /usr/local/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp
auth_param ntlm children 5
auth_param basic program /usr/local/bin/ntlm_auth --helper-protocol=squid-2.5-basic
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
acl USERS proxy_auth REQUIRED
http_access allow USERS
Все, добавляем squid в автозагрузку и запускаем его:
# cat >> /etc/rc.local
# Starting squid
if [ -x /usr/local/sbin/squid ]; then
echo -n ' squid'
/usr/local/sbin/squid
fi
^D
# /usr/local/sbin/squid
Проверяем запустился ли он:
# tail /var/squid/logs/cache.log
2007/11/0720:12:47| Store logging disabled
2007/11/0720:12:47| Rebuilding storage in /var/squid/cache (DIRTY)
2007/11/0720:12:47| Using Least Load store dir selection
2007/11/0720:12:47| Set Current Directory to /var/squid/cache
2007/11/0720:12:47| Loaded Icons.
2007/11/0720:12:47| Accepting proxy HTTP connections at 0.0.0.0, port 3128, FD 44.
2007/11/0720:12:47| Accepting ICP messages at 0.0.0.0, port 3130, FD 46.
2007/11/0720:12:47| Accepting SNMP messages on port 3401, FD 47.
2007/11/0720:12:47| WCCP Disabled.
2007/11/0720:12:47| Ready to serve requests.
#
Вроде запустился... Пробуем пройти через него, при этом смотря в access.log. Увидели себя? Ну тогда отлично. )))