labunix's blog

labunixのラボUnix

Fortigate-80Cのアップデートに失敗したのでTFTP経由でアップデートした話。

■Fortigate-80Cのアップデートに失敗したのでTFTP経由でアップデートした話。
 「5.2.2」からのアップデート

# get system status | grep Ver
Version: FortiGate-80C v5.2.2,build0642,150106 (GA)
Release Version Information: GA

■ターゲットは最新の「FortiOS v5.2.3, ビルド 670」
 「View Release Note」リンクでPDFを開き、
 80Cが対象でアップデートしても問題ないことを確認。

■以下のエラーが何回か出て再起動した。
 ファームウエアが壊れているらしい。
 というか、Linuxのエラーっぽいのだけど。。。
 [B]でバックアップから復旧

ehci_hcd 5035: fatal error

Boot up, boot device capacity: 492MB.
Press any key to display configuration menu...
..
[G]:  Get firmware image from TFTP server.
[F]:  Format boot device.
[B]:  Boot with backup firmware and set as default.
[I]:  Configuration and information.
[Q]:  Quit menu and continue to boot with default firmware.
[H]:  Display this list of options.

Enter Selection [G]:B

■Fortinetのダウンロードサイトのチェックサムと同じ。
 2度目のアップグレードを試みたが、結果は同じ。

Get Checksum Code

Image File Name: FGT_80C-v5-build0670-FORTINET.out
Checksum Code: b1c2619c8255a7e4a2874975d7f62c27

$ md5sum FGT_80C-v5-build0670-FORTINET.out 
b1c2619c8255a7e4a2874975d7f62c27  FGT_80C-v5-build0670-FORTINET.out

■過去にも未解決の同様の事象があって修正されていない様子。

 FortiOS 5.2.2 is out!
 https://forum.fortinet.com/tm.aspx?m=116802

■別の「FortiOS5.0」のFortigate-80Cでアップデートを試してみる。
 こちらは正常にアップデート出来た。

# get system status | grep Ver
Version: FortiGate-80C v5.0,build0292,140731 (GA Patch 9)
Release Version Information: GA Patch 9

# get system status | grep Ver
Version: FortiGate-80C v5.2.3,build0670,150318 (GA)
Release Version Information: GA

■Fortinet社のドキュメントのアップグレードパスに問題は無い。

 Supported Upgrade Paths for FortiOS Firmware VERSION 5.2.3
 http://docs.fortinet.com/uploaded/files/1965/Supported%20Upgrade%20Paths%20for%20FortiOS%205.2.pdf

$ pdfgrep 5.2.2 ../smb/Supported\ Upgrade\ Paths\ for\ FortiOS\ 5.2.pdf 
  2014-12-08 Updated to include 5.2.2, additional potential issue, location of
5.2.2     642         5.2.3
5.2       589         5.2.2      5.2.3
5.0.9     292         5.2.2      5.2.3
5.0.8     291         5.2.2      5.2.3

■ディスク情報を確認。
 まずはバックアップがあって良かったというところか。

# diagnose hardware deviceinfo disk 

Disk USB-0(boot)     ref:       6.8GB    type: USB [FORTINET 80C_G2_FWV071610] dev: /dev/sda
  partition ref:      38.0MB,   9.0MB free  mounted: N  label:  dev: /dev/sda1(boot)
  partition ref:      37.0MB,   5.0MB free  mounted: Y  label:  dev: /dev/sda2(boot)
  partition ref:   3   6.6GB,   6.5GB free  mounted: Y  label:  dev: /dev/sda3

■Debian側にtftpdサーバを立てる。
 というかすでにあるので、image.outを置いてサービスを起動する。

$ dpkg -l | awk '/^ii.*tftpd/ {print $2}'
atftpd

$ sudo grep . /etc/default/atftpd 
USE_INETD=true
OPTIONS="--tftpd-timeout 300 --retry-timeout 5 --mcast-port 1758 --mcast-addr 239.239.239.0-255 --mcast-ttl 1 --maxthread 100 --verbose=5 /srv/tftp"

$ /sbin/chkconfig --list | grep tftpd
atftpd                    0:off  1:off  2:off  3:off  4:off  5:off  6:off

$ sudo cp FGT_80C-v5-build0670-FORTINET.out /srv/tftp/image.out
$ sudo /etc/init.d/atftpd start

$ netstat -an | grep "^udp.*69"
udp        0      0 0.0.0.0:69              0.0.0.0:*                      


■以下の手順に沿ってフォーマット、TFTPでアップデート
 Internalの決められたポートからしかTFTPサーバに取りに行かないので注意。

 Technical Note : Loading FortiGate firmware image using TFTP
 http://kb.fortinet.com/kb/viewContent.do?externalId=10338

Enter Selection [G]:

Enter G,F,B,I,Q,or H:

Please connect TFTP server to Ethernet port "1".

Enter TFTP server address [192.168.1.168]: 172.31.31.254
Enter local address [192.168.1.188]: 172.31.31.252
Enter firmware image file name [image.out]: 
MAC:00090FD494AC
###########################
Total 28635948 bytes data downloaded.
Verifying the integrity of the firmware image.

Total 40000kB unzipped.
Save as Default firmware/Backup firmware/Run image without saving:[D/B/R]?D
Programming the boot device now.
.......................................
Reading boot image 1435388 bytes.
Initializing firewall...
System is starting...
Resizing shared data partition...done
Starting system maintenance...
Scanning /dev/sda1... (100%) 
Formatting shared data partition ... done!

■見事に5.2.3で起動した。
 コンフィグはバックアップから戻して復旧。
 ライセンスも正常に認識。

# get system fortiguard | grep "lic"
antispam-license    : Contract
avquery-license     : Contract
webfilter-license   : Contract

■普通3台あるから切り分けのために別の1台でアップグレードを試してみるとか、
 TFTP転送試した事無いけど1台なら初期化してダメになってもいいやとか、
 エンタープライズ環境では滅多に無い判断をしたと思います。。。
 自宅環境の検証セグメントの評価環境で良かった。