Apache 的 access.log 問題 [論壇 - 伺服器架設]
正在瀏覽:
1 名遊客
Apache 的 access.log 問題 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員一級
![]() ![]() 註冊日期:
2010/10/15 22:52 所屬群組:
已註冊使用者 等級: 1
HP : 0 / 15
![]() |
近來檢查access.log時發現
121.228.146.195 - - [27/Mar/2011:21:11:14 +0800] "GET http://www.sciencedirect.com/ HTTP/1.1" 200 256 "-" "Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)" 69.28.58.22 - - [28/Mar/2011:23:38:22 +0800] "GET /robots.txt HTTP/1.0" 404 490 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) (larbin2.6.3@unspecified.mail)" 69.28.58.22 - - [29/Mar/2011:00:01:27 +0800] "GET / HTTP/1.0" 200 275 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) larbin2.6.3@unspecified.mail" 222.247.53.38 - - [29/Mar/2011:20:37:34 +0800] "GET http://www.baidu.com/ HTTP/1.1" 200 256 "-" "Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)" 222.247.53.38 - - [29/Mar/2011:21:04:06 +0800] "GET http://www.sciencedirect.com/ HTTP/1.1" 200 256 "-" "Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)" 這些怪怪的行為... 其中121.228.146.195跟222.247.53.38都是GET一個URL... 這個動作其實是不是跳板的意思.....? 有沒有方法block這種 GET 不是以/ 的commond呢 ? 另外,vsftpd我用了/etc/hosts.allow 加上了2行 vsftpd : 140.*.*.* : ALLOW vsftpd : ALL : DENY 但查過卻發現很多人在設定apache都是教用iptables來防 其實apache能否都可以這樣做呢....? 我研究過ufw又不能好像hosts.allow 可以一整個ip來block... 只能一個一個.... 所以想問就是 有沒有方法可以令apache都能好似vsftpd這能限制哪些範圍的IP呢 ? 還有想問就是... http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?viewmode=compact&topic_id=33722&forum=11 我怎樣看syslog 跟 access.log 才知道我被做了什麼事跟被跳板 ?
2011/4/1 20:43
|
||||||||||
![]() |
回覆: Apache 的 access.log 問題 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員三級
![]() ![]() 註冊日期:
2010/12/13 6:50 所屬群組:
已註冊使用者 等級: 9
HP : 0 / 206
![]() |
#!/bin/bash
iptables -F iptables -P INPUT DROP # 清除所有防火牆規則,並建立全部阻擋封包進入 iptables -A INPUT -p icmp --icmp-type 8 -j DROP iptables -A INPUT -p icmp --icmp-type 0 -j ACCEPT # 對於 ping 要求的封包全部拒絕,不過對於自己發出去的 ping 封包要接受 for port in 20 21 53 80 4068 9881:9886 do iptables -A INPUT -i eth0 -p tcp --dport $port -j ACCEPT done # 開放 ftp(20 21),bind(53),http (80),ssh(4068),vsftp(9881~9886) tcp port for uport in 53 4068 do iptables -A INPUT -p udp --dport $uport -j ACCEPT done # 開放 bind (53),ssh(4068) udp port # 請參考 /etc/services iptables -A INPUT -i eth0 -m state --state RELATED,RELATED -j ACCEPT iptables -A INPUT -i eth0 -m state --state NEW,INVALID -j DROP # 不正確的封包檔掉 iptables -A INPUT -i eth0 -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP iptables -A INPUT -i eth0 -p tcp --tcp-flags ALL ALL -j DROP iptables -A INPUT -i eth0 -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP iptables -A INPUT -i eth0 -p tcp --tcp-flags ALL NONE -j DROP iptables -A INPUT -i eth0 -p tcp --tcp-flags SYN,RST SYN,RST -j DROP iptables -A INPUT -i eth0 -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP # 檔掉 scan port 的程式 iptables -A INPUT -i lo -j ACCEPT # lo 所產生的 port 都允許接受 iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT # 對於自己所產生的連線,並且後續的要求封包都接受 #將此 shell script 存好,並在 /etc/rc.local 的exit 0之前加入sh /shell/iptables.sh便可在開機時自動執行 =========================================== 這是我在伺服器上面做的iptables.sh您可以試試看用iptables設定,應該滿容易達到您的需求
2011/4/18 22:18
|
||||||||||
![]() |
回覆: Apache 的 access.log 問題 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員四級
![]() ![]() 註冊日期:
2010/8/12 15:54 所屬群組:
已註冊使用者 等級: 18
HP : 0 / 443
![]() |
雁 寫到: 應該說...為什麼你的apache 對這種GET會吐200的http status apache 的 modproxy 研究一下吧!! 如果用不到就把它摘掉 雁 寫到: 哪邊有洞,就補哪邊 如果是你用的網頁code有問題,就改code 如果是你apache裝了modproxy且啟用了,又沒有做適當的限制 那就修補apache 現在狀況看起來與其說是那些來源的ip有問題,不如說是你的web server的反應不對 洞沒補起來,ip擋不完的 至於怎麼看log,你不是就看出來你貼的那幾行不太對勁 發現有怪怪的log,接下來應該去查它的原因是什麼 如果跟我猜的一樣,是你的apache開proxy的話, syslog看不出什麼東西的
2011/4/19 2:33
|
||||||||||
![]() |
訪客
|
回覆: Apache 的 access.log 問題 |
|
---|---|---|
Anon:訪客
|
雁 寫到: 這兩點都是直接在apache的設定檔或網站目錄的.htaccess檔案做設定就使得到。
2011/4/19 7:44
| 72a65 a4f6b ee64e 05b2c
|
|
![]() |
回覆: Apache 的 access.log 問題 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員三級
![]() ![]() 註冊日期:
2011/4/16 10:39 所屬群組:
已註冊使用者 等級: 9
HP : 0 / 223
![]() |
放了這麼久 我以為已經沒有人理會了 (淚
不過我都在這段時間學了不少就是了... 小睡寶 寫到: iptables 對我來講太煩了 我只有用ufw deny form all allow form 22 這樣而已 其他就放給所屬的程式就好了 acman 寫到: 我入手了"Apache錦囊妙技" , 它都是這樣說 其實這個我一直想不到的是 modproxy根本就沒有開 但回傳200 所以我在httpd那邊自己寫 不管他有沒有global有沒有開 我都把它開了 再deny 不過我是不知道哪可以看到... 當別人hack進入時...做了什麼而已... apache的log我就知道而已...其他的就不清楚... 這個是我現在的httpd.conf ==================================== LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so #Block using this server for proxy <IfModule mod_proxy.c> ProxyVia On ProxyRequests On <Proxy *> AddDefaultCharset off Order deny,allow Deny from all </Proxy> </IfModule> LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so <IfModule mod_rewrite.c> RewriteEngine on #Block other Method RewriteCond "%{REQUEST_METHOD}" "!^(GET|POST|OPTIONS)$" #Block module login from outside RedirectMatch "^/(phpmyadmin).*" "/" #Error Document Setting ErrorDocument "404" Error. ErrorDocument "403" Error. RewriteRule "^(.*)$" "http://www.google.com/" [R] </IfModule> ==================================== 因為還是第一次寫 所以可能有些根本就不需要... 我覺得最有效是...404 403都只回傳Error 沒有再傳更多資料給對方,保護隱私(茶 不過這段時間證明我的這些R.E.是滿有效... 這個是這段時間的access.log一些明顯的攻擊 ==================================== 220.135.222.91 - - [17/Apr/2011:22:58:11 +0800] "GET http://203.187.1.180/goldchun555/index.htm HTTP/1.1" 403 156 "-" "Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)" 84.209.1.105 - - [18/Apr/2011:03:50:04 +0800] "GET / HTTP/1.1" 200 273 "-" "Python-urllib/2.5" 84.209.1.105 - - [18/Apr/2011:04:12:45 +0800] "GET / HTTP/1.0" 200 273 "-" "Python-urllib/1.17" 84.209.1.105 - - [18/Apr/2011:04:12:46 +0800] "GET /util/query.cgi HTTP/1.1" 404 207 "-" "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.1; .NET CLR 1.1.4322)" 84.209.1.105 - - [18/Apr/2011:04:12:47 +0800] "GET /axis-cgi/view/param.cgi?action=list&group=root.Brand.ProdShortName HTTP/1.1" 404 207 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.5" 84.209.1.105 - - [18/Apr/2011:04:13:08 +0800] "GET /record/current.jpg HTTP/1.1" 404 207 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8" 84.209.1.105 - - [18/Apr/2011:04:13:09 +0800] "GET /command/inquiry.cgi?inqjs=sysinfo HTTP/1.1" 404 207 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404" 84.209.1.105 - - [18/Apr/2011:04:13:10 +0800] "GET /Stssys.htm HTTP/1.1" 404 207 "-" "Opera/9.00 (Windows NT 5.1; U; en)" 84.209.1.105 - - [18/Apr/2011:04:13:11 +0800] "GET /cgi-bin/admin/getparam.cgi HTTP/1.1" 404 207 "-" "Opera/9.20 (Windows NT 6.0; U; en)" 84.209.1.105 - - [18/Apr/2011:04:13:12 +0800] "GET /get.oid?2.8 HTTP/1.1" 404 207 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)" 84.209.1.105 - - [18/Apr/2011:04:13:12 +0800] "GET /cgi-bin/getinfo?FILE=1 HTTP/1.1" 404 207 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 84.209.1.105 - - [18/Apr/2011:05:14:44 +0800] "GET / HTTP/1.0" 200 273 "-" "Python-urllib/1.17" 84.209.1.105 - - [18/Apr/2011:05:14:46 +0800] "GET /util/query.cgi HTTP/1.1" 404 207 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 84.209.1.105 - - [18/Apr/2011:05:14:47 +0800] "GET /axis-cgi/view/param.cgi?action=list&group=root.Brand.ProdShortName HTTP/1.1" 404 207 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.0" 84.209.1.105 - - [18/Apr/2011:05:14:48 +0800] "GET /Get?Func=Model&Kind=1 HTTP/1.1" 404 207 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)" 84.209.1.105 - - [18/Apr/2011:05:14:50 +0800] "GET /record/current.jpg HTTP/1.1" 404 207 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8" 84.209.1.105 - - [18/Apr/2011:05:14:51 +0800] "GET /command/inquiry.cgi?inqjs=sysinfo HTTP/1.1" 404 207 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 84.209.1.105 - - [18/Apr/2011:05:14:52 +0800] "GET /Stssys.htm HTTP/1.1" 404 207 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.5" 84.209.1.105 - - [18/Apr/2011:05:14:53 +0800] "GET /cgi-bin/admin/getparam.cgi HTTP/1.1" 404 207 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" 84.209.1.105 - - [18/Apr/2011:05:14:55 +0800] "GET /get.oid?2.8 HTTP/1.1" 404 207 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.5" 84.209.1.105 - - [18/Apr/2011:05:14:56 +0800] "GET /cgi-bin/getinfo?FILE=1 HTTP/1.1" 404 207 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" 84.209.1.105 - - [18/Apr/2011:05:15:00 +0800] "GET /setup/parafile.html HTTP/1.1" 404 207 "-" "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.1) Opera 7.02 [en]" 84.209.1.105 - - [18/Apr/2011:05:15:04 +0800] "GET / HTTP/1.0" 200 273 "-" "Python-urllib/1.17" 222.186.30.177 - - [18/Apr/2011:20:20:26 +0800] "GET /cube/README HTTP/1.1" 404 252 "-" "Morfeus strikes again." 222.186.30.177 - - [18/Apr/2011:20:20:27 +0800] "GET /round/README HTTP/1.1" 404 252 "-" "Morfeus strikes again." 222.186.30.177 - - [18/Apr/2011:20:20:28 +0800] "GET /roundcube-0.2/README HTTP/1.1" 404 252 "-" "Morfeus strikes again." 222.186.30.177 - - [18/Apr/2011:20:20:29 +0800] "GET /roundcube-0.1/README HTTP/1.1" 404 252 "-" "Morfeus strikes again." 222.186.30.177 - - [18/Apr/2011:20:20:33 +0800] "GET /roundcubemail-0.2/README HTTP/1.1" 404 252 "-" "Morfeus strikes again." 222.186.30.177 - - [18/Apr/2011:20:20:39 +0800] "GET /webmail2/README HTTP/1.1" 404 252 "-" "Morfeus strikes again." 222.186.30.177 - - [18/Apr/2011:20:20:40 +0800] "GET /rms/README HTTP/1.1" 404 252 "-" "Morfeus strikes again." 222.186.30.177 - - [18/Apr/2011:20:20:43 +0800] "GET /mail2/README HTTP/1.1" 404 252 "-" "Morfeus strikes again." 222.186.30.177 - - [18/Apr/2011:20:20:52 +0800] "GET /roundcubemail/README HTTP/1.1" 404 252 "-" "Morfeus strikes again." 222.186.30.177 - - [18/Apr/2011:20:20:52 +0800] "GET /rc/README HTTP/1.1" 404 252 "-" "Morfeus strikes again." 222.186.30.177 - - [18/Apr/2011:20:20:58 +0800] "GET /roundcube/README HTTP/1.1" 404 252 "-" "Morfeus strikes again." 222.186.30.177 - - [18/Apr/2011:20:20:59 +0800] "GET /mail/README HTTP/1.1" 404 252 "-" "Morfeus strikes again." 222.186.30.177 - - [18/Apr/2011:20:21:02 +0800] "GET /README HTTP/1.1" 404 252 "-" "Morfeus strikes again." ==================================== 以上是我近來的實驗做出來的.. 之後下一個是實驗Nginx做Reverse Proxy給apache.... 看會不會連mod_proxy都不用弄... 做好的話寫一篇比較完整的放上來好了... (LAMP + Nginx + R.E.設定)
2011/4/19 12:46
|
||||||||||
![]() |
回覆: Apache 的 access.log 問題 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() 註冊日期:
2009/12/6 10:32 所屬群組:
已註冊使用者 等級: 71
HP : 1053 / 1756
![]() |
小量 IP 名單阻擋
How to blacklist an IP Address in Apache 大量 IP 名單阻擋 Best way to use large IP blacklist to deny access to a web server?
2011/4/19 13:13
|
||||||||||
![]() |
回覆: Apache 的 access.log 問題 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員三級
![]() ![]() 註冊日期:
2011/4/16 10:39 所屬群組:
已註冊使用者 等級: 9
HP : 0 / 223
![]() |
poloshiao 寫到: 嗯 是沒錯 但真正開server都主要2個對象 自己,所有人 自己: deny all跟allow localhost,會用的IP 那種就夠了 所有人: 限制位置 跟 可用的權限 DDOS , PROXY 防衛就夠了 如果真的是要攻擊,哪會用自己IP這麼笨.. 所以個別Block IP 真的不太需要..
2011/4/19 15:11
|
||||||||||
![]() |
回覆: Apache 的 access.log 問題 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員四級
![]() ![]() 註冊日期:
2010/8/12 15:54 所屬群組:
已註冊使用者 等級: 18
HP : 0 / 443
![]() |
僅摘要:
SSG 寫到: 你有開啟 mod_proxy 只是你設成不允許任何地方連過來 這一段應該都可以移除,或是在行首用 # 把它註解起來 SSG 寫到: access log我只留跟mod_proxy有關的一行 http status 403,表示沒權限 原因就是你apache還是有載入mod_proxy,只是你把它設為deny而已 不需要的東西,就不用開吧 下面是我自己的: 85.190.0.3 - - [04/Apr/2011:08:07:23 +0800] "GET http://vlad-tepes.bofh.it/freenode-proxy-checker.txt HTTP/1.0" 404 30436 "-" "-" 因為我根本沒載入,所以直接吐 404, file not found 這個才是真的在try...因為來源不是"想利用"我的server 而是在搜集這台server是不是可以當proxy用,萬一可以且被列入他們的list後,就不知道到底會放給誰用了 至於你log當中其它那些404....這樣說好了 顯示403/404 就表示沒事 不管是想破你的站台或是想抓你網頁的檔案,只要是403/404就表示沒有成功 除非是大量403/404,多到會造成你的server 負擔過重 不然不用太擔心 都開了7-11了!就不用在意有人進來吹免費的冷氣 只要他沒有順手牽羊偷你東西就好
2011/4/19 16:21
|
||||||||||
![]() |
回覆: Apache 的 access.log 問題 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員三級
![]() ![]() 註冊日期:
2011/4/16 10:39 所屬群組:
已註冊使用者 等級: 9
HP : 0 / 223
![]() |
acman 寫到: 那個mod_proxy原本就沒開 但我之前的log說回傳200 所以我才"故意"sure他不能再用 所以之後做到404我就比較安心 這種是try ? 不是一樣想用你的proxy嗎 ? 所以我會再加mod_security用來防DDoS 那應該都會防了大量404/403 ? 而且雖然說404/403 是沒有成功 但我又不想回傳有server資料的404/403 所以我這樣寫 都保障了這點 是沒錯呢 但都不想看到有懷疑的傢伙在店內呢
2011/4/19 16:34
|
||||||||||
![]() |
回覆: Apache 的 access.log 問題 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員四級
![]() ![]() 註冊日期:
2010/8/12 15:54 所屬群組:
已註冊使用者 等級: 18
HP : 0 / 443
![]() |
SSG 寫到: mod_proxy沒開,應該是回傳404 當然有差~~ 你是希望有一個人發現你的server可以當proxy用 還是希望一間搜集 open proxy的公司發現你的server可以當proxy用 前者是一個人用 後者是可能不知道會有多少人來用 另外 404/403不會回傳任何你server上的資料
2011/4/19 16:41
|
||||||||||
![]() |
您可以查看帖子.
您不可發帖.
您不可回覆.
您不可編輯自己的帖子.
您不可刪除自己的帖子.
您不可發起投票調查.
您不可在投票調查中投票.
您不可上傳附件.
您不可不經審核直接發帖.