Captive Portal Vouchers feature is broken in 2.5.0
When enabling vouchers on 2.5.0, fields "Voucher Public Key" and "Voucher Private Key" are empty, and clicking on "Generate new keys" has no effect.
The error seems to come from OpenSSL v1.1.1 that now prevent an RSA key under 512 bits to be generated :
The C++ constant preventing RSA keys to be generated is defined here : https://github.com/pfsense/FreeBSD-src/blob/RELENG_2_5/crypto/openssl/crypto/rsa/rsa_locl.h#L14
#1 Updated by A FL about 2 years ago
The change has been made in OpenSSL here : https://github.com/openssl/openssl/commit/cac19d19e7d6f252ff9aea60d85e0c0fd71a117f
#2 Updated by Jim Pingle about 2 years ago
- Assignee set to Renato Botelho
Rather than patching OpenSSL, we could use a pure PHP implementation of RSA to generate the voucher keys:
include_once('Crypt/RSA.php'); $rsa = new Crypt_RSA(); $key = $rsa->createKey(64); $private_key = $key["privatekey"]; $public_key = $key["publickey"];
Similar to what we did for x509 CRLs for PHP 7.x.
The code above works with the files from that library copied to the host and with the directory it's in added to the PHP include path. The contents of the generated public and private keys are in the correct format.
We'd need to make a port for it, but that still seems like a better idea than patching OpenSSL.
Once the port is in place we can update the code to use it.