zerohop/blog

$ cat spark-config-converter.md · 20 Nov 2026 · 3 min read

Replacing small firewalls: from running config to install script

#checkpoint#spark#python#automation

A hardware refresh of small branch firewalls sounds easy. New box, same configuration, done. Until you count: per site a handful of LAN ports, a stack of VLANs, DHCP scopes and relays, two internet connections, local admins. Multiply by the number of sites, and every one of those lines is a chance to type a mask wrong.

The Check Point Quantum Spark appliances make this easier than most: show configuration prints the whole running config as CLI commands. So the old box already tells you what the new one needs. It just needs reshaping.

What the script does

It reads the saved show configuration output of the old gateway and writes <host>_new.conf: a script to paste on the replacement, in the order you actually do the install.

bashpython3 spark_convert.py BRANCH-FW01.txt              # one gateway
python3 spark_convert.py configs/ -o new/             # a whole folder

The output has four parts, matching the steps on site:

  1. Zero touch. Administrators, every LAN and VLAN interface with its IP, description and DHCP settings, the second internet connection, the cluster kernel parameters, the license fetch.
  2. Agent installer. The installer line with its token.
  3. When the firewall is online. SD-WAN settings, DNS, central management, SIC and fetching the policy.
  4. When SIC is OK. Only then the primary internet connection moves to its static IP, so you never cut the line you're working over.

Take what belongs to the box, leave the rest

The important decision is what not to copy. The rule base, objects, VPN and HTTPS inspection come from the central management server. Copying them locally would only create a second truth. So the script takes the things that belong to the appliance itself, and nothing else:

textset interface "LAN2" ipv4-address 192.0.2.1 subnet-mask 255.255.255.0
set interface "LAN2.20" ipv4-address 198.51.100.1 subnet-mask 255.255.255.0

becomes

textset interface "LAN2" ipv4-address 192.0.2.1 subnet-mask 255.255.255.0
set interface "LAN2" state on
add interface "LAN2" vlan "20"
set interface "LAN2.20" ipv4-address 198.51.100.1 subnet-mask 255.255.255.0

A few small rules like that make the difference between a script that pastes cleanly and one that stops at line 40:

The script never connects to a gateway. It reads text files and writes text files, so it can run anywhere, and the output can be reviewed before anyone is on site.

Rebuilding a lost script

The funny part: this script existed before. The first sites were converted with an earlier version, and then that script was gone. What was left were its outputs.

That turned out to be a decent specification. The rebuilt version had one hard requirement: for the same input it must produce the same layout as the files that were already used on site. Same sections, same order, same comments. The engineers doing the installs know that layout; a "better" one would only slow them down.

What I took from it

← all posts