openwebmail setuid root出错,perl怎样才能支持SUIDPERL

本文记录了解决openwebmail运行中出现的InternalServerError问题的过程。通过逐步排查,从配置文件到脚本解释器,最终实现了系统的正常启动。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转帖于:

http://cache.baidu.com/cm=9d78d513d98206f40eafc33e53029026475bda257a95c7140cc98e18cd390e564711a5e6783510738298237a5ff41a00bfa0682f621e73f7dd93d9148aa6912e298830340746c01e4c&p=986dc64ad1dd11a058ea8a60575c&user=baidu

openwebmail setuid root出错,perl怎样才能支持SUIDPERL[转]

访问: http://localhost/cgi-bin/openwebmail/openwebmail.pl
系统提示:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.

分析一:
看日志tail -f /var/log/httpd/error_log错误提示如下:
[Tue Jul 12 15:56:56 2005] [error] [client 127.0.0.1] Premature end of script headers: openwebmail.pl
[Tue Jul 12 15:56:56 2005] [error] [client 127.0.0.1] (2)!!!!!!!!!!!!!!!!!!: exec of '/var/www/cgi-bin/openwebmail/openwebmail.pl' failed
好象是执行/var/www/cgi-bin/openwebmail/openwebmail.pl失败,所以手工执行此文件:
[root@localhost www]# /var/www/cgi-bin/openwebmail/openwebmail.pl
bash: /var/www/cgi-bin/openwebmail/openwebmail.pl: /usr/bin/suidperl: bad interpreter: 没有那个文件或目录
现在问题明朗了,是/var/www/cgi-bin/openwebmail/openwebmail.pl调用/usr/bin/suidperl这个文件失败,因为系统根本没有/usr/bin/suidperl这个文件。解决的办法很简单修改/var/www/cgi-bin/openwebmail/所有openwebmail*.pl文件中“#!/usr/bin/suidperl -T”为“#!/usr/bin/perl”(后来发现openwebmail带的文档中提到suidperl的问题,可以重新编译perl来实现suidperl我没有实验,只是根据文档里面猜测的)
访问: http://localhost/cgi-bin/openwebmail/openwebmail.pl
系统提示与以前相同,日志提示改变:
[Tue Jul 12 16:28:06 2005] [error] [client 127.0.0.1] Premature end of script headers: openwebmail.pl
[Tue Jul 12 16:28:06 2005] [error] [client 127.0.0.1] Can't do setuid

分析二:
重新认真读openwebmail带的文档发现如下如下解决方法:
perl /var/www/cgi-bin/openwebmail/misc/tools/wrapsuid/wrapsuid.pl /var/www/cgi-bin/openwebmail/
访问: http://localhost/cgi-bin/openwebmail/openwebmail.pl
系统提示:
Software error:
Can't locate Text/Iconv.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 . /var/www/cgi-bin/openwebmail) at shares/iconv.pl line 7.
BEGIN failed--compilation aborted at shares/iconv.pl line 7.
For help, please send mail to the webmaster (root@localhost), giving this error message and the time and date of the error.

分析三:
阅读文档得到如下答案:
iconv是用来支持多国的字集转换功能,但可能在编辑时有错
cp /var/www/cgi-bin/openwebmail/misc/patches/iconv.pl.fake /var/www/cgi-bin/openwebmail/shares/iconv.pl
访问: http://localhost/cgi-bin/openwebmail/openwebmail.pl
系统提示:
Please execute '/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init' on server first!

分析四:
提示什么就做什么,在命令行下执行
/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
提示如下
[root@localhost openwebmail]# /var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
Please change '/var/www/cgi-bin/openwebmail/etc/dbm.conf' from
dbm_ext .db
dbmopen_ext none
dbmopen_haslock no
to
dbm_ext .db
dbmopen_ext .db
dbmopen_haslock no
And execute '/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init' again!
ps: If you are running openwebmail in persistent mode,
don't forget to 'touch openwebmail*.pl', so speedycgi
will reload all scripts, modules and conf files in --init

分析五:
去修改/var/www/cgi-bin/openwebmail/etc/dbm.conf这个文件发现没有这个文件。没有就新建,内容为:
dbm_ext .db
dbmopen_ext .db
dbmopen_haslock no
然后再执行一次/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
访问: http://localhost/cgi-bin/openwebmail/openwebmail.pl
系统提示:
'/var/www/cgi-bin/openwebmail/.openwebmail.pl' must setuid to root

分析六:
原来刚才执行perl /var/www/cgi-bin/openwebmail/misc/tools/wrapsuid/wrapsuid.pl /var/www/cgi-bin/openwebmail/后,所有openwebmail*.pl文件的s位没有了。所以
chmod 4755 /var/www/cgi-bin/openwebmail/openwebmail*.pl
访问: http://localhost/cgi-bin/openwebmail/openwebmail.pl
OK,可以看到登陆框了,说明openwebmail已经安装成功了,下面就是来结合sendmail了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值