I’ve never worked on a Sonicwall firewall, but we’ll be gaining one shortly. This weekend, we’re moving a data center from Vermont to PA and incorporating it into our existing data center. We have very little documentation — none really. So we don’t know the traffic requirements for the data center we are inheriting. The natural place to look for clues to traffic flow is the firewall rules.
We obtained a Sonicwall export file, but it was only Gobbledygook (base64 encoded).
Here are the steps taken to convert it
1. First decode it. There are dozens of ways to solve this problem. I chose to write the world’s shortest python program:
After decoding, the Gobbledygook is replaced with plain text, but it’s all on a single line (no line feeds in the file).
2. To add line feeds (again there are dozens of ways to accomplish this), I used ‘sed’ on a Linux box. First WinSCP the file to the Linux machine (if your desktop isn’t Linux), then run this command to insert a line feed before every “&” character:
sed -i ‘s/&/\n&/g’ sonicwall.txt
You can adjust this to insert the line feed somewhere else – if you know more about Sonicwall rules than I, you probably have a better specific solution. This just gives you the general idea.
The resulting file is now easier to read in Linux, but Windows will still show it all on one line (oops). We need to add a carriage return AND line feed (known as end-of-line, or EOL) for Windows to display properly. Try this instead of the command above, if you need to display the file in Windows:
sed -i ‘s/&/\r\n&/g’ sonicwall.txt
Now you should have a somewhat-formatted firewall configuration that can be used to determine traffic flow, if you find yourself sharing the misfortune of rebuilding a network you know nothing about. It’s still not pretty, but it’s better than nothing.