{"id":114,"date":"2025-02-12T15:37:39","date_gmt":"2025-02-12T14:37:39","guid":{"rendered":"https:\/\/pprzybyla.com\/blog\/?p=114"},"modified":"2025-02-12T15:37:39","modified_gmt":"2025-02-12T14:37:39","slug":"fortigate-cli-automatically-revert-to-a-previous-configuration","status":"publish","type":"post","link":"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/","title":{"rendered":"FortiGate CLI &#8211; Automatically revert to a previous configuration"},"content":{"rendered":"\n<p>Today I&#8217;d like to talk about the security switch that Fortigate has for us when we change its configuration and something goes wrong. Most vendors have that &#8211; Juniper has a commit confirmed , Cisco routers have a reload in, Aruba checkpoint auto and Fortinet has one too &#8211; cfg-save.<\/p>\n\n\n\n<p>cfg-save is global setting, to use this feature, simply change cfg-save from automatic to revert before making risky changes.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"427\" height=\"64\" src=\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-17.png\" alt=\"\" class=\"wp-image-115\" srcset=\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-17.png 427w, https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-17-300x45.png 300w\" sizes=\"auto, (max-width: 427px) 100vw, 427px\" \/><\/figure>\n\n\n\n<p>After changing this setting, any configuration change made in the CLI or GUI will take effect immediately (as usual), but will be REVERTED if you don&#8217;t save the change manually, and the session will expire. The timeout can also be set with set cfg-revert-timeout .<\/p>\n\n\n\n<p>When restoring changes after a timeout, Fortigate will reload the saved configuration, which means it will not restart, but there will still be a disconnection of all passing sessions. So this configuration restore operation will result in a very short downtime, in my experience &#8211; less than a minute if you use BGP with default timers and no BFD it will take a little more.<\/p>\n\n\n\n<p>Config is simple:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"828\" height=\"261\" src=\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-18.png\" alt=\"\" class=\"wp-image-116\" srcset=\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-18.png 828w, https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-18-300x95.png 300w, https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-18-768x242.png 768w, https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-18-660x208.png 660w\" sizes=\"auto, (max-width: 828px) 100vw, 828px\" \/><\/figure>\n\n\n\n<p>If the changes you made block access to Fortigate and you can&#8217;t reconnect, just wait 5 minutes and the changes you made will be restored.<\/p>\n\n\n\n<p>If, on the other hand, you have made changes and nothing bad has happened &#8211; do not log out\/leave Fortigate. In order for the changes not to be restored 5 minutes after logging out, you need to manually save\/confirm them in the configuration file. This can be done on cli:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"448\" height=\"267\" src=\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-19.png\" alt=\"\" class=\"wp-image-117\" srcset=\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-19.png 448w, https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-19-300x179.png 300w\" sizes=\"auto, (max-width: 448px) 100vw, 448px\" \/><\/figure>\n\n\n\n<p>Or the GUI in newer versions of FortiOS:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"545\" height=\"275\" src=\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-20.png\" alt=\"\" class=\"wp-image-118\" srcset=\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-20.png 545w, https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-20-300x151.png 300w\" sizes=\"auto, (max-width: 545px) 100vw, 545px\" \/><\/figure>\n\n\n\n<p>You can also turn on\/off this features on GUI in Settings tab<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"811\" height=\"147\" src=\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-21.png\" alt=\"\" class=\"wp-image-119\" srcset=\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-21.png 811w, https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-21-300x54.png 300w, https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-21-768x139.png 768w, https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/image-21-660x120.png 660w\" sizes=\"auto, (max-width: 811px) 100vw, 811px\" \/><\/figure>\n\n\n\n<p>Workspace\/workflow GUI is available from FortiOS 7.0 onwards<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I&#8217;d like to talk about the security switch that Fortigate has for us when we change its configuration and something goes wrong. Most vendors have that &#8211; Juniper has a commit confirmed , Cisco routers have a reload in, Aruba checkpoint auto and Fortinet has one too &#8211; cfg-save. cfg-save is global setting, to\u2026 <span class=\"read-more\"><a href=\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":120,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-114","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fortigate"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>FortiGate CLI - Automatically revert to a previous configuration - Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FortiGate CLI - Automatically revert to a previous configuration - Blog\" \/>\n<meta property=\"og:description\" content=\"Today I&#8217;d like to talk about the security switch that Fortigate has for us when we change its configuration and something goes wrong. Most vendors have that &#8211; Juniper has a commit confirmed , Cisco routers have a reload in, Aruba checkpoint auto and Fortinet has one too &#8211; cfg-save. cfg-save is global setting, to\u2026 Read More &raquo;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-12T14:37:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/Zrzut-ekranu-2024-12-06-081847.png\" \/>\n\t<meta property=\"og:image:width\" content=\"634\" \/>\n\t<meta property=\"og:image:height\" content=\"415\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"http:\/\/pprzybyla.com\/blog\/#\/schema\/person\/78e3f329b514e87d4b8591f2e797b558\"},\"headline\":\"FortiGate CLI &#8211; Automatically revert to a previous configuration\",\"datePublished\":\"2025-02-12T14:37:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/\"},\"wordCount\":293,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/pprzybyla.com\/blog\/#\/schema\/person\/78e3f329b514e87d4b8591f2e797b558\"},\"image\":{\"@id\":\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/Zrzut-ekranu-2024-12-06-081847.png\",\"articleSection\":[\"Fortigate\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/\",\"url\":\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/\",\"name\":\"FortiGate CLI - Automatically revert to a previous configuration - Blog\",\"isPartOf\":{\"@id\":\"http:\/\/pprzybyla.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/Zrzut-ekranu-2024-12-06-081847.png\",\"datePublished\":\"2025-02-12T14:37:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#primaryimage\",\"url\":\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/Zrzut-ekranu-2024-12-06-081847.png\",\"contentUrl\":\"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/Zrzut-ekranu-2024-12-06-081847.png\",\"width\":634,\"height\":415},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/pprzybyla.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FortiGate CLI &#8211; Automatically revert to a previous configuration\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/pprzybyla.com\/blog\/#website\",\"url\":\"http:\/\/pprzybyla.com\/blog\/\",\"name\":\"Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"http:\/\/pprzybyla.com\/blog\/#\/schema\/person\/78e3f329b514e87d4b8591f2e797b558\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/pprzybyla.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/pprzybyla.com\/blog\/#\/schema\/person\/78e3f329b514e87d4b8591f2e797b558\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/pprzybyla.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/my-photo-url.jpg\",\"contentUrl\":\"http:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/my-photo-url.jpg\",\"width\":800,\"height\":800,\"caption\":\"admin\"},\"logo\":{\"@id\":\"http:\/\/pprzybyla.com\/blog\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/pprzybyla.com\/blog\"],\"url\":\"https:\/\/pprzybyla.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"FortiGate CLI - Automatically revert to a previous configuration - Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/","og_locale":"en_US","og_type":"article","og_title":"FortiGate CLI - Automatically revert to a previous configuration - Blog","og_description":"Today I&#8217;d like to talk about the security switch that Fortigate has for us when we change its configuration and something goes wrong. Most vendors have that &#8211; Juniper has a commit confirmed , Cisco routers have a reload in, Aruba checkpoint auto and Fortinet has one too &#8211; cfg-save. cfg-save is global setting, to\u2026 Read More &raquo;","og_url":"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/","og_site_name":"Blog","article_published_time":"2025-02-12T14:37:39+00:00","og_image":[{"width":634,"height":415,"url":"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/Zrzut-ekranu-2024-12-06-081847.png","type":"image\/png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#article","isPartOf":{"@id":"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/"},"author":{"name":"admin","@id":"http:\/\/pprzybyla.com\/blog\/#\/schema\/person\/78e3f329b514e87d4b8591f2e797b558"},"headline":"FortiGate CLI &#8211; Automatically revert to a previous configuration","datePublished":"2025-02-12T14:37:39+00:00","mainEntityOfPage":{"@id":"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/"},"wordCount":293,"commentCount":0,"publisher":{"@id":"http:\/\/pprzybyla.com\/blog\/#\/schema\/person\/78e3f329b514e87d4b8591f2e797b558"},"image":{"@id":"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#primaryimage"},"thumbnailUrl":"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/Zrzut-ekranu-2024-12-06-081847.png","articleSection":["Fortigate"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/","url":"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/","name":"FortiGate CLI - Automatically revert to a previous configuration - Blog","isPartOf":{"@id":"http:\/\/pprzybyla.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#primaryimage"},"image":{"@id":"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#primaryimage"},"thumbnailUrl":"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/Zrzut-ekranu-2024-12-06-081847.png","datePublished":"2025-02-12T14:37:39+00:00","breadcrumb":{"@id":"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#primaryimage","url":"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/Zrzut-ekranu-2024-12-06-081847.png","contentUrl":"https:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/Zrzut-ekranu-2024-12-06-081847.png","width":634,"height":415},{"@type":"BreadcrumbList","@id":"https:\/\/pprzybyla.com\/blog\/fortigate-cli-automatically-revert-to-a-previous-configuration\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/pprzybyla.com\/blog\/"},{"@type":"ListItem","position":2,"name":"FortiGate CLI &#8211; Automatically revert to a previous configuration"}]},{"@type":"WebSite","@id":"http:\/\/pprzybyla.com\/blog\/#website","url":"http:\/\/pprzybyla.com\/blog\/","name":"Blog","description":"","publisher":{"@id":"http:\/\/pprzybyla.com\/blog\/#\/schema\/person\/78e3f329b514e87d4b8591f2e797b558"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/pprzybyla.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"http:\/\/pprzybyla.com\/blog\/#\/schema\/person\/78e3f329b514e87d4b8591f2e797b558","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/pprzybyla.com\/blog\/#\/schema\/person\/image\/","url":"http:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/my-photo-url.jpg","contentUrl":"http:\/\/pprzybyla.com\/blog\/wp-content\/uploads\/2025\/02\/my-photo-url.jpg","width":800,"height":800,"caption":"admin"},"logo":{"@id":"http:\/\/pprzybyla.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/pprzybyla.com\/blog"],"url":"https:\/\/pprzybyla.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/pprzybyla.com\/blog\/wp-json\/wp\/v2\/posts\/114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pprzybyla.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pprzybyla.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pprzybyla.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pprzybyla.com\/blog\/wp-json\/wp\/v2\/comments?post=114"}],"version-history":[{"count":1,"href":"https:\/\/pprzybyla.com\/blog\/wp-json\/wp\/v2\/posts\/114\/revisions"}],"predecessor-version":[{"id":121,"href":"https:\/\/pprzybyla.com\/blog\/wp-json\/wp\/v2\/posts\/114\/revisions\/121"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pprzybyla.com\/blog\/wp-json\/wp\/v2\/media\/120"}],"wp:attachment":[{"href":"https:\/\/pprzybyla.com\/blog\/wp-json\/wp\/v2\/media?parent=114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pprzybyla.com\/blog\/wp-json\/wp\/v2\/categories?post=114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pprzybyla.com\/blog\/wp-json\/wp\/v2\/tags?post=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}