麻烦proftpd – postgres集成

我现在还不能张贴图片,所以我会尽我所能来简洁地解释一切。

我有一个ProFTPd安装工作。 现在我试图通过postgres路由authentication。 有一个包含webapp用户表的数据库。 这将理想地允许webapp用户使用他们的webapp证书login到FTP。 以下是proftpd.conf文件中的相关设置:

LoadModule mod_sql.c LoadModule mod_sql_passwd.c LoadModule mod_sql_postgres.c #Begin SQL configuration #mod_sql_password parameters SQLPasswordEngine on SQLPasswordEncoding hex #mod_sql base configuration SQLEngine on SQLBackend postgres SQLConnectInfo [database_name]@localhost:5432 [SELECT name] [password] SQLAuthTypes SHA1 SQLAuthenticate users SQLLogFile /var/log/proftpd/sqlLog.txt 

“SELECT name”帐户是在webapp用户表上被授予SELECT权限的帐户。 我可以使用从命令行login该用户

 psql -d [database_name] -U [SELECT name] -W 

然后在proftpd.conf文件中input相同的密码。

当我尝试连接时,它会生成以下日志文​​件数据:

 Feb 21 10:20:00 mod_sql/4.2.5[43238]: entering postgres cmd_exit Feb 21 10:20:00 mod_sql/4.2.5[43238]: exiting postgres cmd_exit Feb 21 10:29:45 mod_sql/4.2.5[43334]: defaulting to 'postgres' backend Feb 21 10:29:45 mod_sql/4.2.5[43334]: backend module 'mod_sql_postgres/4.0.4' Feb 21 10:29:45 mod_sql/4.2.5[43334]: backend api 'mod_sql_api_v1' Feb 21 10:29:45 mod_sql/4.2.5[43334]: >>> sql_sess_init Feb 21 10:29:45 mod_sql/4.2.5[43334]: entering postgres cmd_defineconnection Feb 21 10:29:45 mod_sql/4.2.5[43334]: name: 'default' Feb 21 10:29:45 mod_sql/4.2.5[43334]: user: [SELECT account] Feb 21 10:29:45 mod_sql/4.2.5[43334]: host: 'localhost' Feb 21 10:29:45 mod_sql/4.2.5[43334]: db: [database_name] Feb 21 10:29:45 mod_sql/4.2.5[43334]: port: '5432' Feb 21 10:29:45 mod_sql/4.2.5[43334]: ttl: '0' Feb 21 10:29:45 mod_sql/4.2.5[43334]: exiting postgres cmd_defineconnection Feb 21 10:29:45 mod_sql/4.2.5[43334]: mod_sql engine : on Feb 21 10:29:45 mod_sql/4.2.5[43334]: negative_cache : off Feb 21 10:29:45 mod_sql/4.2.5[43334]: authenticate : users Feb 21 10:29:45 mod_sql/4.2.5[43334]: usertable : users Feb 21 10:29:45 mod_sql/4.2.5[43334]: userid field : userid Feb 21 10:29:45 mod_sql/4.2.5[43334]: password field : passwd Feb 21 10:29:45 mod_sql/4.2.5[43334]: UID field : uid Feb 21 10:29:45 mod_sql/4.2.5[43334]: GID field : gid Feb 21 10:29:45 mod_sql/4.2.5[43334]: homedir field : homedir Feb 21 10:29:45 mod_sql/4.2.5[43334]: homedir(default) : [redacted] Feb 21 10:29:45 mod_sql/4.2.5[43334]: shell field : shell Feb 21 10:29:45 mod_sql/4.2.5[43334]: SQLMinUserUID : 999 Feb 21 10:29:45 mod_sql/4.2.5[43334]: SQLMinUserGID : 999 Feb 21 10:29:45 mod_sql/4.2.5[43334]: <<< sql_sess_init Feb 21 10:29:45 mod_sql/4.2.5[43334]: >>> sql_pre_pass Feb 21 10:29:45 mod_sql/4.2.5[43334]: <<< sql_pre_pass Feb 21 10:29:45 mod_sql/4.2.5[43334]: >>> cmd_getpwnam Feb 21 10:29:45 mod_sql/4.2.5[43334]: entering postgres cmd_escapestring Feb 21 10:29:45 mod_sql/4.2.5[43334]: entering postgres cmd_open Feb 21 10:29:45 mod_sql/4.2.5[43334]: exiting postgres cmd_open Feb 21 10:29:45 mod_sql/4.2.5[43334]: exiting postgres cmd_escapestring Feb 21 10:29:45 mod_sql/4.2.5[43334]: unrecoverable backend error Feb 21 10:29:45 mod_sql/4.2.5[43334]: error: 'mod_sql_postgres/4.0.4' Feb 21 10:29:45 mod_sql/4.2.5[43334]: message: 'FATAL: Ident authentication failed for user [SELECT account] ' Feb 21 10:29:45 mod_sql/4.2.5[43334]: entering postgres cmd_exit Feb 21 10:29:45 mod_sql/4.2.5[43334]: exiting postgres cmd_exit 

所以我现在完全迷失了,因为我不确定为什么在proftpd.conf中使用命令行login时使用的相同凭据不起作用。 任何人都可以给我什么尝试下一个build议? 谢谢!

好的,我find了这个问题的答案,以防将来有人跑过去。

所以错误日志使它看起来像Postgres拒绝我有效的凭据。 不是这样! 在proftpd.conf文件中,缺省值是proftpd尝试以用户和组“nobody”身份login。 “nobody”是服务器上的实际有效用户,但关联的ID号通常是非常低的。 在我的情况是99。

现在,当使用mod_sql时,有一个可用的参数叫做SQLMinID 。 默认情况下,它被设置为999.这就是阻止我login的东西!

为了解决这个问题,我只需将proftpd.conf中的“用户”和“组”参数设置为具有更高身份证号码的用户,该用户有足够的权限访问postgres。 只要我这样做,它的工作。