Compiling

在 AIX 上使用 MySQL 身份驗證支持編譯 proftpd

  • February 11, 2014

編輯1:

該問題似乎與 MySQL 組件有關。因為如果我從配置文件中刪除每個 SQL 指令,它確實可以工作ftp/ftpessftp並且ftps


編輯2:

如果我放置一個沒有託管數據庫的現有主機,與 ftp 守護程序的連接將掛起並最終超時,而如果我放置一個不正確的數據庫或無響應的主機,它將嘗試執行 unix auth 而不是 mysql auth。


編輯3:

sqllog 提到我們可以看到該行Feb 07 15:44:12 mod_sql/4.3[15139036]: entering mysql cmd_open之後是一個多分鐘後的新日誌行Feb 07 15:45:27

Feb 07 15:44:11 mod_sql/4.3[15139036]: defaulting to 'mysql' backend
Feb 07 15:44:11 mod_sql/4.3[15139036]: backend module 'mod_sql_mysql/4.0.8'
Feb 07 15:44:11 mod_sql/4.3[15139036]: backend api    'mod_sql_api_v1'
Feb 07 15:44:11 mod_sql/4.3[15139036]: >>> sql_sess_init
Feb 07 15:44:11 mod_sql/4.3[15139036]: entering         mysql cmd_defineconnection
Feb 07 15:44:11 mod_sql/4.3[15139036]:   name: 'default'
Feb 07 15:44:11 mod_sql/4.3[15139036]:   user: 'mysql_poney_user'
Feb 07 15:44:11 mod_sql/4.3[15139036]:   host: 'pingableHostWithoutDB.net'
Feb 07 15:44:11 mod_sql/4.3[15139036]:     db: 'mysql_poney_user'
Feb 07 15:44:11 mod_sql/4.3[15139036]:   port: '15140'
Feb 07 15:44:11 mod_sql/4.3[15139036]:    ttl: '2'
Feb 07 15:44:11 mod_sql/4.3[15139036]: exiting  mysql cmd_defineconnection
Feb 07 15:44:11 mod_sql/4.3[15139036]: connection 'default' successfully established
Feb 07 15:44:11 mod_sql/4.3[15139036]: mod_sql engine     : on
Feb 07 15:44:11 mod_sql/4.3[15139036]: negative_cache     : off
Feb 07 15:44:11 mod_sql/4.3[15139036]: authenticate       : users
Feb 07 15:44:11 mod_sql/4.3[15139036]: usertable          : proftpd_users
Feb 07 15:44:11 mod_sql/4.3[15139036]: userid field       : userid
Feb 07 15:44:11 mod_sql/4.3[15139036]: password field     : passwd
Feb 07 15:44:11 mod_sql/4.3[15139036]: UID field          : uid
Feb 07 15:44:11 mod_sql/4.3[15139036]: GID field          : gid
Feb 07 15:44:11 mod_sql/4.3[15139036]: homedir field      : homedir
Feb 07 15:44:11 mod_sql/4.3[15139036]: shell field        : shell
Feb 07 15:44:11 mod_sql/4.3[15139036]: SQLMinUserUID      : 200
Feb 07 15:44:11 mod_sql/4.3[15139036]: SQLMinUserGID      : 1
Feb 07 15:44:11 mod_sql/4.3[15139036]: <<< sql_sess_init
Feb 07 15:44:12 mod_sql/4.3[15139036]: >>> sql_escapestr
Feb 07 15:44:12 mod_sql/4.3[15139036]: entering         mysql cmd_escapestring
Feb 07 15:44:12 mod_sql/4.3[15139036]: entering         mysql cmd_open
Feb 07 15:45:27 mod_sql/4.3[15139036]: exiting  mysql cmd_open
Feb 07 15:45:27 mod_sql/4.3[15139036]: exiting  mysql cmd_escapestring
Feb 07 15:45:27 mod_sql/4.3[15139036]: unrecoverable backend error
Feb 07 15:45:27 mod_sql/4.3[15139036]: error: '2003'
Feb 07 15:45:27 mod_sql/4.3[15139036]: message: 'Can't connect to MySQL server on 'pingableHostWithoutDB.net' (78)'
Feb 07 15:45:27 mod_sql/4.3[15139036]: entering         mysql cmd_exit
Feb 07 15:45:27 mod_sql/4.3[15139036]: exiting  mysql cmd_exit

原始問題

我有一個 proftpd 配置文件,它在proftpd 1.3.4bproftpd 1.3.4d. 現在我想在一個新系統上編譯一個AIX 6.1.

我正在使用 IBM XLc 編譯器。

這是我安裝的庫:

rpm -qa
   apr-1.4.6-1
   mkisofs-1.13-4
   pci.df1000fa-1-191A5
   openldap-2.4.23-0.3
   apr-util-ldap-1.5.1-1
   openssl-1.0.1e-2
   bash-3.0-1
   coreutils-5.0-2
   grep-2.5.1-1
   pci.1069B166.0A-050A008a-1
   pci.1069B166.08-0508008a-1
   pci.1069B166.10-0510006d-1
   pci.df1000fa-1-90X13
   pci.df1080f9-1-91x4
   ibm.scsi.disk.10k300-RPQR-1
   ibm.scsi.disk.73lpx15-c51d-1
   ibm.scsi.disk.146z10-s28g-1
   ibm.scsi.disk.146lp-C50K-1
   ses.0018-0018-01
   cdrecord-1.9-7
   pci.1069B166.10-0710000b-1
   screen-3.9.10-2
   expat-2.1.0-1
   zlib-1.2.7-2
   AIX-rpm-6.1.6.15-5
   gettext-0.10.40-8
   libiconv-1.14-2
   apr-util-1.5.1-1
   db4-4.7.25-2
   bzip2-1.0.6-1
   info-4.13a-2
   readline-6.2-4
   pcre-8.32-1
   openssl-devel-1.0.1e-2
   httpd-2.4.3-1
   mpfr-3.1.2-1
   MySQL-devel-5.1.56-1
   libgcc-4.6.1-1
   gcc-4.6.1-1
   libstdc++-4.6.1-1
   libstdc++-devel-4.6.1-1
   gmp-5.1.3-1
   gmp-devel-5.1.3-1
   mpfr-devel-3.1.2-1
   libmpc-1.0.1-2
   libmpc-devel-1.0.1-2
   gcc-cpp-4.6.1-1
   zlib-devel-1.2.7-2

這是我用來編譯的腳本:

export CONFIG_SHELL=/opt/freeware/bin/bash
export CONFIG_ENV_ARGS=/opt/freeware/bin/bash
export CC=cc
export CFLAGS="-qmaxmem=16384 -DSYSV -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -D_AIX52 -D_AIX53 -D_AIX61 -D_ALL_SOURCE -DFUNCPROTO=15 -O -I/opt/freeware/include"
export CXX=xlC
export CXXFLAGS=$CFLAGS
export CPPFLAGS='-U__STR__'
export F77=xlf
export FFLAGS="-O -I/opt/freeware/include"
export LD=ld
export LDFLAGS="-L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib:/opt/freeware/lib/mysql:/opt/freeware/lib/mysql/mysql"
export PATH=/usr/bin:/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/vac/bin:/usr/vacpp/bin:/usr/ccs/bin:/usr/dt/bin:/usr/opt/perl5/bin:/opt/freeware/bin:/opt/freeware/sbin:/usr/local/bin:/usr/lib/instl
export CFLAGS="-DSYSV -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -D_AIX52 -D_AIX53 -D_AIX61 -D_ALL_SOURCE -DFUNCPROTO=15 -O -I/opt/freeware/include"
make clean
./configure  '--with-modules=mod_tls:mod_sql:mod_sql_mysql:mod_sql_passwd:mod_sftp:mod_sftp_sql' '--without-getopt' '--enable-openssl' '--with-includes=/home/poney/libmath_header:/home/poney/include_mysql/mysql/' '--with-libraries=/home/poney/libmath_lib:/opt/freeware/lib/mysql/mysql:/opt/freeware/lib/mysql/mysql/libmysqlclient.a' '--prefix=/usr/local/proftpd'
make

事情是它在沒有更多警告的情況下編譯。在以下情況下我仍然會收到警告make install

ld: 0711-224 WARNING: Duplicate symbol: .bcopy
ld: 0711-224 WARNING: Duplicate symbol: .memmove
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

我的配置允許 FTPS SFTP 和 FTP,如果我嘗試連接ftps它確實可以工作,直到我輸入密碼:

openssl s_client -connect 127.0.0.1:210 -starttls ftp
   CONNECTED(00000003)
   depth=0 /C=AU/ST=Some-State/O=Internet Widgits Pty Ltd
   verify error:num=18:self signed certificate
   verify return:1
   depth=0 /C=AU/ST=Some-State/O=Internet Widgits Pty Ltd
   verify return:1
   ---
   Certificate chain
    0 s:/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd
      i:/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd
   ---
   Server certificate
   -----BEGIN CERTIFICATE-----
   MIICWDCCAcGgAwIBAg[...]8dqCxa3HS6bgg==
   -----END CERTIFICATE-----
   subject=/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd
   issuer=/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd
   ---
   No client certificate CA names sent
   ---
   SSL handshake has read 1264 bytes and written 341 bytes
   ---
   New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA
   Server public key is 1024 bit
   Secure Renegotiation IS supported
   Compression: NONE
   Expansion: NONE
   SSL-Session:
       Protocol  : TLSv1
       Cipher    : DHE-RSA-AES256-SHA
       Session-ID: 6F520DFBC97CF172B68A99510AAFA765658324A4478D87ACB481362070A88034
       Session-ID-ctx:
       Master-Key: [...]
       Key-Arg   : None
       Start Time: 1391443369
       Timeout   : 300 (sec)
       Verify return code: 18 (self signed certificate)
   ---
   220 ProFTPD 1.3.4d Server (ftp daemon) [127.0.0.1]
   USER frank
   331 Password required for frank
   PASS $$$$$

在那之後什麼都沒有,它什麼也不做。在 proftpd 方面,deamon 確實提供了一些跟踪:

請參閱 Pastbin

我在這裡讀不到任何有用的東西。

我很確定這個庫有什麼問題,但我真的不知道它最終不想要什麼或為什麼不想工作,因為它編譯沒有問題。

最後的答案是:

It's not a bug it's a feature

如果您嘗試連接一個在您的 dns 中已知的數據庫,但數據包被防火牆丟棄,那麼您將陷入客戶端的 sql 超時(大約 85 秒),並且如果您先設置AUthOrder了其他身份驗證,則無法進行其他身份驗證mod_sql.c

所以我的編譯選項是正確的,包版本也是正確的。

引用自:https://unix.stackexchange.com/questions/112331