Skip to content

Commit

Permalink
Update pki-server ca-cert-import
Browse files Browse the repository at this point in the history
The pki-server ca-cert-import has been updated to support
an absolute profile path.
  • Loading branch information
edewata committed Jan 15, 2024
1 parent 1664b4f commit 53dac22
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.SecureRandom;

Expand Down Expand Up @@ -105,8 +106,6 @@ public void execute(CommandLine cmd) throws Exception {
throw new Exception("Missing profile ID");
}

String profileID = cmd.getOptionValue("profile");

// initialize JSS in pki-server CLI
TomcatJSS tomcatjss = TomcatJSS.getInstance();
tomcatjss.loadConfig();
Expand Down Expand Up @@ -147,10 +146,14 @@ public void execute(CommandLine cmd) throws Exception {
CAEngineConfig cs = new CAEngineConfig(storage);
cs.load();

String profilePath = confDir + File.separator + profileID;
// If the profile path is relative (e.g. caCert.profile),
// convert it to /var/lib/pki/pki-tomcat/ca/conf/<profile>
// If the profile path is absolute, use it as is.
String profile = cmd.getOptionValue("profile");
Path profilePath = Paths.get(confDir).resolve(profile);

logger.info("Loading " + profilePath);
ConfigStorage profileStorage = new FileConfigStorage(profilePath);
ConfigStorage profileStorage = new FileConfigStorage(profilePath.toString());
ConfigStore profileConfig = new ConfigStore(profileStorage);
profileConfig.load();

Expand Down

0 comments on commit 53dac22

Please sign in to comment.