Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

If certificate already exists, use it for Web GUI #2

Open
Jay2k1 opened this issue Oct 29, 2019 · 0 comments
Open

If certificate already exists, use it for Web GUI #2

Jay2k1 opened this issue Oct 29, 2019 · 0 comments

Comments

@Jay2k1
Copy link

Jay2k1 commented Oct 29, 2019

Currently, the script exits if it finds the given certificate in the existing config. By adding

                if ($config['system']['webgui']['ssl-certref'] != $existing_cert['refid']) {
                        echo "Activating cert for WebGUI...\r\n";
                        $config['system']['webgui']['ssl-certref'] = $existing_cert['refid'];
                        write_config();
                        log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
                        send_event("service restart webgui");
                }

before the die() in line 78 in this block:

foreach ($a_cert as $existing_cert) {
if ($existing_cert['crt'] === $cert['crt']) {
echo "The certificate is already imported.\r\n";
die(); // exit with a valid error code, as this is intended behaviour
}
...it can be activated nonetheless.

Why is this useful? Well, if you have a PFsense cluster and add a new certificate on the master, it will be copied to the slave, but it won't be set as Web GUI certificate there. So your script currently will just die on the slave, but it should activate the cert there even when it already exists (but is not yet set as Web GUI cert).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant