網絡 攻 擊 肆虐-給你的網絡設備來套防彈衣吧!

網絡 攻 擊 者 無處不在

2018年1月,大家仍像往常一樣忙忙碌碌,IT設備機房內設備轟隆隆的風扇聲嘈雜而響亮,一切看似那麼正常。
可是,如果換個視角看看設備裏面的數字世界,風景完全不同。數據包暗流涌動,爭先恐後搶着到達世界的盡頭。
俗話說,有人的地方就有江湖。而被人操控的網絡世界,免不了殺機四伏。
網絡 攻  擊 肆虐-給你的網絡設備來套防彈衣吧!
看看上面這張圖,這可不是我個人PS上去的×××圖。它是實實在在的世界級的網絡 攻 擊 流量圖。各式各樣的***流量跨越國界影響着每一臺互聯網設備。

在個人電腦難逃網絡 攻 擊 魔爪的情況下,網絡設備怎能獨善其身??

根本不可能,網絡設備也是 攻 擊 者的目標之一,而且是重要目標,除非你把電源線拔了。
這就好比打蛇打七寸, 攻 擊 者如果想製造大範圍的互聯網故障,拿下網絡設備相比嘗試攻克各個終端目標划算得多。

老闆,給我的網絡設備來套防彈衣!

怎麼避免被×××者者攻陷,做安全加固啊!有本事咱就給它套上一個金鐘罩鐵布衫,刀槍不入。

網絡設備安全加固怎麼做?

常見的做法:

我相信很多朋友腦海裏面首先浮現的是採用類似ACL訪問控制列表的方法,只允許信任的管理員訪問管理設備,限制特定的協議等。

  1. 路由器或交換機接口配置ACL允許特定流量。
  2. 限制特定網段使用SSH、HTTPS等訪問設備。

這就夠了麼?

1.如何限制網絡設備的帶內帶外安全?
2.如何只允許特定源地址連接設備協議,如BGP等?
3.是否關閉了不必要的網絡服務?
4.是否正確配置了設備日誌記錄,記錄設備登陸記錄以及其他網絡管理痕跡?
5.配置是否定期保存,以免意外故障發生?

我是土豪,找第三方安全公司做安全掃描。

或者,如果你是土財主,可以直接找第三方安全公司做安全掃描,並根據評估報告進行整頓。但是會花費一筆不小的費用。

我是動手族,自己幹,一把梭!

其實,除了花錢,我們還可以選擇自己動手解決問題,一方面節約了公司成本,也鍛鍊了個人技能。這麼好的事情,何樂而不爲呢?
網絡 攻  擊 肆虐-給你的網絡設備來套防彈衣吧!
故此,爲了滿足部分葛朗臺土豪的需求,認真貫徹自己動手,豐衣足食的精神。本文特地總結了一套網絡設備安全加固的思維方法,供大家參考。

拋磚引玉,以Juniper爲例一步步教你網絡設備安全加固。

既然要討論網絡設備加固,我們需要以一個特定的產品來作爲展示對象, 因爲本人長期使用Juniper設備,就以其產品爲例給大家講述。

同時,需要說明的是,以下內容並不僅是侷限在Juniper設備,大家除了瞭解Juniper的加固方式以外,最重要的是理解這一套思維方法,並應用到你身邊對應的廠商設備。

基本功:確保設備軟件沒有重大bug並安裝廠商建議的OS操作系統

實時關注系統bug

這一步尤其重要,但是又極其容易被忽略。
蒼蠅不叮無縫蛋,網絡 攻 擊 亦然。如果 攻 擊 者只是盯着大家都會去關注的網絡安全,例如嘗試碰運氣telnet登錄設備等。那這個***者水平就值得懷疑了。
所以真正的 攻 擊 者,是 攻 擊 那些他知道而你不知道的系統Bug漏洞。很顯然,實時掌握系統bug漏洞非常有必要,就拿我自己來說。我隔一小段時間就要去看看當前Juniper設備運行的JUNOS軟件是否爆出重大bug,然後提出修補建議。(領導會覺得你很高瞻遠矚,漲工資哦!)

如何查看JUNOS系統漏洞
方法一:查看Juniper網站bug庫: https://kb.juniper.net/InfoCenter/index?page=content&channel=SECURITY_ADVISORIES
方法二:查閱Juniper網站Problem Search 軟件bug庫:https://prsearch.juniper.net

通過定期查閱你所使用的JUNOS系統Bug信息並根據Juniper建議採取相關措施,從而大大避免因爲系統bug從而導致網絡癱瘓的問題。

安裝廠商建議的OS操作系統

這一步非常好理解,一般情況網絡設備廠商會建議你使用某個版本的OS系統。它是根據廠商統計以及客戶反饋彙總後,廠商認爲此版本系統相對較穩定,bug相對較少。

Juniper廠商建議OS系統彙總
https://kb.juniper.net/InfoCenter/index?page=content&id=KB21476&actp=METADATA

肉身都保不住了,還談什麼靈魂:設備物理安全

什麼是物理設備安全,物理設備安全包含但不僅限於如下:

  1. 設備物理環境安全。
  2. 設備實際端口、接口安全。
  3. 設備顯示屏安全。

設備物理環境安全

網絡設備一般都安裝於機房特定機架上。但是如果機房安全環境較差,隨時可以有人員進入機房挪動已經在網的網絡設備,或者實施斷電,插拔線纜等操作。那其他的一切安全問題都是浮雲。

正如戀愛中的女孩總是給男孩說:“如果連基本的安全感你都給不了我,還談個屁的愛情啊!”

所以,工程師們,給你們的網絡設備買套好點的“房子”,給他們點安全感吧。例如我之前OOB文章《構建帶外OOB網絡》中提到的,採用機架門鎖+感應器的方式保障設備安全。

設備端口安全

Console 接口安全

Console接口作爲設備的管理接口。論重要性,沒有任何其他帶內帶外管理方式能夠與之相提並論。

日常運維中,總免不了需要去現場通過console調試設備。當工程師用console登陸設備以後,往往忘了logout登出系統。而是直接拔出console線。其危害是,其他人員可以隨後插線通過console登陸設備無需任何驗證,直接使用前一位用戶的權限通過console對網絡設備執行各種操作。
換而言之,假如前一位工程師使用root賬戶登陸,那隨後的 攻 擊 者同樣也處於root模式下,可以隨時對設備進行離線,重啓,關機等重大操作。

安全設置建議
1.開啓logout-on-disconnect功能,拔除console線以後直接登出當前用戶。
[edit system ports]
GingerBeer@Juniper# set console log-out-on-disconnect

2.禁止console接口上使用root賬戶登陸。
[edit system ports]
GingerBeer@Juniper# set console insecure
3.使狠招:關閉console接口。在某些特定情況,例如在無法保證設備的物理環境安全的情況下,爲了避免有人惡意使用console猜測密碼或者執行其他任務,可以直接關閉console接口。
[edit system ports]
GingerBeer@Juniper# set console disable

輔助接口以及設備板卡診斷接口安全

Auxiliary Port 輔助接口
輔助接口,一般情況下沒幾個人用。它主要有兩個功能。第一是可以連接一個外界modem,通過modem撥號後連接遠端場所,遠端可以通過此modem管理設備。輔助接口有時候可以作爲第二個console使用。
既然大家平時都不用,所以最好把它關閉。以Junos爲例,Junos默認情況下是關閉了Auxiliary接口,雖然配置裏面看不出來。但是從安全角度出發,可以顯式配置關閉Auxiliary輔助接口。

顯式關閉輔助接口
[edit system ports]
GingerBeer@Juniper# set auxiliary disable

板卡診斷接口
對於高端路由器或者交換機而言,一般會存在兩個Routing Engine路由引擎卡,兩個交換矩陣板卡,多個業務板卡。
而就在交換矩陣板卡上,會存在一個類似於路由引擎的console接口的東西。其意義爲若有一些故障需要從板卡層面診斷的話,可以通過連接交換板卡的診斷口來收集信息。
從安全角度而言,診斷接口一般沒有密碼。對你沒看錯,沒-有-密-碼。
以Juniper爲例,某些SCB,SSB,SFM,FEB卡會存在此診斷接口。從安全角度,我們應該給他設置密碼驗證。

診斷接口設置密碼驗證
設置方法如下:
[edit system]
GingerBeer@Juniper# set diag-port-authentication plain-text-password
New password: <password>
Retype new password: <password>
[edit system]

GingerBeer@Juniper# set pic-console-authentication plain-text-password
New password: <password>
Retype new password: <password>
[edit system]
GingerBeer@Juniper#

USB接口安全

USB提供了便捷的文件傳輸和存儲擴展,基於你的安全需求,你可以考慮關閉它。
[edit chassis]
GingerBeer@Juniper# show
usb {
storage {
disable;
}
}
[edit chassis]
GingerBeer@Juniper#

設備顯示屏安全
這一點很有趣,在某些交換機上,會有一個小小的LCD的單色屏幕,旁邊一般會有幾個小小的按鈕。可別小看了這個LCD顯示屏。通過這個屏幕可以執行一些基本的系統維護和控制功能,例如離線板卡,重置系統配置等。所以若不常用其功能,我們可以選擇關閉LCD屏幕的操作功能。

鎖掉LCD屏幕操作功能,只許看,不許摸!
[edit]
GingerBeer@Juniper# set chassis craft-lockout

讓系統變得簡單,關閉不必要的服務

總的來說,類似於路由器,交換機甚至防火牆等設備。其安全性要高於服務器,原因在於網絡設備一般默認開啓的服務遠遠少於服務器。
既然做安全加固,就需要一種雞蛋裏面挑骨頭的精神,讓我們來看看在網絡設備上還能關閉什麼不必要的服務。

關閉自動安裝配置服務

很多Juniper設備初始環境下,爲了迎合自動化需求,例如大批量配置設備。默認是開啓了自動安裝配置功能。從安全角度來說,如果你不需要此功能,可以選擇關閉它。

關閉自動安裝
[edit]
GingerBeer@Juniper# delete system autoinstallation

僅限Juniper SRX,關閉從USB自動安裝
[edit]
GingerBeer@Juniper# set system autoinstallation usb disable

關閉ICMP重定向

ICMP重定向是路由器向IP數據包的發送者發送的通知,以通知他們到達特定目標主機或網絡的更好方式。 收到重定向後,源設備應修改其路由的方式,然後通過路由器建議的下一跳發送後續數據包。
攻 擊 者可以利用ICMP重定向的特性,向路由器發送大量的非最優路由的數據包,促使路由器返回成千上萬的ICMP重定向,從而實現DDOS***。
可是,在一個設計良好的網絡環境裏面,是不需要也不應該出現ICMP重定向的信息,爲此我們可以關閉它。
同其他廠商類似,Juniper的Junos默認是開啓ICMP重定向的。

關閉ICMP重定向
[edit]
GingerBeer@Juniper# set system no-redirects

禁止TCP惡意flag以及TCP 探測

TCP惡意flag
先說說TCP惡意flag,大家知道正常TCP協商流程會用到SYN或FIN flag標記,SYN用於TCP建立,而FIN用於TCP會話拆除。
但是沒有哪一個正常數據包會同時把SYN和FIN放到標記flag裏面,因爲邏輯是矛盾衝突的。
可是,有人就會故意人爲製造此數據包,並通過發送大量的無效數據包來製造DOS 攻 擊 ,並獲悉目標設備的操作系統信息等。
我們可以配置JUNOS丟棄同時含有SYN和FIN字段的無效數據,不做迴應。
配置如下:

{master:0}[edit]
GingerBeer@Juniper# set system internet-options tcp-drop-synfin-set

TCP探測

攻 擊 者爲了探測目標網絡設備的端口打開範圍和狀態,可以發送大量的TCP-SYN連接請求,通過查看網絡設備的回覆信息來知曉端口打開情況。
在高強度掃描的情況下,網絡設備的負載會增加,並造成DOS 攻 擊 。

**配置JUNOS對未開啓的端口不回覆TCP-RST,從而讓 攻 擊 者無法知曉此端口是否開啓。
{master:0}[edit]
GingerBeer@Juniper# set system internet-options tcp-drop-synfin-set

合理使用LLDP鄰居發現

LLDP,類似於Cisco的CDP。不過是被IEEE標準化了的鄰居發現協議而已。既然是鄰居發現,自然會完全暴露網絡設備本身的詳細信息。所以僅僅在需要的端口上開啓LLDP,是網絡安全的首選項。
案例如下:

如下案例,默認在所有接口關閉LLDP,除了需要的ge-0/0/0 & ge-0/0/3接口。
[edit]
GingerBeer@Juniper# edit protocols lldp
[edit protocols lldp]
GingerBeer@Juniper# set interface all disable
[edit protocols lldp]
GingerBeer@Juniper# set interface ge-0/0/0.0
[edit protocols lldp]
GingerBeer@Juniper# set interface ge-0/0/3.0

踏雪無痕?門都沒有 - 開啓Syslog日誌監控用戶活動記錄。

對於運維人員而言,我們希望能夠看到用戶登錄網絡設備以後的一舉一動,例如哪個賬號登陸的,登錄以後他都執行了哪些命令。
擁有這樣的功能以後,就好似在網絡設備上安裝了一個無形的攝像頭,監控登錄用戶的一舉一動。同時也起到了震懾作用。
Juniper的Junos在日誌這方面做得非常好,它能夠根據用戶需求,從所有日誌記錄中挑出你需要的信息,並存放到特定文件或者syslog服務器上。

配置如下:
set system syslog file interactive-commands interactive-commands any
set system syslog file authorization authorization info

查看用戶登陸記錄:
show log authorization

效果如下:
Jan 20 01:17:08 GingerBeer-RTR01 sshd[11590]: (pam_sm_acct_mgmt): DEBUG: PAM_USER: ro
Jan 20 01:17:08 GingerBeer-RTR01 sshd[11590]: (pam_sm_acct_mgmt): DEBUG: PAM_ACTUAL_USER: Gingerbeer
Jan 20 01:17:08 GingerBeer-RTR01 sshd[11590]: Accepted password for Gingerbeer from 1.2.3.4 port 12345 ssh2
Jan 20 01:21:10 GingerBeer-RTR01 sshd[11777]: (pam_sm_acct_mgmt): DEBUG: PAM_USER: ro
Jan 20 01:21:10 GingerBeer-RTR01 sshd[11777]: (pam_sm_acct_mgmt): DEBUG: PAM_ACTUAL_USER: Gingerbeer
Jan 20 01:21:10 GingerBeer-RTR01 sshd[11775]: Accepted keyboard-interactive/pam for Gingerbeer from 12345 port 12345 ssh2
Jan 20 01:21:10 GingerBeer-RTR01 sshd[11775]: Received disconnect from 1.2.3.4: 11: PECL/ssh2 (http://pecl.php.net/packages/ssh2)
Jan 20 01:21:10 GingerBeer-RTR01 sshd[11775]: Disconnected from 1.2.3.4

查看用戶執行命令記錄:
show log interactive-commands | last

效果如下:
Jan 20 07:52:30 GingerBeer-RTR01 mgd[30631]: UI_CMDLINE_READ_LINE: User 'Gingerbeer', command 'show interfaces terse '
Jan 20 07:53:03 GingerBeer-RTR01 mgd[30631]: UI_CMDLINE_READ_LINE: User 'Gingerbeer', command 'show route '
Jan 20 07:53:37 GingerBeer-RTR01 mgd[30631]: UI_CMDLINE_READ_LINE: User 'Gingerbeer', command 'show configuration | display set | no-more '
Jan 20 07:53:56 GingerBeer-RTR01 mgd[30631]: UI_CMDLINE_READ_LINE: User 'Gingerbeer', command 'show log interactive-commands | last

自動備份設備配置

網絡設備配置,毋庸置疑,最寶貴的資料莫過於它了。我見過很多工程師朋友在網絡設備down掉後急的火燒眉毛,就是因爲沒有定期備份配置。想找設備頂替都沒辦法。
而在Juniper的Junos中,自動備份配置是一件非常簡單的事情。

設置如下:
[edit system archival configuration]
GingerBeer@Juniper# show
transfer-interval 1440;
archive-sites {
"scp://[email protected]:/Configs" password "$9$EGCyMCVb1JGnev2aajPf359AO1"; ## SECRET-DATA
}
簡單解讀上述設置,每隔24小時此路由器會就通過SCP給1.2.3.4的服務器發送當前配置。

關閉不安全的系統服務

所謂的不安全系統服務,是指那些在傳輸過程中是以明文傳輸。因此極其容易被中間人截獲從而獲取系統登錄權限等。

例如如下服務:
1.關閉 Berkeley “r”
[edit system services]
GingerBeer@Juniper# delete rsh
[edit system services]
GingerBeer@Juniper# delete rlogin
2.關閉 FTP:
[edit system services]
GingerBeer@Juniper# delete ftp
3.關閉 Finger:
[edit system services]
GingerBeer@Juniper# delete finger
4.關閉 Telnet:
[edit system services]
GingerBeer@Juniper# delete telnet
5.關閉 通過HTTP登錄的J-web:
[edit system services]
GingerBeer@Juniper# delete web-management http
6.關閉 Reverse Telnet:
[edit system services]
GingerBeer@Juniper# delete reverse telnet
7.關閉 clear-text Junoscript access:
[edit system services]
GingerBeer@Juniper# delete xnm-clear-text
8.關閉 TFTP server:
[edit system services]
GingerBeer@Juniper# delete tftp-server

設定用戶登錄參數。

這一步算是一個加分項,一般情況系統都會有默認值。而大家可以根據自身網絡的需求修改爲特定值。

用戶登陸參數設置案例
{master:0}[edit system login retry-options]
GingerBeer@Juniper# show
tries-before-disconnect 3; ##在斷開連接之前最多嘗試3次
backoff-threshold 1; #如果用戶因爲密碼登錄失敗一次以後,就會啓動用戶登錄等待時間。
backoff-factor 6; #此處定義了用戶登錄等待時長。
minimum-time 30; #等待用戶30秒鍵入密碼
maximum-time 60; #當用戶ssh或者其他方式登錄設備時,在用戶未鍵入用戶名和密碼之前,等待60秒。超時後tcp連接終止。
lockout-period 10; #當用戶登陸失敗超出上文限定次數以後,鎖定用戶名10分鐘。

壓軸大戲,路由引擎保護設計邏輯

以上各項設置,僅僅起到了保護部分功能的效果,但是若要全盤保護整個路由器。還是得靠一個複雜而全面的路由引擎保護機制。
別搞些名詞來忽悠人了,還壓軸大戲,說白了不就是套個ACL訪問列表限制訪問路由引擎的流量麼。
哥別急,ACL也有它的高級套路,否則怎麼好意思稱之爲“設計”呢。

設計思路解析

首先,我們需要把到達路由器的流量分爲兩大類:


1.管理類流量
2.協議類流量


其次,分別列出以上兩類流量的所有協議。
舉例說明:
管理流量,一般爲SSH,SNMP,NTP,Radius,ICMP以及traceroute。
由於ACL是非狀態化的。換而言之,對於路由器發往外界的流量,也需要有一個條目來允許其返回流量。例如Radius請求回覆。(很重要)
協議類流量,一般爲OSPF,RIP,BGP。或者MPLS類的LDP,RSVP等。
根據協議端口特性,在條目中寫出開放的源和目標端口。


分析完畢以後,讓我們來看個編寫案例,看案例最實在了。

Juniper Firewall Policy 編寫案例與解析。

條目註釋:第一條爲防止TCP SYN 洪泛 攻 擊 ,首先匹配所有BGP鄰居地址,以及管理地址。然後匹配TCP字段是SYN 或者Fin 或者RST,但是不包含SYN ACK的TCP包,最後用QOS的Policer限制突發最多100k。

set firewall family inet filter protect-re term synflood-protect from source-prefix-list bgp-neighbors
set firewall family inet filter protect-re term synflood-protect from source-prefix-list mgmt-nets
set firewall family inet filter protect-re term synflood-protect from protocol tcp
set firewall family inet filter protect-re term synflood-protect from tcp-flags "(syn & !ack) | fin| rst"
set firewall family inet filter protect-re term synflood-protect then policer limit-100k
set firewall family inet filter protect-re term synflood-protect then accept
附加配置:
set policy-options prefix-list bgp-neighbors apply-path "protocols bgp group <> neighbor <>"
此命令用於自動匹配所有全局下BGP鄰居的IP地址,媽媽再也不用擔心我需要一個個配地址啦!
set policy-options prefix-list ipv4-interfaces apply-path "interfaces <> unit <> family inet address <*>"
此命令用於自動匹配路由器設備上配置的所有IPv4地址。
PS,可能有些朋友對於Junos的這些好玩而高效的特性不太理解,那請移步我之前寫的另外一篇Juniper JUNOS技術文:回車恐懼症?13個 JUNOS 技巧助你輕鬆無憂配置網絡

條目註釋:第二條爲允許隔壁鄰居老王主動發起BGP到此路由器,目標地址範圍爲所有本地路由器的IP地址。請注意有一條是“destination-port”,目標端口179。因爲這個Firewall Policy最終是應用於路由引擎的入方向,所以目標端口179是朝向路由器本身。

set firewall family inet filter protect-re term allow-bgp from source-prefix-list bgp-neighbors
set firewall family inet filter protect-re term allow-bgp from destination-prefix-list ipv4-interfaces
set firewall family inet filter protect-re term allow-bgp from protocol tcp
set firewall family inet filter protect-re term allow-bgp from destination-port bgp
set firewall family inet filter protect-re term allow-bgp then accept

條目註釋:第三條爲允許OSPF協議

set firewall family inet filter protect-re term allow-ospf from source-prefix-list ipv4-interfaces
set firewall family inet filter protect-re term allow-ospf from destination-prefix-list ospf-allrouters
set firewall family inet filter protect-re term allow-ospf from destination-prefix-list ipv4-interfaces
set firewall family inet filter protect-re term allow-ospf from protocol ospf
set firewall family inet filter protect-re term allow-ospf then accept

條目註釋:第四條爲允許SSH協議,而且通過Policer限速最高10Mbps的SSH流量,正常ssh管理流量一般都不會超過此數值

set firewall family inet filter protect-re term allow-ssh from source-prefix-list mgmt-nets
set firewall family inet filter protect-re term allow-ssh from protocol tcp
set firewall family inet filter protect-re term allow-ssh from destination-port ssh
set firewall family inet filter protect-re term allow-ssh then policer limit-10m
set firewall family inet filter protect-re term allow-ssh then accept

條目註釋:第五條爲允許SNMP協議,限速1Mbps

set firewall family inet filter protect-re term allow-snmp from source-prefix-list snmp-servers
set firewall family inet filter protect-re term allow-snmp from protocol udp
set firewall family inet filter protect-re term allow-snmp from destination-port snmp
set firewall family inet filter protect-re term allow-snmp then policer limit-1m
set firewall family inet filter protect-re term allow-snmp then accept

條目註釋:第六條爲允許NTP協議,限速32kbps

set firewall family inet filter protect-re term allow-ntp from source-prefix-list ntp-servers
set firewall family inet filter protect-re term allow-ntp from source-prefix-list localhost
set firewall family inet filter protect-re term allow-ntp from protocol udp
set firewall family inet filter protect-re term allow-ntp from destination-port ntp
set firewall family inet filter protect-re term allow-ntp then policer limit-32k
set firewall family inet filter protect-re term allow-ntp then accept

條目註釋:第七條爲允許Radius協議,限速32kbps

set firewall family inet filter protect-re term allow-radius from source-prefix-list radiusservers
set firewall family inet filter protect-re term allow-radius from protocol udp
set firewall family inet filter protect-re term allow-radius from source-port radius
set firewall family inet filter protect-re term allow-radius then policer limit-32k
set firewall family inet filter protect-re term allow-radius then accept

條目註釋:第八條爲限制ICMP分片包

set firewall family inet filter protect-re term icmp-frags from is-fragment
set firewall family inet filter protect-re term icmp-frags from protocol icmp
set firewall family inet filter protect-re term icmp-frags then syslog
set firewall family inet filter protect-re term icmp-frags then discard

條目註釋:第九條爲允許常見ICMP消息,並限速1Mbps

set firewall family inet filter protect-re term allow-icmp from protocol icmp
set firewall family inet filter protect-re term allow-icmp from icmp-type echo-request
set firewall family inet filter protect-re term allow-icmp from icmp-type echo-reply
set firewall family inet filter protect-re term allow-icmp from icmp-type unreachable
set firewall family inet filter protect-re term allow-icmp from icmp-type time-exceeded
set firewall family inet filter protect-re term allow-icmp then policer limit-1m
set firewall family inet filter protect-re term allow-icmp then accept

條目註釋:第十條爲允許常見Traceroute消息,並限速1Mbps

set firewall family inet filter protect-re term allow-traceroute from protocol udp
set firewall family inet filter protect-re term allow-traceroute from destination-port 33434-33523
set firewall family inet filter protect-re term allow-traceroute then policer limit-1m
set firewall family inet filter protect-re term allow-traceroute then accept

條目註釋:第十一條爲允許路由器發起的SSH,BGP能夠被允許返回路由器,正如之前所說,Juniper的Firewall policy就是Cisco 的ACL,是沒有session狀態化,所以返回路由器的流量還需要明確指定。並限速10Mbps

set firewall family inet filter protect-re term tcp-established from protocol tcp
set firewall family inet filter protect-re term tcp-established from source-port ssh
set firewall family inet filter protect-re term tcp-established from source-port bgp
set firewall family inet filter protect-re term tcp-established from tcp-established
set firewall family inet filter protect-re term tcp-established then policer limit-10m
set firewall family inet filter protect-re term tcp-established then accept

條目註釋:第十二條就很容易理解了,除了以上所有指定的流量,其他流量全部丟棄。不迴應ICMP unreachable消息。

set firewall family inet filter protect-re term default-deny then log
set firewall family inet filter protect-re term default-deny then syslog
set firewall family inet filter protect-re term default-deny then discard

應用策略

在Juniper設備上,lo0接口設計比較巧妙,他除了大家知道例如router-id,或者永不down的接口等常用功能以外。更重要的是,它是通往路由引擎的特殊通道。如果你想限制到達路由引擎的流量,相比Cisco使用control-plane policy,你只需要在Juniper的lo0上綁定一個Firewall policy即可。

完成firewall policy的配置以後,讓我們把策略應用到還回lo0接口,從而限制了到達路由引擎的流量。
set interfaces lo0 unit 0 family inet filter input protect-re

其他加固內容

除了以上描述的安全加固以外,大家日常工作中應該針對路由器上的二層冗餘網關協議,三層路由協議以及其他協議通過md5等密碼加固:
1.設定VRRP認證密碼。
2.設定OSPF,RIP,BGP認證密碼。
3.設定ldp,rsvp等MPLS協議認證密碼。

總結:

這篇文章,我們一起討論瞭如何在網絡 攻 擊 日益猖獗的今天,針對網絡設備進行安全加固的經驗分享和案例分析。
當然,每一個設備廠家對於自身設備都有相關的安全加固方法,Juniper的加固方式並不完全適用於Cisco和華爲。
但是,我們做網工的,重要的在於思路兩字。配置是不一樣的,但是思路都是相通的。


我話多,還密密麻麻的放了一堆命令行。能看到這裏的朋友們耐心可不是一般的好啊,日後必成大器!

網絡 攻  擊 肆虐-給你的網絡設備來套防彈衣吧!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章