Суббота, 18.05.2024, 20:09
Приветствую Вас Гость | RSS
Главная | Каталог статей | Регистрация | Вход
Меню сайта
Категории раздела
Разное [2]
Linux [17]
Windows [4]
Поиск
Облако тегов
Rdesktop RDP Active Directory Free Freeware mail server mail client Manitou-mail linux cluster GlusterFS ubuntu Сеть file system crypt LUKS шифрование Samba CIFS anonymous Windows e-mail hMailServer Mercury/32 mail Postfix PostfixAdmin CIM Pegasus WBEM WMI acl Owner subinacl PostgreSQL DBMail VirtualBox DRBD OCFS2 zimbra Zarafa email GroupOffice WebMail
Block title
[21.04.2010][Linux]
Создание файлового сервера на Samba с аутентификацией через Active Directory (0)
[28.03.2013][Linux]
Русский в консоли Ubuntu (0)
[09.11.2011][Linux]
Кластер Active/Active на DRBD и OCFS2 (0)
[25.05.2011][Linux]
VirtualBox и управление памятью хоста (0)
[08.12.2010][Linux]
Установка и настройка DBMail + PostgreSQL (1)
Статистика

Онлайн всего: 1
Гостей: 1
Пользователей: 0
Форма входа
Block title
Продажа компьютеров и ноутбуков, прайс лист на комплектующие. периферия, мониторы, расходные материалы
Записки админа
Главная » Статьи » Linux

Допиливаем самбу

Использование модулей vfs

     Возможности Samba можно значительно расширить с помощью подключаемых модулей. Список установленный модулей можно посмотреть в каталоге /usr/lib/samba/vfs

Поддержка Windows ACL

     Ранее, использование самбы в роли файлового сервера сильно ограничивалось возможностями преобразования прав доступа к файлам Windows в POSIX-права, используемые в Linux. Из-за их слишком больших различий, настройка и управление ими превращалось в мучение с элементами рулетки. Однако, начиная с версии 3.3.0 появился модуль acl_xattr, позволяющий самбе корректно обрабатывать Windows ACL (Access Control List).

     Итак, для полноценной поддержки прав доступа к файлам, воспользуемся модулем acl_xattr. Для этого необходимо к параметрам зашаренного ресурса добавить:

  vfs objects = acl_xattr
     acl map full control = true
     inherit acls = yes
     map acl inherit = yes
     nt acl support = yes
     acl group control = true


Интересные параметры:

svcctl list

     В этом параметре задается список сценариев init, которые Самба будет использовать для запуска и остановки сервисов Unix через Win32 ServiceControl API. Это позволяет администраторам Windows использовать MMC для управления службами сервера через Самбу. Администратор должен создать каталог svcctl в каталоге, указанном в переменной $(libdir) - в Ubuntu по умолчанию - /var/lib/samba и создать символические ссылки на соответствующие скрипты в /etc/init.d/ . Имена ссылок должны совпадать с именами из списка svcctl list.

Пример :

svcctl list = cups postfix portmap httpd
/var/lib/samba/svcctl/cups -> /etc/init.d/cups
/var/lib/samba/svcctl/cups -> /etc/init.d/postfix

...и т.д.


eventlog list

     Интересный параметр, позволяющий подключить логи системы к самба-серверу таким образом, чтобы их можно было просматривать с Windows-машины через стандартную оснастку mmc (Event Viewer, eventvwr.exe). Для этого необходимо в добавить в файл samba.conf параметр eventlog list со списком логов:

  eventlog list = Application, System, Security, SyslogLinux, Webserver

     Сама самба логи никак не обрабатывает, а список по сути является перечислением названий баз, которые создаются командой eventlogadm и лежат в каталоге /var/lib/samba/eventlog/. На входе (stdin) эта программа ожидает специально отформатированные данные, которые затем сохраняет в соответствующей бд. 

     Формат данных для eventlogadm (взято с https://wiki.samba.org/index.php/Event_Logging):

LEN: 0
RS1: 1699505740
RCN: 0
TMG: 1128631322
TMW: 1128631322
EID: 1000 
ETP: INFO
ECT: 0 
RS2: 0
CRN: 0
USL: 0
SRC: cron
SRN: dmlinux
STR: (root) CMD ( rm -f /var/spool/cron/lastrun/cron.hourly)
DAT: 

  • LEN: <integer> The length field is calculated by the eventlogadm program based on the rest of the information in the record. Zero works well here.
  • RS1: 1699505740 A "magic number", the primary purpose of which seems to be to be able to find eventlog records in a sea of binary data
  • TMG: <integer> The time the eventlog record was generated; format is the number of seconds since 00:00:00 January 1, 1970, UTC
  • TMW: <integer> The time the eventlog record was written; format is the number of seconds since 00:00:00 January 1, 1970, UTC
  • EID: <integer> The eventlog ID -- used as a index to a message string in a message DLSamba and Eventlogs
  • ETP: <string> The event type -- one of INFO, ERROR, WARNING, AUDIT SUCCESS, AUDIT FAILURE
  • ECT: <integer> The event category; this depends on the message file -- primarily used as a means of filtering in the eventlog viewer
  • RS2: 0 Another reserved field
  • CRN: 0 Yet another reserved field
  • USL: <integer> Typically would contain the length of the SID of the user object associated with this event. This is not supported now, so leave this zero.
  • SRC: <string> The source name associated with the event log, e.g. "cron" or "smbd". If a message file is used with an event log, there will be a registry entry for associating this source name with a message file DLL
  • SRN: <string> The name of the machine on which the eventlog was generated. This is typically the host name
  • STR: <string> The text associated with the eventlog. Note that there may be more than one strings in a record
  • DAT: <string> Eventlog records can have binary information associated with them. DAT only supports ASCII strings however


Для преобразования текстовых логов в формат, понятный команде eventlogadm используют скрипты. Вот пример стандартного скрипта parselog.pl, идущего с исходными кодами 3-ей самбы (ftp://svnanon.samba.org/pub/unpacked/samba_3_waf/examples/scripts/eventlog/parselog.pl):

===
#!/usr/bin/perl
######################################################################
##
## Simple parselog script for Samba
##
## Copyright (C) Brian Moran 2005.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, see <http://www.gnu.org/licenses/>.
##
######################################################################

## usage: tail -f /var/log/syslog | parselog.pl | eventlogadm -o write "Application"

while(<>) {
 chomp();
 @le = split '\s+',$_,5;
 $ln = $le[4];
 $cname = $le[3]; 
 $outstr = sprintf "TMG: %d\nTMW: %d\nEID: 1000\nETP: INFO\nECT: 0\nRS2: 0\nCRN: 0\nUSL: 0\nSRC: Syslog\nSRN: $cname\nSTR: $ln\nDAT:\n\n",time(),time();
 print $outstr;
}
===

Запускается так:

tail -f /var/log/syslog | parselog.pl | eventlogadm -o write "Application"

Больше пока, увы, информации по этому вопросу не накопал :(

getpeername failed. Error was Transport endpoint is not connected

Часто в логах самбы можно увидеть большое количество сообщений обошибке примерно такого вида:
Jul 9 17:55:47 smbd[1971]: [2010/07/09 17:55:47,  0] lib/util_sock.c:1491 (get_peer_addr_internal)
Jul 9 17:55:47 smbd[1971]: getpeername failed. Error was Transport endpoint is not connected

Чаще всего это сообщение вызывают клиенты Windows XP, обращающиеся к ресурсам самбы. Это происходит из-за специфики реализации протокола в данной версии ОС. Если в старых системах (например, в Windows 98) обращение шло только на 139-й порт, то XP обращается одновременно на два порта - 139 и 445. И если она получает ответ, то соединение по 445-му порту принудительно разрывает, что и приводит к данной ошибке. Соответственно, решение данной проблемы состоит в принудительном указании самбе работать только по 139-му порту:

    smb ports = 139

После этого, по крайней мере у меня, эти сообщения из логов исчезли.

Категория: Linux | Добавил: Admin (21.04.2010)
Просмотров: 6227 | Теги: acl, Samba | Рейтинг: 0.0/0
Всего комментариев: 0
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]
Сделать бесплатный сайт с uCozCopyright MyCorp © 2024