设为首页 收藏本站
查看: 1514|回复: 0

[经验分享] openwebmail setuid root出错,perl怎样才能支持SUIDPERL

[复制链接]

尚未签到

发表于 2017-5-19 10:29:19 | 显示全部楼层 |阅读模式
  转帖于:
  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失败,所以手工执行此文件:
[iyunv@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
提示如下
[iyunv@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了。


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-379006-1-1.html 上篇帖子: perl-优化和编译成字节码运行 下篇帖子: 写给Java开发者的10分钟Perl指南
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表