add download link for rootCA.crt, bugfix

This commit is contained in:
OttoMao
2014-11-06 13:55:43 +08:00
parent f685d82dd9
commit 0db6b1861a
6 changed files with 34 additions and 5 deletions

View File

@@ -72,7 +72,7 @@ function checkRootCA(){
if(!isRootCAFileExists()){
console.log(color.red("can not find rootCA.crt or rootCA.key"));
console.log(color.red("you may generate one by the following methods"));
console.log(color.red("\twhen using globally : sudo anyproxy --root"));
console.log(color.red("\twhen using globally : anyproxy --root"));
console.log(color.red("\twhen using as a module : require(\"anyproxy\").generateRootCA();"));
process.exit(0);
}
@@ -110,6 +110,7 @@ function generateRootCA(){
if(code == 0){
console.log(color.green("rootCA generated"));
console.log(color.green(color.bold("please trust the rootCA.crt in " + certDir)));
console.log(color.green(color.bold("or you may get it via anyproxy webinterface")));
process.exit(0);
}else{
console.log(color.red("fail to generate root CA"));
@@ -120,6 +121,16 @@ function generateRootCA(){
}
}
function getRootCAFilePath(){
if(isRootCAFileExists()){
return path.join(certDir,"rootCA.crt");
}else{
return "";
}
}
module.exports.getRootCAFilePath = getRootCAFilePath;
module.exports.generateRootCA = generateRootCA;
module.exports.getCertificate = getCertificate;
module.exports.createCert = createCert;