mirror of
https://github.com/znc/znc.git
synced 2026-07-31 05:53:38 +02:00
Remove znc --encrypt-pem
ZNC can't read encrypted pem files, so it's kinda pointless that it can generate those... git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1495 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -36,7 +36,7 @@ CUtils::CUtils() {}
|
||||
CUtils::~CUtils() {}
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
void CUtils::GenerateCert(FILE *pOut, bool bEncPrivKey, const CString& sHost) {
|
||||
void CUtils::GenerateCert(FILE *pOut, const CString& sHost) {
|
||||
EVP_PKEY *pKey = NULL;
|
||||
X509 *pCert = NULL;
|
||||
X509_NAME *pName = NULL;
|
||||
@@ -52,7 +52,7 @@ void CUtils::GenerateCert(FILE *pOut, bool bEncPrivKey, const CString& sHost) {
|
||||
return;
|
||||
}
|
||||
|
||||
PEM_write_RSAPrivateKey(pOut, pRSA, (bEncPrivKey ? EVP_des_ede3_cbc() : NULL), NULL, 0, NULL, NULL);
|
||||
PEM_write_RSAPrivateKey(pOut, pRSA, NULL, NULL, 0, NULL, NULL);
|
||||
|
||||
if (!(pCert = X509_new())) {
|
||||
EVP_PKEY_free(pKey);
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
return iTime;
|
||||
}
|
||||
#ifdef HAVE_LIBSSL
|
||||
static void GenerateCert(FILE *pOut, bool bEncPrivKey = false, const CString& sHost = "");
|
||||
static void GenerateCert(FILE *pOut, const CString& sHost = "");
|
||||
#endif /* HAVE_LIBSSL */
|
||||
|
||||
private:
|
||||
|
||||
@@ -20,7 +20,6 @@ static const struct option g_LongOpts[] = {
|
||||
{ "makepass", no_argument, 0, 's' },
|
||||
#ifdef HAVE_LIBSSL
|
||||
{ "makepem", no_argument, 0, 'p' },
|
||||
{ "encrypt-pem", no_argument, 0, 'e' },
|
||||
#endif /* HAVE_LIBSSL */
|
||||
{ "datadir", required_argument, 0, 'd' },
|
||||
{ 0, 0, 0, 0 }
|
||||
@@ -39,7 +38,6 @@ static void GenerateHelp(const char *appname) {
|
||||
CUtils::PrintMessage("\t-s, --makepass Generates a password for use in config");
|
||||
#ifdef HAVE_LIBSSL
|
||||
CUtils::PrintMessage("\t-p, --makepem Generates a pemfile for use with SSL");
|
||||
CUtils::PrintMessage("\t-e, --encrypt-pem when used along with --makepem, encrypts the private key in the pemfile");
|
||||
#endif /* HAVE_LIBSSL */
|
||||
CUtils::PrintMessage("\t-d, --datadir Set a different znc repository (default is ~/.znc)");
|
||||
}
|
||||
@@ -88,9 +86,8 @@ int main(int argc, char** argv) {
|
||||
#endif
|
||||
#ifdef HAVE_LIBSSL
|
||||
bool bMakePem = false;
|
||||
bool bEncPem = false;
|
||||
|
||||
while ((iArg = getopt_long(argc, argv, "hvnrcsped:Df", g_LongOpts, &iOptIndex)) != -1) {
|
||||
while ((iArg = getopt_long(argc, argv, "hvnrcspd:Df", g_LongOpts, &iOptIndex)) != -1) {
|
||||
#else
|
||||
while ((iArg = getopt_long(argc, argv, "hvnrcsd:Df", g_LongOpts, &iOptIndex)) != -1) {
|
||||
#endif /* HAVE_LIBSSL */
|
||||
@@ -117,9 +114,6 @@ int main(int argc, char** argv) {
|
||||
case 'p':
|
||||
bMakePem = true;
|
||||
break;
|
||||
case 'e':
|
||||
bEncPem = true;
|
||||
break;
|
||||
#endif /* HAVE_LIBSSL */
|
||||
case 'd':
|
||||
sDataDir = CString(optarg);
|
||||
@@ -147,17 +141,11 @@ int main(int argc, char** argv) {
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
if (bMakePem) {
|
||||
pZNC->WritePemFile(bEncPem);
|
||||
pZNC->WritePemFile();
|
||||
|
||||
delete pZNC;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bEncPem && !bMakePem) {
|
||||
CUtils::PrintError("--encrypt-pem should be used along with --makepem.");
|
||||
delete pZNC;
|
||||
return 1;
|
||||
}
|
||||
#endif /* HAVE_LIBSSL */
|
||||
|
||||
if (bMakePass) {
|
||||
|
||||
@@ -79,9 +79,6 @@ This is the server certificate
|
||||
.B znc
|
||||
uses.
|
||||
You need this for SSL.
|
||||
.TP
|
||||
.BR \-e ", " \-\-encrypt-pem
|
||||
Just ignore this :).
|
||||
.SH FILES
|
||||
.TP
|
||||
.I /usr/local/share/znc/
|
||||
|
||||
@@ -331,7 +331,7 @@ bool CZNC::DeletePidFile() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CZNC::WritePemFile(bool bEncPem) {
|
||||
bool CZNC::WritePemFile() {
|
||||
#ifndef HAVE_LIBSSL
|
||||
CUtils::PrintError("ZNC was not compiled with ssl support.");
|
||||
return false;
|
||||
@@ -359,7 +359,7 @@ bool CZNC::WritePemFile(bool bEncPem) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CUtils::GenerateCert(f, bEncPem, sHost);
|
||||
CUtils::GenerateCert(f, sHost);
|
||||
fclose(f);
|
||||
|
||||
CUtils::PrintStatus(true);
|
||||
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
CString GetModPath() const;
|
||||
CString GetPemLocation() const { return GetZNCPath() + "/znc.pem"; }
|
||||
const CString& GetConfigFile() const { return m_sConfigFile; }
|
||||
bool WritePemFile(bool bEncPem = false);
|
||||
bool WritePemFile();
|
||||
const CString& GetISpoofFile() const { return m_sISpoofFile; }
|
||||
const CString& GetISpoofFormat() const { return m_sISpoofFormat; }
|
||||
const VCString& GetVHosts() const { return m_vsVHosts; }
|
||||
|
||||
Reference in New Issue
Block a user