一款国产开源 Web 防火墙神器!
闅忕潃寮婧 Web 妗嗘灦鍜屽悇绉嶅缓绔欏伐鍏风殑鍏磋捣锛屾惌寤虹綉绔欏凡缁忔槸涓浠舵垚鏈潪甯镐綆鐨勪簨鎯咃紝浣嗘槸缃戠珯鐨勫畨鍏ㄦу緢灏戞湁浜哄叧娉紝浠ヨ嚦浜 WAF 杩欎釜鍝佺被涔熼矞涓轰汉鐭ャ涓銆乄AF 鏄粈涔堬紵
WAF 鏄 Web 搴旂敤闃茬伀澧欙紙Web Application Firewall锛夌殑缂╁啓锛屼篃灏辨槸鎴戜滑淇楃О鐨勭綉绔欓槻鐏銆傚畠鍙互淇濇姢缃戠珯涓嶈榛戝鎵鏀诲嚮锛岄氬父浠 Web 缃戝叧鐨勫舰寮忓瓨鍦紝浣滀负鍙嶅悜浠g悊鎺ュ叆銆俉AF 鍙互璇嗗埆甯歌鐨 Web 鏀诲嚮骞跺疄鏂介樆鏂紝姣斿锛歋QL 娉ㄥ叆銆佽法绔欒剼鏈敾鍑伙紙XSS锛夈佽法绔欒姹備吉閫狅紙CSRF锛夈佹湇鍔$璇锋眰浼狅紙SSRF锛夈乄ebShell 涓婁紶涓庨氫俊绛夌瓑銆
浜屻侀浄姹
浠婂ぉ HelloGitHub 缁欏ぇ瀹跺甫鏉ョ殑鏄竴娆惧紑绠卞嵆鐢ㄣ佸姛鑳藉己澶с佸箍鍙楀ソ璇勭殑缃戠珯闃叉姢宸ュ叿鈥斺旈浄姹 WAF锛屼笉璁╅粦瀹㈣秺闆锋睜鍗婃銆
GitHub锛歨ttps://github.com/chaitin/safeline
闆锋睜鏄竴娆剧畝鍗曟槗鐢ㄣ佸箍鍙楀ソ璇勭殑绀惧尯 WAF 椤圭洰锛屽畠搴曞眰鍩轰簬 Nginx 鐨 Web 缃戝叧锛屼綔涓哄弽鍚戜唬鐞嗘帴鍏ョ綉缁滐紝娓呮礂鏉ヨ嚜榛戝鐨勬伓鎰忔祦閲忥紝淇濇姢浣犵殑缃戠珯涓嶅彈榛戝鏀诲嚮銆傞浄姹犳嫢鏈夊弸濂界殑 Web 鐣岄潰锛屽氨绠椾綘涓嶅叿澶囩綉缁滃畨鍏ㄦ妧鏈儗鏅紝涔熷彲浠ラ氳繃瀹冨彂鎸ュ嚭椤跺皷鐨勭綉绔欓槻鎶ゆ晥鏋溿
闆锋睜鐢卞浗鍐呴《灏栫殑缃戠粶淇℃伅瀹夊叏鍏徃闀夸涵绉戞妧锛屽湪浠婂勾 4 鏈堝紑婧愮殑缃戠珯闃茬伀澧欏伐鍏枫傚畠杩唬閫熷害鐩稿綋鎯婁汉锛岀煭鐭洓涓湀鐨勬椂闂村叡鍙戝竷浜 31 涓増鏈紝琚 1.8w 鐨勭綉绔欑珯闀夸娇鐢紝鍦 GitHub 鏀惰幏浜 3K+ 鐨 Star鉁ㄣ
涓嬮潰锛屽氨璁╂垜浠竴璧蜂笂鎵嬭繖娆惧浗浜у紑婧愮綉绔欓槻鐏绁炲櫒鍚э紒
涓夈佸畨瑁呴儴缃
闆锋睜閲囩敤瀹瑰櫒鍖栭儴缃茬殑鏂瑰紡锛屾湇鍔$敱澶氫釜 Docker 瀹瑰櫒缁勬垚锛屾敮鎸佺畝鍗曟柟渚跨殑涓鏉¢緳瀹夎鑴氭湰銆傚彧瑕佹湇鍔″櫒鑳借仈缃戯紝鎵ц瀹夎鑴氭湰鍚庯紝鑷姩鎷夊彇闀滃儚銆佸垵濮嬪寲閰嶇疆鏂囦欢銆佸惎鍔ㄦ湇鍔′竴姘斿懙鎴愩
3.1 涓鏉″懡浠ゅ畨瑁
鐩存帴浣跨敤鍦ㄧ嚎瀹夎鑴氭湰銆
bash -c "$(curl -fsSLk https://waf-ce.chaitin.cn/release/latest/setup.sh)"
3.2 鍏嬮殕浠撳簱瀹夎
鍏嬮殕浠撳簱鍚庯紝鎵ц setup.sh 鑴氭湰鍗冲彲瀹夎銆
git clone git@github.com:chaitin/safeline.git
cd safeline
bash ./setup.sh
3.3 瀹夎鎴愬姛
鏁翠釜瀹夎杩囩▼瀵规柊鎵嬪崄鍒嗗弸濂斤紝鎻愮ず璇嶄负涓枃銆佽嚜鍔ㄥ畨瑁 Docker 绛夛紝鍙渶鎸夌収鎻愮ず涓璺悜涓嬪嵆鍙
____ __ _ _
/ ___| __ _ / _| ___ | | (_) _ __ ___
\___ \ / _` | | |_ / _ \ | | | | | '_ \ / _ \
___) | | (_| | | _| | __/ | |___ | | | | | | | __/
|____/ \__,_| |_| \___| |_____| |_| |_| |_| \___|
[SafeLine] 鑴氭湰璋冪敤鏂瑰紡纭姝e父
[SafeLine] 缂哄皯 Docker 鐜
[SafeLine] 鏄惁闇瑕佽嚜鍔ㄥ畨瑁 Docker (Y/n)
# Executing docker install script, commit: xxx
...
[SafeLine] 闆锋睜瀹夎鐩綍 (鐣欑┖鍒欎负 '/data/safeline'):
[SafeLine] 鐩綍 '/data/safeline' 褰撳墠鍓╀綑瀛樺偍绌洪棿涓 47G 锛岄浄姹犺嚦灏戦渶瑕 5G锛屾槸鍚︾‘瀹 (Y/n)
[SafeLine] 鍒涘缓瀹夎鐩綍 '/data/safeline' 鎴愬姛
...
[SafeLine] 闆锋睜 WAF 绀惧尯鐗堝畨瑁呮垚鍔燂紝璇疯闂互涓嬪湴鍧璁块棶鎺у埗鍙
[SafeLine] https://0.0.0.0:9443/ # 瀹夎鎴愬姛
瀹夎瀹屾垚鍚庯紝鏍规嵁鎻愮ず璁块棶鏈湴鐨 Web 鏈嶅姟绔彛鍗冲彲寮濮嬩娇鐢ㄣ
鍥涖佸伐浣滃師鐞
涓嬮潰灏嗛氳繃绠鍗曠殑 WAF 閮ㄧ讲鏋舵瀯鍥撅紝浠嬬粛闆锋睜鐨勫伐浣滃師鐞嗐
涓嬪浘鏄竴涓畝鍗曠殑缃戠珯鎷撴墤锛屽閮ㄧ敤鎴峰彂鍑鸿姹傦紝缁忚繃缃戠粶鏈缁堜紶閫掑埌缃戠珯鏈嶅姟鍣ㄣ
姝ゆ椂锛岃嫢澶栭儴鐢ㄦ埛涓瓨鍦ㄦ伓鎰忕敤鎴凤紝閭d箞鐢辨伓鎰忕敤鎴峰彂鍑虹殑鏀诲嚮璇锋眰涔熶細缁忚繃缃戠粶鏈缁堜紶閫掑埌缃戠珯鏈嶅姟鍣ㄣ
闆锋睜浠ュ弽鍚戜唬鐞嗘柟寮忔帴鍏ワ紝浼樺厛浜庣綉绔欐湇鍔″櫒鎺ユ敹娴侀噺锛屽娴侀噺涓殑鏀诲嚮琛屼负杩涜妫娴嬪拰娓呮礂锛屽皢娓呮礂杩囧悗鐨勬祦閲忚浆鍙戠粰缃戠珯鏈嶅姟鍣ㄣ
閫氳繃浠ヤ笂琛屼负锛屽彲浠ュ湪璇锋眰鍒拌揪缃戠珯鏈嶅姟鍣ㄥ墠杩囨护鎺夋伓鎰忚姹傦紝鏈缁堢‘淇濆閮ㄦ敾鍑绘祦閲忔棤娉曡Е杈剧綉绔欐湇鍔″櫒銆
浜斻佹牳蹇冭兘鍔
闆锋睜鏄竴娆惧唴澶栧吋淇殑缃戠珯闃茬伀澧欙紝瀹冧笉鍏夋湁濂界湅鐨勭晫闈紝杩樻湁寮哄ぇ鐨勭綉绔欏畨鍏ㄩ槻鎶ゅ姛鑳姐
5.1 闃叉姢 Web 鏀诲嚮銆丆C 鏀诲嚮銆佺埇铏
闆锋睜鐨 Web 鏀诲嚮妫娴嬭兘鍔涚敱璇箟鍒嗘瀽绠楁硶椹卞姩锛屼笉鍚屼簬閫氱敤鐨勮涔夊垎鏋愶紝闆锋睜鐨勮嚜鍔ㄦ満寮曟搸 yanshi 鍙互鏀寔瀵圭墖娈佃娉曡繘琛屽垎鏋愶紝瀵 HTTP 璇锋眰鍙傛暟杩涜鑷姩鍖栭掑綊瑙g爜锛屾彁鍙栬姹傚弬鏁颁腑鐨勬敾鍑荤墖娈碉紝骞堕氳繃鏀诲嚮鎵撳垎妯″瀷瀵瑰弬鏁颁腑鐨勬敾鍑讳唬鐮佽繘琛岃瘑鍒紝鏈缁堝垽瀹 HTTP 璇锋眰鏄惁涓烘伓鎰忔敾鍑伙紝鍏峰瀵归氱敤鏀诲嚮鐨勯槻鎶よ兘鍔涳紝涔熷叿澶囨硾鍖栬瘑鍒兘鍔涳紝鍙互瀹炵幇鏃犺鍒欐娴 0Day 鏀诲嚮銆
闆锋睜闆嗘垚浜嗗熀浜庢伓鎰 IP 鎯呮姤銆佸鎴风鎸囩汗銆侀紶鏍囬敭鐩樿涓鸿瘑鍒佽闂鐜囬檺鍒剁殑浜烘満楠岃瘉绠楁硶锛屽彲鐢ㄦ潵瀵规姉鐖櫕銆佸鎶楁壂鎻忋佸鎶 CC 鏀诲嚮銆
5.2 Web 娴侀噺璁块棶鎺у埗
闆锋睜鏀寔閫氳繃鍙鍖栭〉闈㈤厤缃綉绔欑殑璁块棶鎺у埗榛戠櫧鍚嶅崟锛屽厑璁稿尮閰嶆簮 IP銆佽矾寰勩佸煙鍚嶃丠eader銆丅ody 绛夋潯浠躲
5.3 缃戠珯璧勬簮璇嗗埆
闆锋睜鍩轰簬 HTTP 娴侀噺鑷姩璇嗗埆 Web 璧勬簮锛屼粠鑰岀敓鎴 API 鐢诲儚鎸佺画缁熻鍜屽垎鏋愩傞噰鐢ㄥ姩鎬佸熀绾垮拰棰勬祴鍒嗘瀽鎶鏈垎鏋愬紓甯歌闂涓猴紝绮惧噯璇嗗埆鎿嶄綔姝e父浣嗚姹傚紓甯哥殑鏀诲嚮琛屼负锛屼粠姝e父琛屼负涓娴嬪嚭寮傚父娴侀噺銆
鍏佹渶鍚
闆锋睜鏄暱浜鎶鑰楁椂杩 10 骞存墦閫犵殑寮婧愮綉绔欓槻鐏锛屽叿鏈夊紑绠卞嵆鐢ㄣ佷紒涓氶槻鎶よ兘鍔涖侀珮鎬ц兘绛夌壒鐐广
寮绠卞嵆鐢細瀹夎鍙渶瑕佷竴鏉″懡浠わ紝鐣岄潰绠鍗曟槗鎿嶄綔銆
鍔熻兘寮哄ぇ锛氶鍒涚殑璇箟鍒嗘瀽椹卞姩鐨 Web 鏀诲嚮妫娴嬬畻娉曪紝鏀寔 IP 濞佽儊鎯呮姤銆佸姩鎬侀檺棰戙佹櫤鑳藉缓妯$瓑浼佷笟绾т骇鍝佹墠鏈夌殑楂樼骇闃叉姢鑳藉姏銆
楂樻ц兘锛氬湪 Nginx 涔嬩笂澧炲姞浜嗘敾鍑绘娴嬭兘鍔涳紝杞绘澗鏀拺 10000+ TPS 娴侀噺锛屾敾鍑绘娴嬪甫鏉ョ殑寤惰繜鍦 1 姣绾у埆銆
濡傛灉浣犱娇鐢ㄥ悗瑙夊緱闆锋睜杩樹笉閿欙紝灏辩粰瀹冪偣涓涓 Star鉁 鍚э紒
GitHub锛歨ttps://github.com/chaitin/safeline
- END -
馃憜 鍏虫敞銆孒elloGitHub銆嶆敹鍒扮涓鏃堕棿鐨勬洿鏂梆煈
鐐瑰嚮闃呰鍘熸枃璁块棶瀹樼綉