Added ca config file creation from template and small bugfix
This commit is contained in:
parent
a797cda27c
commit
1b49cf92c0
30
lib/CA.pm
30
lib/CA.pm
|
@ -949,6 +949,25 @@ sub create_ca_env {
|
|||
}
|
||||
close(OUT);
|
||||
|
||||
# create ca config file based on template
|
||||
$in = $self->{'init'}->{'templatedir'}."/tinyca.cnf";
|
||||
$out = $self->{$opts->{'name'}}->{'dir'}."/tinyca.cnf";
|
||||
open(IN, "<$in") || do {
|
||||
$t = sprintf(_("Can't open config template file %s %s"), $in, $!);
|
||||
GUI::HELPERS::print_error($t);
|
||||
return;
|
||||
};
|
||||
open(OUT, ">$out") || do {
|
||||
$t = sprintf(_("Can't open config output file: %s: %s"),$out, $!);
|
||||
GUI::HELPERS::print_error($t);
|
||||
return;
|
||||
};
|
||||
while(<IN>) {
|
||||
print OUT;
|
||||
}
|
||||
close(IN);
|
||||
close(OUT);
|
||||
|
||||
if(defined($mode) && $mode eq "sub") {
|
||||
$self->create_ca($main, $opts, undef, $mode);
|
||||
} elsif(defined($mode) && $mode eq "import") {
|
||||
|
@ -1386,7 +1405,7 @@ sub export_crl {
|
|||
sub _rm_dir {
|
||||
my $dir = shift;
|
||||
|
||||
my $dirh;
|
||||
my ($dirh, $path);
|
||||
|
||||
opendir($dirh, $dir);
|
||||
|
||||
|
@ -1394,13 +1413,14 @@ sub _rm_dir {
|
|||
next if $f eq '.';
|
||||
next if $f eq '..';
|
||||
|
||||
if(-d $dir."/".$f) {
|
||||
_rm_dir($dir."/".$f);
|
||||
$path = $dir."/".$f;
|
||||
if(-d $path) {
|
||||
_rm_dir($path);
|
||||
} else {
|
||||
unlink($dir."/".$f);
|
||||
unlink($path);
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
closedir($dirh);
|
||||
|
||||
rmdir($dir);
|
||||
|
||||
|
|
|
@ -2731,7 +2731,7 @@ sub about {
|
|||
}
|
||||
|
||||
#
|
||||
# get confirmation for deleting a request
|
||||
# get confirmation for deleting a request, cert or key
|
||||
#
|
||||
sub show_del_confirm {
|
||||
my ($self, $file, $type) = @_;
|
||||
|
|
|
@ -452,6 +452,7 @@ sub _check_key {
|
|||
return;
|
||||
};
|
||||
|
||||
$type = "#ERR";
|
||||
while(<KEY>) {
|
||||
if(/RSA PRIVATE KEY/i) {
|
||||
$type = "RSA";
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
[global]
|
||||
use_metadb = no
|
||||
default_req_type = user
|
||||
default_domain = example.com
|
||||
|
||||
[server]
|
||||
default_bits = 4096
|
||||
|
||||
[user]
|
||||
default_bits = 2048
|
Loading…
Reference in New Issue