database_attribute: Deliver/create index.txt.attr

Fixes #11904

Since OpenSSL-1.1.0x the database attribute file for IPSec and OpenVPN wasn´t created while initial PKI generation.
OpenVPN delivered an error message but IPSec did crashed within the first attempt.
This problem persists also after X509 deletion and new generation.

index.txt.attr will now be delivered by the system but also deleted and recreated while setting up a new x509.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Erik Kapfer
2019-01-03 03:57:16 +01:00
committed by Michael Tremer
parent 4c83d9fbdc
commit e6f7f8e7ba
6 changed files with 21 additions and 1 deletions

View File

@@ -174,7 +174,12 @@ sub cleanssldatabase
print FILE "";
close FILE;
}
if (open(FILE, ">${General::swroot}/ovpn/certs/index.txt.attr")) {
print FILE "";
close FILE;
}
unlink ("${General::swroot}/ovpn/certs/index.txt.old");
unlink ("${General::swroot}/ovpn/certs/index.txt.attr.old");
unlink ("${General::swroot}/ovpn/certs/serial.old");
unlink ("${General::swroot}/ovpn/certs/01.pem");
}
@@ -189,7 +194,11 @@ sub newcleanssldatabase
if (! -s ">${General::swroot}/ovpn/certs/index.txt") {
system ("touch ${General::swroot}/ovpn/certs/index.txt");
}
if (! -s ">${General::swroot}/ovpn/certs/index.txt.attr") {
system ("touch ${General::swroot}/ovpn/certs/index.txt.attr");
}
unlink ("${General::swroot}/ovpn/certs/index.txt.old");
unlink ("${General::swroot}/ovpn/certs/index.txt.attr.old");
unlink ("${General::swroot}/ovpn/certs/serial.old");
}

View File

@@ -149,7 +149,12 @@ sub cleanssldatabase {
print FILE "";
close FILE;
}
if (open(FILE, ">${General::swroot}/certs/index.txt.attr")) {
print FILE "";
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");
}
@@ -162,7 +167,11 @@ sub newcleanssldatabase {
if (! -s ">${General::swroot}/certs/index.txt") {
system ("touch ${General::swroot}/certs/index.txt");
}
if (! -s ">${General::swroot}/certs/index.txt.attr") {
system ("touch ${General::swroot}/certs/index.txt.attr");
}
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
}