разъясните аномалию pure-ftpd+mysql

Discussion in 'Безопасность и Анонимность' started by $n@ke, 1 Feb 2010.

  1. $n@ke

    $n@ke Elder - Старейшина

    Joined:
    18 Sep 2006
    Messages:
    697
    Likes Received:
    404
    Reputations:
    134
    1. Unix сервер, на нем pure-ftpd+mysql. Смотрим крон
    crontab -l | grep -i ftp
    #10 * * * * /root/ftp.sh

    2. В Этом .sh файле
    PHP:
    /usr/local/sbin/pure-ftpd -l mysql:/usr/local/pureftpd-mysql.conf  -----T 1000 -c 150 -C 5  yes -p 50000:50200 --tls=1   &
    3. в файле usr/local/pureftpd-mysql.conf

    PHP:
    cat /usr/local/pureftpd-mysql.conf
    ##############################################
    #                                            #
    # Sample Pure-FTPd Mysql configuration file. #
    # See README.MySQL for explanations.         #
    #                                            #
    ##############################################


    # Optional : MySQL server name or IP. Don't define this for unix sockets.

     
    MYSQLServer     192.168.1.5


    # Optional : MySQL port. Don't define this if a local unix socket is used.

     
    MYSQLPort       3306


    # Optional : define the location of mysql.sock if the server runs on this host.

    #MYSQLSocket     /var/lib/mysql/mysql.sock


    # Mandatory : user to bind the server as.

    MYSQLUser      mysqlftp


    # Mandatory : user password. You must have a password.

    MYSQLPassword  ftp@mysql331


    # Mandatory : database to open.

    MYSQLDatabase   ftpbase


    # Mandatory : how passwords are stored
    # Valid values are : "cleartext", "crypt", "md5" and "password"
    # ("password" = MySQL password() function)
    # You can also use "any" to try "crypt", "md5" *and* "password"

    MYSQLCrypt      cleartext


    # In the following directives, parts of the strings are replaced at
    # run-time before performing queries :
    #
    # \L is replaced by the login of the user trying to authenticate.
    # \I is replaced by the IP address the user connected to.
    # \P is replaced by the port number the user connected to.
    # \R is replaced by the IP address the user connected from.
    # \D is replaced by the remote IP address, as a long decimal number.
    #
    # Very complex queries can be performed using these substitution strings,
    # especially for virtual hosting.


    # Query to execute in order to fetch the password

    MYSQLGetPW      SELECT Password FROM ftp_users WHERE User="\L" and status='live'


    # Query to execute in order to fetch the system user name or uid

    MYSQLGetUID     SELECT Uid FROM ftp_users WHERE User="\L"


    # Query to execute in order to fetch the system user group or gid

    MYSQLGetGID     SELECT Gid FROM ftp_users WHERE User="\L"


    # Query to execute in order to fetch the home directory

    MYSQLGetDir     SELECT Dir FROM ftp_users WHERE User="\L"


    # Optional : query to get the maximal number of files
    # Pure-FTPd must have been compiled with virtual quotas support.

    # MySQLGetQTAFS  SELECT Quota FROM ftp_users WHERE User="\L"


    # Optional : query to get the maximal disk usage (virtual quotas)
    # The number should be in Megabytes.
    # Pure-FTPd must have been compiled with virtual quotas support.

    MySQLGetQTASZ  SELECT Quota FROM ftp_users WHERE User="\L"


    # Optional : ratios. The server has to be compiled with ratio support.

    # MySQLGetRatioUL SELECT ULRatio FROM ftp_users WHERE User="\L"
    # MySQLGetRatioDL SELECT DLRatio FROM ftp_users WHERE User="\L"


    # Optional : bandwidth throttling.
    # The server has to be compiled with throttling support.
    # Values are in Kb/s .

    # MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="\L"
    # MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="\L"


    # If you upgraded your tables to transactionnal tables (Gemini,
    # BerkeleyDB, Innobase...), you can enable SQL transactions to
    # avoid races. Leave this commented if you are using the
    # traditionnal MyIsam databases or old (< 3.23.x) MySQL versions.

    # MySQLTransactions On

    4. Коннектимся к БД и видим что база изменялась сегодня, значит по идее - рабочая. Сливаем. размер 1мег. в ней вот такого подобия акки:

    PHP:
    INSERT INTO `ftp_users`(`User`, `DomainName`, `Password`, `Quota`, `Uid`, `Gid`, `Dir`, `status`, `ptext`, `ExpDate`, `IP`) VALUES ('wrHpmScoRC''google.com''Q1aFb5t7pPv''100''15383''150''/webdir/hostdir/google.com/./''live''RFQ1aFb5t7pPv''''');

    INSERT INTO `ftp_users`(`User`, `DomainName`, `Password`, `Quota`, `Uid`, `Gid`, `Dir`, `status`, `ptext`, `ExpDate`, `IP`) VALUES ('qndqndq6563QN6182''yahoo.com''deccyan01''100''14591''150''/webdir/hostdir/yahoo.com/./''live''pldeccyan01'''''); 
    привел две записи, чтоб было понятно: Есть зависимость ptext от Password.

    5. Получаем невалид фтп акки. Почему-то. Вопрос:
    Почему???


    Если рестартую руками фтпд через этот файл ftp.sh - то все акки подходят и все норм.
    вывод - ничо не ясно.толи ханипот, то ли еще что-то. Но зачем тогда бд обновлять ??
    pure-ftpwho показывает что есть юзеры на серваке, и логины совпадают с теми что в слитой БД.

    Буду рад дельному совету.
     
    #1 $n@ke, 1 Feb 2010
    Last edited: 1 Feb 2010