2024年5月14日 星期二

FortiGate_Email告警

※註1:在FortiOS6.4版本後,GUI已無『「電子郵件告警配置」!
※註2:有切vDom的話…每個vDom都要設一次config alertemail setting

《Step1:設定Email Server》

GUI:《系統管理》→《基本設定》
FGT201E # config system email-server
FGT201E (email-server) # set

type                                Use FortiGuard Message service or custom email server.
reply-to                           Reply-To email address.
server                              SMTP server IP address or hostname.
port                                 SMTP server port.
source-ip                        SMTP server IPv4 source IP.
source-ip6                      SMTP server IPv6 source IP.
authenticate                   Enable/disable authentication.
validate-server               Enable/disable validation of server certificate.
security                          Connection security used by the email server.
ssl-min-proto-version    Minimum supported protocol version for SSL/TLS connections (default is to follow system global setting).

FGT201E (email-server) # get
type                            : custom
reply-to                      : Infosecure-FGT201E@gmail.com
serve                          : notification.fortinet.net
port                           : 465
source-ip                   : 0.0.0.0
source-ip6                  : ::
authenticate                : disable
validate-server            : disable
security                        : smtps
ssl-min-proto-version  : default
FGT201E (email-server) #end


《Step2:電子郵件告警配置》

※GUI:《日誌與報表》→《電子郵件告警配置》

FGT201E # config alertemail setting

《※依「系統事件」寄送告警Mail》

FGT201E (setting) # set filter-mode category //與threshold擇一!
Category系統事件、Threshold威脅程度

FGT201E (setting) # set 
username        Name that appears in the From: field of alert emails (max. 36 characters).
mailto1            Email address to send alert email to (usually a system administrator) (max. 64 characters).
mailto2            Optional second email address to send alert email to (max. 64 characters).
mailto3            Optional third email address to send alert email to (max. 64 characters).
filter-mode       How to filter log messages that are sent to alert emails.
email-interval    Interval between sending alert emails (1 - 99999 min, default = 5).
IPS-logs            Enable/disable IPS logs in alert email.
firewall-authentication-failure-logs Enable/disable firewall authentication failure logs in alert email.
HA-log                Enable/disable HA logs in alert email.
IPsec-errors-logs    Enable/disable IPsec error logs in alert email.
FDS-update-logs     Enable/disable FortiGuard update logs in alert email.
PPP-errors-logs        Enable/disable PPP error logs in alert email.
sslvpn-authentication-errors-logs        Enable/disable SSL-VPN authentication error logs in alert email.
antivirus-logs                     Enable/disable antivirus logs in alert email.
webfilter-logs                        Enable/disable web filter logs in alert email.
configuration-changes-logs     Enable/disable configuration change logs in alert email.
violation-traffic-logs               Enable/disable violation traffic logs in alert email.
admin-login-logs                 Enable/disable administrator login/logout logs in alert email.
FDS-license-expiring-warning    Enable/disable FortiGuard license expiration warnings in alert email.
log-disk-usage-warning          Enable/disable disk usage warnings in alert email.
FSSO-disconnect-logs            Enable/disable logging of FSSO collector agent disconnect.
ssh-logs                               Enable/disable SSH logs in alert email.
FDS-license-expiring-days      Number of days to send alert email prior to FortiGuard license expiration (1 - 100 days, default = 100).
local-disk-usage                   Disk usage percentage at which to send alert email (1 - 99 percent, default = 75).

FGT201E (setting) # get
username            : Infosecure-FGT201E@gmail.com 
mailto1              : jimmy@infosecure.com.tw 
mailto2             
mailto3             
filter-mode          : category 
email-interval      : 5
IPS-logs            : enable 
firewall-authentication-failure-logs : disable 
HA-logs              : disable 
IPsec-errors-logs    : disable 
FDS-update-logs      : disable 
PPP-errors-logs      : disable 
sslvpn-authentication-errors-logs : disable 
antivirus-logs      : enable 
webfilter-logs      : disable 
configuration-changes-logs : enable 
violation-traffic-logs : disable 
admin-login-logs    : enable 
FDS-license-expiring-warning : disable 
log-disk-usage-warning : disable 
FSSO-disconnect-logs         : disable 
ssh-logs            : disable 
FDS-license-expiring-days : 15
local-disk-usage    : 75
FGT201E (setting) #


《※依「威脅程度」寄送告警Mail》

FGT201E (setting) # set filter-mode threshold //與category擇一!
※Category系統事件、Threshold威脅程度

FGT201E (setting) # set 
username                    Name that appears in the From: field of alert emails (max. 36 characters).
mailto1                             Email address to send alert email to (usually a system administrator)(max. 64 characters).
mailto2                              Optional second email address to send alert email to (max. 64 characters).
mailto3                              Optional third email address to send alert email to (max. 64 characters).
filter-mode                     How to filter log messages that are sent to alert emails.
emergency-interval      Emergency alert interval in minutes.
alert-interval                    Alert alert interval in minutes.
critical-interval                Critical alert interval in minutes.
error-interval                    Error alert interval in minutes.
warning-interval             Warning alert interval in minutes.
notification-interval       Notification alert interval in minutes.
information-interval      Information alert interval in minutes.
debug-interval                Debug alert interval in minutes.
severity                             Lowest severity level to log. (Default = alert)

FGT201E (setting) # set severity critical
FGT201E (setting) # get
username             : Infosecure-FGT201E@gmail.com
mailto1                 : jimmy@nextec.tw
mailto2                 :
mailto3                 :
filter-mode           : threshold
emergency-interval    : 1
alert-interval               : 2
critical-interval            : 3
error-interval               : 5
warning-interval          : 10
notification-interval    : 20
information-interval    : 30
debug-interval            : 60
severity                       : critical
FGT201E (setting) #


※測試指令!  diagnose log alertmail test


※參考文件1_FortiOS 6.2以前適用:
https://community.fortinet.com/t5/FortiGate/Technical-Tip-How-to-configure-alert-email-settings/ta-p/194102

※參考文件2_FortiOS 6.4版後適用:
https://docs.fortinet.com/document/fortigate/7.4.3/administration-guide/526019/email-alerts

2023年5月26日 星期五

如何使用Console線連接網路設備

 常常會有身邊的人來詢問,如何連接網路設備的Console…

來幫大家整理一下。

《一、需要準備的硬體材料》
1、一部→筆電
2、一條→USB轉RS-232線(接口型式:USB-Type A ↔RS-232-9F公)
3、一條→RS-232線(接口型式:RS-232-9M母 ↔RJ-45) 

《二、需要準備的軟體》
1、Putty

《三、操作流程》
1、將USB轉RS-232線材,接上筆電後…在『裝置管理員』內,確認『連接埠COM&LPT』有無識別到此條線材,正常的話,會出現『Com3
※數字不一定是3有可能是其它數字→當你有正常看到數字時,代表,此線材已正確連接到筆電囉!若沒有看到Com,可能要安裝驅動程式。
2、下載『Putty』存放到桌面,並雙擊開啟。


※相關連接:
3、Cisco Console腳位定義(其它資訊可谷歌Cisco pinout)

★註:USB的有線網卡,只能拿去接『有線網路孔』,
雖然,絕大多數的Console Port也是RJ45的型式!
還是會有人誤會,把網路線接到Console Port!
但!絕對是無法設定的!



2023年5月25日 星期四

FortiGate不正常斷電

 

※FortiGate若不正常斷電,登入後會提你做
File System Check

在6.0版之前…只能等開機好後,在登入後,
按下「Reboot and check file system」
或是用CLI執行 execute disk 17

但是在6.2版以後,在『System』→『Setting』→『Start Up Setting』底下
有個不錯的選項『Auto file system check』勾選後(這選項,預設是沒勾選的)
就可以在不正常斷電後,開機自動先執行File System Check了!

至於到底執不執行File System Check有沒有差!
個人建議既然都發現問題了…
還是乖乖的檢查一下!


※參考文件:

2022年2月24日 星期四

網路常見名詞…不專業解釋

跟大家分享一下,在網路這個常聽到的一些基本名詞…其它可以谷歌到的理論我就不說了…


1、Wan廣域網路(英語:Wide Area Network,縮寫為WAN)...
★拿電話來比喻…Wan,就像是一個公司電話的代表號
例如:台中市政府的電話是(04)2228-9111,在世界上,
這一支代表號,我們在外面撥通,一定是台中市政府接聽的。
※所以,Wan有『唯一』的這個特性!
▲如何知道自己家網路的代表號:https://youtu.be/WkP9uj70prw?t=158

2、Lan區域網路(英語:Local Area Network,縮寫為LAN)...
★拿電話來比喻…Lan,就像是一個公司內,每個員工座位上的內線分機號碼
例如:Jimmy的分機是315號,Betty的分機是114號
在公司內Jimmy要撥內線分機給Betty,就是拿起話筒按下114,Betty座位的電話就會響了。
……如果有兩個同事電話的分機號碼都一樣…當有人撥這分機時…到底要誰接!?
※所以,Lan是能夠自己定義的!而在同公司內每個人、每台電腦的LAN IP位置都不能相同!
但是,A公司內Jimmy分機是315,B公司內Peter的分機當然也可以是315!
因為,不同公司!
▲如何知道自己電腦的分機號碼:https://youtu.be/XfzoDUdpncM

3、Vlan虛擬區域網路(英語:Virtual Local Area Network,縮寫為VLAN)...
★辦公室空間來比喻,Vlan就像是一個公司內有沒有做『隔間』。
例如:公司內是一個全開放的辦公空間…但是,有專門隔一間當總經理辦公室,而且有房間門。
→在網路的世界來說…我就會稱做一般的開放的辦公空間是一個Vlan,而總經室也是一個Vlan。
當然小公司來說…員工可能可以任意的走入總經理室。
對於一些制度相對嚴謹的公司來說…員工或是訪客能去的地方,都是有限的。是不能亂跑的!
※所以,在網路世界裡…切了Vlan只是為了後續的管理,當然如果,總經理的座位就跟大家一起在同一個開放的空間了…自然…要做管理就會相對的不容易!
→有切Vlan並不代表就有管制,不代表不同Vlan之間資料不能互通。但是,一但要做限制時才比較好導入控管的機制。
在公司內,你沒辦法知道來的訪客電腦有沒有中毒…萬一訪客的電腦有狀況…而訪客的電腦,又跟公司是在同一個Vlan…你覺得會發生什麼事!?

4、NAT:網路位址轉換(英語:Network Address Translation,縮寫:NAT)...
★同樣拿電話來比喻…
例如:Jimmy在辦公室,拿起桌上的公司話機,撥到自己的手機上。
手機上顯示的來電號碼…就是公司的代表號!而不是分機315!這樣的結果,我們就叫NAT
而電話上是那個設備幫我們做NAT的呢…就是電話總機。
在網路的世界裡能做NAT的設備也很多種…例如:中華電信的小烏龜、IP分享器、防火牆…等!
▲參考 4分12秒~4分37秒→https://youtu.be/aP-9hr2NyEI?t=249

5、IP:

6、Netmask:

7、Gateway:

8、DNS:網域名稱系統(英語:Domain Name System,縮寫:DNS)
★拿電話來比喻…DNS,就像是查號台
例如:古時候,我要查台中市政府的電話…我就是拿起電話,撥104詢問台中市政府的電話是多少,得到電話後,再撥電話過去…而在網路世界裡台灣常用的查號台就是168.95.1.1
※所以,在網路世界裡…如果,公司內部有架設自己的DNS Server的話…也就表示…
我想要丟資料到NAS的話…我就能輸入\\NAS就行了!
我想要瀏覽www.hinet.net的網站,我直接輸入『名字』就行了,而不用知道中華電信網頁的IP是多少!

優點:不用記NAS的LAN IP是多少!
▲缺點:理論上,輸入名稱來連線,一定會比輸入IP來連線慢一些些…只是…這個慢的正常人不容易感覺出來!但是,如果在不同Vlan又沒有自建DNS Server的話…就只能乖乖用IP做連線!
→那我不會自建DNS Server但是,又想要名稱來做連線…該怎麼辦…
在每部電腦內…也有屬於自己的電話簿那就是『Hosts』檔。

※如何修改自己電腦的電話簿


2017年12月14日 星期四

FortiGate_忘記登入密碼

1、使用Console線連接至FortiGate (Baud Rate 9600,n,8,1)

2、找個可以重開機時間,拔電...重開吧。

3、開機過程...實際Console輸出內容如下...記得,留意機器序號!待會要用到!
FortiGate-80C (16:50-09.27.2011)
Ver:04000009
Serial number:FGT80C1234567888
RAM activation
Total RAM: 1024MB
Enabling cache...Done.
Scanning PCI bus...Done.
Allocating PCI resources...Done.
Enabling PCI resources...Done.
Zeroing IRQ settings...Done.
Verifying PIRQ tables...Done.
Disabling local APIC...Done.
Boot up, boot device capacity: 7640MB.
Press any key to display configuration menu...
......

Reading boot image 1463263 bytes.
Initializing firewall...
FGT80C1234567888 login: maintainer     //帳號為→maintainer
Password: bcpbFGT80C1234567888     //密碼為→bcpb機器序號
Welcome !
★★★此maintainer帳號,只有在剛開完機的30秒內,輸入有效!★★★

FGT80C1234567888 # show system admin     //顯示FortiGate內系統管理員所有帳號。
config system admin
    edit "admin"     //由此行觀察到『admin』為管理員帳號
        set accprofile "super_admin"
        set vdom "root"
        set password ENC SH2b5Q7jvPgTUXfU69eeBdD+ngawGbffesL1wYFahtE8DSVslbNl2JZ5QWfJZA=
    next
end

FGT80C1234567888 # config system admin
FGT80C1234567888 (admin) # edit admin     //編輯,帳號:admin,這位系統管理員
FGT80C1234567888 (admin) # set password 1qaz@WSX     //設定密碼為:1qaz@WSX
FGT80C1234567888 (admin) # end     //退出編輯模式,並儲存設定。
FGT80C1234567888 # show system admin     //再次顯示所有系統管理員帳號。
config system admin
    edit "admin"
        set accprofile "super_admin"
        set vdom "root"
        set password ENC SH2bR5tBaqmgqveBbn4MzZsl9PRqTVkLGR3eB2zmRS12ECgADepdQKaEgClCU0=
    next
end
FGT80C1234567888 # exit     //退出maintainer帳號。


FGT80C1234567888 login: admin     //測試使用admin帳號登入
Password: 1qaz@WSX
Welcome !

FGT80C1234567888 #     //登入成功!





2017年12月13日 星期三

HP 1920G、HP v1910開啟完整指令

《HP 1920G開啟方式》
使用Console、telnet、ssh連入HP 1920G後
輸入底下紅字內容
******************************************************************************
* Copyright (c) 2010-2015 Hewlett-Packard Development Company, L.P.       
* Without the owner's prior written consent,                               
* no decompiling or reverse-engineering shall be allowed.                 
******************************************************************************


Login authentication


Username:admin
Password:
<HP1920G Switch> _cmdline-mode on
All commands can be displayed and executed. Continue? [Y/N]Y
Please input password:Jinhua1920unauthorized
Warning: Now you enter an all-command mode for developer's testing, some commands may affect operation by wrong use, please carefully use it with our engineer's direction.
<HP1920G Switch>

------------------------

《HP v1910開啟方式》
使用Console、telnet、ssh連入HP v1910後
輸入底下紅字內容
******************************************************************************
* Copyright (c) 2010-2015 Hewlett-Packard Development Company, L.P.       
* Without the owner's prior written consent,                               
* no decompiling or reverse-engineering shall be allowed.                 
******************************************************************************


Login authentication


Username:admin
Password:
<HPv1910 Switch> _cmdline-mode on
All commands can be displayed and executed. Continue? [Y/N]Y
Please input password:512900
Warning: Now you enter an all-command mode for developer's testing, some commands may affect operation by wrong use, please carefully use it with our engineer's direction.
<HPv1910 Switch>
------------------------


2017年12月12日 星期二

FortiGate_Switch Mode修改Interface Mode

Jimmy習慣有圖有真像....

大多的文章內容,圖片內,大多會有說明...

原則上,按圖施工,保證成功。


回到正題....

在FortiOS 5.4前,要由Switch Mode修改Interface Mode
原則上,需要將所有跟Internal有關的設定全部刪除!
才能做切換!

如果,設定不能刪,或是Production的環境...
建議,先按照FortiGate  Upgrade Paths 升級到FortiOS5.4版後,就簡單多了!
直接在Internal的Switch內,可以直接將要使用的介面給移出Internal....