Correction #13494


Documentation on decryption of encrypted config.xml files is not correct

Added by Dennis Adler 3 months ago. Updated 2 months ago.

Backup / Restore
Target version:
Start date:
Due date:
% Done:


Estimated time:


The information listed in the pfSense online manual at, which was changed in response to a previous bug ( -- hence the regression tag) does not allow me to decrypt newer backup files. The online manual references v2.5.0 (CE?); I tested this against 22.05 but suspect it impacts every version that uses the more secure password hashing algorithm for encrypting backups.

For all of the details, please see the TAC ticket I'm just listing the doc fixes in this bug.

First, it is not necessary to use grep to strip the BEGIN or END lines, nor is it necessary to base64 decode the file first. OpenSSL, at least as of v1.1.1, is quite happy to deal with these files as-is if you simply add "-a" to the decryption switch set. If you really want to lean things down, according to other online sources I read, you can do away with "-salt" as that is automatically added (though I DID NOT verify that)

The pre-2.5.0 decryption can happen with a single command. Using Windows CMD file format, the line would be:

openssl enc -d -a -aes-256-cbc -md md5 -in %1 -out %2

Where %1 is the input file (encrypted, base64 format) and %2 is the desired output file.

For 2.5.0 and later, this changes slightly:

openssl enc -d -aes-256-cbc -salt -md sha256 -pbkdf2 -salt -iter 500000 -a -in %1 -out %2

Same arguments as the pre-2.5.0 version. Again, you may be able to remove the -salt argument; further according to OpenSSL documents, -iter forces -pbkdf2. It does not hurt to leave these there though.

I have tested the pre-2.5.0 command on some older, pre 2.5 SG-3100 files and it works as expected. I had to search the GitHub sources (specifically, to learn the iteration count. Without the same iteration count, the password string supplied will not decrypt the file, whether or not the password supplied is the same one that works in the GUI.

This has been an on-going discussion on Netgate forums, e.g. see Both the support tech on my TAC ticket and RColeman (a Netgate admin on the form) asked me to submit this via Redmine... so here it is.

If I may be so bold: you might want to add commends to noting these doc pages need to be changed anytime the algorithm or password handling (like iterations) change. I am curious, if you would care to share, how pfSense decides which method to use; do you simply try decrypting with the old pw style and then the new, to see what happens?

Please note I did not test this on my SG-5100 (i.e. did not run this using Diagnostics / Command Prompt or with the serial console and shell. I would hope that OpenSSL behaves the same on Windows as FreeBSD, so you may want to test this decryption in your lab on a pfSense install to be sure it has the same behavior.


Actions #1

Updated by Dennis Adler 3 months ago

Dennis Adler wrote:

If I may be so bold: you might want to add commends to noting...

"commends" should be "comments"

Actions #2

Updated by Steve Wheeler 3 months ago

  • Tracker changed from Regression to Correction
  • Project changed from pfSense Plus to pfSense Docs
  • Category changed from Backup / Restore to Backup / Restore
  • Priority changed from High to Normal
  • Release Notes deleted (Default)
  • Affected Plus Version deleted (22.05)
  • Affected Architecture deleted (All)
Actions #3

Updated by Jim Pingle 3 months ago

  • Status changed from New to In Progress
  • Assignee set to Jim Pingle
Actions #4

Updated by Jim Pingle 3 months ago

  • Status changed from In Progress to Feedback
  • % Done changed from 0 to 100

I updated the docs with newer syntax. I used the -a bit but kept the other parameters the same as they are in since that is exactly what is used by the firewall when performing these operations.

(Internal repo link)

The docs having the syntax is just for convenience, now that we have a script on the firewall to decrypt configurations in the shell using the same method the GUI uses, people won't need to worry about the exact syntax.

The backend code tries the newest method, if that fails, it tries the next one, and so on automatically.

Actions #5

Updated by Chris W 2 months ago

Using the commands in the commit, I successfully decrypted the encrypted configuration files (PowerShell in Windows 10 and Gnome Terminal in Ubuntu 20.04) created with pfSense CE 2.5.1, 2.6, and 2.7 (build date Sep 22 18:30:19). I then imported the config into pfSense and it rebooted into that configuration with no problem.

Actions #6

Updated by Jim Pingle 2 months ago

  • Status changed from Feedback to Resolved

Also available in: Atom PDF