中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

如何啟動(dòng)Apache

2019-05-28    來源:愛站科技

容器云強(qiáng)勢上線!快速搭建集群,上萬Linux鏡像隨意使用

開發(fā)部門的人啟動(dòng)Apache是需要使用root運(yùn)行的,但是監(jiān)管部門的人認(rèn)為用root啟動(dòng)有安全隱患,若是Apache有漏洞那么服務(wù)器就會(huì)被黑,那么我們現(xiàn)在去看看如何啟動(dòng)Apache的內(nèi)容。

這個(gè)問題,其實(shí)我在上一家公司也遇到同樣想法的人,使用root啟動(dòng)究竟有沒有安全隱患?

我在一臺(tái)RHEL4上編譯安裝了Apache,用了全默認(rèn)參數(shù),使用下面命令啟動(dòng)
/usr/local/apache/bin/apachectl start

看系統(tǒng)里的情況

[root@localhost conf]# ps -ef | grep httpd | grep -v grep
root???? 32485???? 1? 0 21:50 ???????? 00:00:00 /usr/local/apache/bin/httpd -k start
daemon?? 32486 32485? 0 21:50 ???????? 00:00:00 /usr/local/apache/bin/httpd -k start
daemon?? 32487 32485? 0 21:50 ???????? 00:00:00 /usr/local/apache/bin/httpd -k start
daemon?? 32488 32485? 0 21:50 ???????? 00:00:00 /usr/local/apache/bin/httpd -k start
daemon?? 32489 32485? 0 21:50 ???????? 00:00:00 /usr/local/apache/bin/httpd -k start
daemon?? 32490 32485? 0 21:50 ???????? 00:00:00 /usr/local/apache/bin/httpd -k start

[root@localhost conf]# cat httpd.conf | grep daemon
# httpd daemons, you will need to change at least LockFile and PidFile.
User daemon
Group daemon??? # socket used to communicate with the CGI daemon of mod_cgid.

試下把daemon改成root看看

[root@localhost conf]# /usr/local/apache/bin/apachectl start
Syntax error on line 65 of /usr/local/apache/conf/httpd.conf:
Error:\tApache has not been designed to serve pages while\n\trunning as root.? There are known race conditions that\n\twill allow any local user to read any file on the system.\n\tIf you still desire to serve pages as root then\n\tadd -DBIG_SECURITY_HOLE to the CFLAGS env variable\n\tand then rebuild the server.\n\tIt is strongly suggested that you instead modify the User\n\tdirective in your httpd.conf file to list a non-root\n\tuser.\n

[root@localhost conf]# cat httpd.conf | grep root
# httpd as root initially and it will switch.?
User root
Group root

可以看到,Apache根本不給你啟動(dòng)!

根據(jù)Apache的文檔里這么描述

?? 如果配置文件中Listen定義的是默認(rèn)的80端口(或1024以下),那么啟動(dòng)Apache將需要root權(quán)限以將它綁定在特權(quán)端口上。一旦服務(wù)器開始啟動(dòng)并完成了一些諸如打開日志文件之類的準(zhǔn)備操作,它將創(chuàng)建很多子進(jìn)程來完成一些諸如偵聽和回應(yīng)客戶端請求的工作。
?? httpd主進(jìn)程仍然以root用戶的權(quán)限運(yùn)行,而它的子進(jìn)程將以一個(gè)較低權(quán)限的用戶運(yùn)行。這將由你選擇的多路處理模塊進(jìn)行控制。

??? 所以,用root啟動(dòng)Apache并不存在安全問題。非root用戶不能啟動(dòng)1024以下的端口,所以非root啟動(dòng)Apache不能啟動(dòng)80,443端口,到時(shí)候再用iptable做跳轉(zhuǎn)就是很麻煩的事情,而且iptables性能也是問題。

像bind這樣的程序使用的是chroot的方式來解決權(quán)限控制問題,用root啟動(dòng)一樣沒有安全問題。

有些時(shí)候,這些想法都是人傳人,大多數(shù)人不仔細(xì)想想,找找內(nèi)因。

這里介紹了如何啟動(dòng)Apache的內(nèi)容,我們可以知道其實(shí)用root啟動(dòng)Apache是不存在安全問題的。

標(biāo)簽: [db:TAGG]

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:Hadoop的安全模式介紹

下一篇:如何使用Nginx map指令