###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
+# Copyright (C) 2007-2025 IPFire Team <info@ipfire.org> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
unlink ("${General::swroot}/certs/index.txt.old");
unlink ("${General::swroot}/certs/index.txt.attr.old");
unlink ("${General::swroot}/certs/serial.old");
- unlink ("${General::swroot}/certs/01.pem");
-}
-sub newcleanssldatabase {
- if (! -s "${General::swroot}/certs/serial" ) {
- open(FILE, ">${General::swroot}/certs/serial");
- print FILE "01";
- close FILE;
- }
- if (! -s ">${General::swroot}/certs/index.txt") {
- open(FILE, ">${General::swroot}/certs/index.txt");
- close(FILE);
- }
- if (! -s ">${General::swroot}/certs/index.txt.attr") {
- open(FILE, ">${General::swroot}/certs/index.txt.attr");
- print FILE "unique_subject = yes";
- close(FILE);
- }
- unlink ("${General::swroot}/certs/index.txt.old");
- unlink ("${General::swroot}/certs/index.txt.attr.old");
- unlink ("${General::swroot}/certs/serial.old");
-# unlink ("${General::swroot}/certs/01.pem"); numbering evolves. Wrong place to delete
}
###
} elsif ($cgiparams{'ACTION'} eq $Lang::tr{'generate root/host certificates'} ||
$cgiparams{'ACTION'} eq $Lang::tr{'upload p12 file'}) {
- &newcleanssldatabase();
-
if (-f "${General::swroot}/ca/cacert.pem") {
$errormessage = $Lang::tr{'valid root certificate already exists'};
goto ROOTCERT_SKIP;
# IPFire can only import certificates
&General::log("charon", "p12 import completed!");
- &cleanssldatabase();
goto ROOTCERT_SUCCESS;
} elsif ($cgiparams{'ROOTCERT_COUNTRY'} ne '') {
# Successfully build CA / CERT!
if (!$errormessage) {
- &cleanssldatabase();
goto ROOTCERT_SUCCESS;
}
if ( $errormessage = &callssl ($opt) ) {
unlink ($filename);
unlink ("${General::swroot}/certs/$cgiparams{'NAME'}cert.pem");
- &cleanssldatabase();
goto VPNCONF_ERROR;
} else {
unlink ($filename);
- &cleanssldatabase();
}
$cgiparams{'CERT_NAME'} = getCNfromcert ("${General::swroot}/certs/$cgiparams{'NAME'}cert.pem");
} else {
unlink ($v3extname);
unlink ("${General::swroot}/certs/$cgiparams{'NAME'}req.pem");
- &cleanssldatabase();
}
# Create the pkcs12 file