**''Документация по модулю Sharing и принадлежащим к нему страницам перенесена в Confluence''** [[http://abills.net.ua:8090/display/AB/Sharing]] =====Sharing===== Предоставление авторизированного доступа к ресурсам. Учёт использования ресурсов. ====Возможности==== * Контроль аворизированного доступа к дата-ресурсам * Учет использования * [[abills:docs:manual:admin:Sharing:sharing_add_file|Предоставление доступа к файлам]] * [[abills:docs:manual:admin:sharing:sharing_download_log|Лог скачиваний]] ====Настройка Abills==== Создать таблицы в базе. # mysql -D abills < db/Sharing.sql **abills/libexec/config.pl** @MODULES = ( 'Sharing' ); **config.pl** ^$conf{SHARING_APACHE_ERROR_LOG}='/var/log/httpd/error_log';| лог ошибок | ^$conf{SHARING_USER_CHG_TP}=1; | Разрешить пользователю менять тарифный план из пользовательского веб акаунта | ====Apache==== Сборка с исходных кодов. [[http://httpd.apache.org/|Apache]] Apache version 2.0.xx\\ # tar zxvf httpd-2.0.59.tar.gz # cd httpd-2.0.59 # ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all # make # make install [[http://modauthmysql.sourceforge.net/|mod_auth_mysql]] модуль авторизации\\ # tar zxvf mod_auth_mysql-3.0.0.tar.gz # cd mod_auth_mysql # /usr/local/apache2/bin/apxs -iac -lmysqlclient mod_auth_mysql.c [[http://bitbrook.de/software/mod_log_mysql/|mod_log_mysql]] модуль учёта потребляемых ресурсов\\ # tar yxvf mod_log_sources.tar.bz2 # cd mod_log_mysql # /usr/local/apache2/bin/apxs -aic mod_logio.c # /usr/local/apache2/bin/apxs -aic mod_log_config.c # /usr/local/apache2/bin/apxs -aic -lmysqlclient mod_log_mysql.c **/usr/local/apache2/conf/httpd.conf**\\ Закоментировать подгрузку родного Apache модуля #LoadModule log_config_module modules/mod_log_config.so Включить свой конфиг Include conf/abills_sharing.conf **/usr/local/apache2/conf/abills_sharing.conf**\\ #Mysql auth module AuthName "ABillS Sharing" AuthType Basic require valid-user AuthMySQLEnable On AuthMySQLHost %dbhost% #AuthMySQLPort %dbport% #AuthMySQLSocket %dbsocket% AuthMySQLUser %dbuser% AuthMySQLPassword %dbpasswd% AuthMySQLDB %dbname% AuthMySQLUserTable "(users u, sharing_main sharing)" AuthMySQLUserCondition "u.uid=sharing.uid \ AND (u.disable=0 AND sharing.disable=0) \ AND (sharing.cid='' OR sharing.cid='%a')" AuthMySQLNameField id AuthMySQLPasswordField "DECODE(password, 'test12345678901234567890')" #AuthMySQLUserCondition AuthMySQLNoPasswd Off AuthMySQLPwEncryption none #AuthMySQLSaltField <> #AuthMySQLGroupTable #AuthMySQLGroupCondition #AuthMySQLGroupField #AuthMySQLKeepAlive Off AuthMySQLAuthoritative On #AuthMySQLCharacterSet #Mysql Log module LogFormat "INSERT INTO sharing_log SET virtualhost=%v,\ remoteip=INET_ATON(%a),\ serverid=%{SERVERID}e,connectionstatus=%X,\ username=%u,identuser=%l,start=%t,requestmethod=%m,\ url=%U,protocol=%H,statusbeforeredir=%s,statusafterredir=%>s,\ processid=%{pid}P,threadid=%{tid}P, duration=%T,microseconds=%D,\ recv=%I,sent=%O,bytescontent=%B,useragent=%{User-Agent}i,\ referer=%{Referer}i,uniqueid=%{UNIQUE_ID}e" sharing_log CustomLog mysql:%dbuser%!%dbpasswd%@%dbhost%/%dbname% sharing_log LogMySQLFallback /var/log/httpd/failed_mysql_log #Show active connetiosn SetHandler server-status Order deny,allow Deny from all Allow from 127.0.0.1 # mkdir /var/log/httpd/failed_mysql_log # chown www /var/log/httpd/failed_mysql_log ====Samba==== [[http://samba.org|Samba]] ====FTP==== {{http://abills.asmodeus.com.ua/img/proftpd.png}} [[http://www.proftpd.org|ProFtpd]] **Пример конфигурации в OC FreeBSD:** # cd /usr/ports/databases/proftpd-mod_sql_mysql && make && make install **/usr/local/etc/proftpd.conf** ServerName "ProFTPD ABillS Installation" ServerType standalone DefaultServer on ScoreboardFile /var/run/proftpd.scoreboard Port 21 Umask 022 MaxInstances 30 CommandBufferSize 512 # Set the user and group under which the server will run. User nobody Group nogroup # To cause every FTP user to be "jailed" (chrooted) into their home # directory, uncomment this line. DefaultRoot ~ # Normally, we want files to be overwriteable. AllowOverwrite on DenyAll #Auth section #Default SQL users parameters SQLDefaultHomedir %DEFAULT_HOMEDIR% RequireValidShell off SQLLogFile /var/log/proftpd.log SQLAuthenticate users SQLConnectInfo %dbname%@%dbhost%:3306 %dbuser% %dbpasswd% SQLAuthTypes PlainText SQLUserInfo "(users u, sharing_main sharing)"\ u.id \ "DECODE(u.password, '%secretkey%')" \ u.uid u.gid '' '' SQLUserWhereClause " u.uid=sharing.uid \ AND (u.disable=0 AND sharing.disable=0) \ AND (sharing.cid='' OR sharing.cid='%a')"" # SQLGroupInfo groups groupname gid members # SQLAuthenticate users groups #Banner for user SQLNamedQuery User_Info SELECT "id FROM users u WHERE u.id='%u'" SQLShowInfo PASS "230" "Hello %{User_Info}." #Start Connection #Log transfert information SQLLog RETR,STOR log_story_transfer SQLNamedQuery log_story_transfer INSERT "'%V', '%u', '%F', 'FTP', '%b',\ '%b', '%m', INET_ATON('%a'), now(), '%T',\ '%s', '%S'"\ "sharing_log (virtualhost, username, url, protocol,\ bytescontent, sent, requestmethod, remoteip, start, duration,\ connectionstatus, statusafterredir)" ===Antivirus - Clamav=== ''(Если Вам не неадо антивирус єтот пункт можно пропустить)'' [[http://www.clamav.net/|Clamav]]\\ **Пример конфигурации в OC FreeBSD:**\\ Устанавливаем clamav и запускаем. # cd /usr/ports/ftp/proftpd # make fetch # make extract Cкачиваем [[http://www.uglyboxindustries.com/mod_clamav.html|mod_clamav]] в директорию # cd work/proftpd-1.3.1rc2/contrib # fetch http://www.uglyboxindustries.com/mod_clamav_new.c # mv mod_clamav_new.c mod_clamav.c Вносим в Makefile proftpd небольшие корректировки касательно нового модуля: **/usr/ports/ftp/proftpd/Makefile** CONFIGURE_ARGS= --localstatedir=/var/run \ --sysconfdir=${EXAMPLESDIR}/etc \ --enable-builtin-getnameinfo \ --disable-sendfile \ --with-modules=mod_clamav .if !defined(WITHOUT_RATIO) MODULES:=${MODULES}:mod_ratio .endif MODULES:=${MODULES}:mod_clamav .if !defined(WITHOUT_README) MODULES:=${MODULES}:mod_readme .endif Собираем proftpd # make config && make && make install Правим **proftpd.conf** согласно http://www.uglyboxindustries.com/mod_clamav_new.html # Enable virus scanning and removal ClamAV on # Specify the UNIX Local Socket ClamLocalSocket /var/run/clamav/clamd ClamWarn on Перезагружаем: # /usr/local/etc/rc.d/proftpd.sh reload