検証環境
- FortiGate-60E
- version v7.2.3
CLI でのオブジェクトの名前変更方法
オブジェクトの名前とコンフィグ
以下はアドレスオブジェクトのコンフィグです。
config firewall address
edit "myaddress"
set uuid 2b596efc-31b2-51ee-4964-53c53786891a
set associated-interface "internal"
set subnet 192.168.1.0 255.255.255.0
next
end
上のコンフィグの内 edit ~ next
までで一つのオブジェクトを表しますが、edit "myaddress"
の "myaddress"
の部分がオブジェクト名となります。
CLI でのオブジェクトの名前の変更方法
CLI でオブジェクトの名前を変更する場合、対象オブジェクトの config 階層に移行した上で以下のコマンドを実行します。
rename <変更前オブジェクト名> to <変更後オブジェクト名>
◆アドレスオブジェクトの名前変更例
myaddress というアドレスオブジェクトの名前を myaddress_changed という名前に変更する場合:
FortiGate-60E # config firewall address
FortiGate-60E (address) # rename myaddress to myaddress_changed
変更前後のコンフィグは以下の通りとなり、オブジェクト名以外の設定は変わりません。
◆変更前
edit "myaddress"
set uuid 2b596efc-31b2-51ee-4964-53c53786891a
set associated-interface "internal"
set subnet 192.168.1.0 255.255.255.0
next
◆変更後
edit "myaddress_changed"
set uuid 2b596efc-31b2-51ee-4964-53c53786891a
set associated-interface "internal"
set subnet 192.168.1.0 255.255.255.0
next
◆サービスオブジェクトの名前変更例
myservice というアドレスオブジェクトの名前を myservice_changed という名前に変更する場合:
FortiGate-60E # config firewall service custom
FortiGate-60E (custom) # rename myservice to myservice_changed
ファイアウォールポリシーの名前変更
ファイアウォールポリシーのコンフィグでは名前の設定方法がアドレスやサービスと異なっています。
ファイアウォールポリシーのコンフィグは以下のようになっています。
config firewall policy
edit 1
set name "mypolicy"
set uuid 440987a2-31b2-51ee-8cb0-aa0abd211220
set srcintf "internal"
set dstintf "wan1"
set action accept
set srcaddr "myaddress"
set dstaddr "all"
set schedule "always"
set service "myservice"
set nat enable
next
end
ファイアウォールポリシーのコンフィグでは上のように edit の後に ID 番号が表示されます。
そして edit ~ next の内部に set name
という設定項目があります。
この設定項目がポリシーの名前に該当します。上記コンフィグ例では mypolicy がポリシー名です。
従ってポリシーの名前を変更したい場合は set name
の設定を変更します。
◆ファイアウォールポリシーの名前の変更例
FortiGate-60E # config firewall policy
FortiGate-60E (policy) # edit 1
FortiGate-60E (1) # set name mypolicy_changed
FortiGate-60E (1) # end
FortiGate-60E # show firewall policy
config firewall policy
edit 1
set name "mypolicy_changed"
set uuid 440987a2-31b2-51ee-8cb0-aa0abd211220
set srcintf "internal"
set dstintf "wan1"
set action accept
set srcaddr "myaddress"
set dstaddr "all"
set schedule "always"
set service "myservice"
set nat enable
next
end
FortiGate-60E #
使用中のオブジェクトの名前の変更と影響
例えば、ファイアウォールポリシーで使用中のオブジェクトの名前を変更した場合、当該ファイアウォールポリシーの設定はどうなるのでしょうか。
以下のファイアウォールポリシーを考えます。
config firewall policy
edit 1
set name "mypolicy"
set uuid 440987a2-31b2-51ee-8cb0-aa0abd211220
set srcintf "internal"
set dstintf "wan1"
set action accept
set srcaddr "myaddress"
set dstaddr "all"
set schedule "always"
set service "myservice"
set nat enable
next
end
srcaddr
で使用されているアドレスオブジェクト myaddress
の名前を変更してみます。
FortiGate-60E # config firewall address
FortiGate-60E (address) # rename myaddress to myaddress_changed
FortiGate-60E (address) # end
FortiGate-60E # show firewall policy
config firewall policy
edit 1
set name "mypolicy"
set uuid 440987a2-31b2-51ee-8cb0-aa0abd211220
set srcintf "internal"
set dstintf "wan1"
set action accept
set srcaddr "myaddress_changed"
set dstaddr "all"
set schedule "always"
set service "myservice"
set nat enable
next
end
FortiGate-60E #
上の通り、アドレスオブジェクトの名前を変更するとファイアウォールポリシーで設定されているアドレスオブジェクトの名前も変わりました。
続いて service
で使用されているサービスオブジェクト myservice
の名前も変更してみます。
FortiGate-60E # config firewall service custom
FortiGate-60E (custom) # rename myservice to myservice_changed
FortiGate-60E (custom) # end
FortiGate-60E # show firewall policy
config firewall policy
edit 1
set name "mypolicy"
set uuid 440987a2-31b2-51ee-8cb0-aa0abd211220
set srcintf "internal"
set dstintf "wan1"
set action accept
set srcaddr "myaddress_changed"
set dstaddr "all"
set schedule "always"
set service "myservice_changed"
set nat enable
next
end
FortiGate-60E #
上の通り、サービスオブジェクトの名前を変更するとファイアウォールポリシーで設定されているサービスオブジェクトの名前も変わりました。
以上の結果から、ファイアウォールポリシーで使用されているアドレス及びサービスの名前を変更した場合はファイアウォールポリシーの設定も自動で変わるため、これらのオブジェクトの名前変更後にファイアウォールポリシーの設定を修正する必要は無いと言えます。