Merge pull request #1277 from xnrand/master

Add network-specific settings for cert validation
This commit is contained in:
Alexey Sokolov
2016-08-20 12:08:41 +01:00
committed by GitHub
8 changed files with 69 additions and 2 deletions
+14
View File
@@ -132,6 +132,8 @@ class CAdminMod : public CModule {
{"Encoding", str},
#endif
{"QuitMsg", str},
{"TrustAllCerts", boolean},
{"TrustPKI", boolean},
};
PrintVarsHelp(sVarFilter, nvars, ARRAY_SIZE(nvars),
"The following variables are available when using "
@@ -520,6 +522,10 @@ class CAdminMod : public CModule {
#endif
} else if (sVar.Equals("quitmsg")) {
PutModule("QuitMsg = " + pNetwork->GetQuitMsg());
} else if (sVar.Equals("trustallcerts")) {
PutModule("TrustAllCerts = " + CString(pNetwork->GetTrustAllCerts()));
} else if (sVar.Equals("trustpki")) {
PutModule("TrustPKI = " + CString(pNetwork->GetTrustPKI()));
} else {
PutModule("Error: Unknown variable");
}
@@ -596,6 +602,14 @@ class CAdminMod : public CModule {
} else if (sVar.Equals("quitmsg")) {
pNetwork->SetQuitMsg(sValue);
PutModule("QuitMsg = " + pNetwork->GetQuitMsg());
} else if (sVar.Equals("trustallcerts")) {
bool b = sValue.ToBool();
pNetwork->SetTrustAllCerts(b);
PutModule("TrustAllCerts = " + CString(b));
} else if (sVar.Equals("trustpki")) {
bool b = sValue.ToBool();
pNetwork->SetTrustPKI(b);
PutModule("TrustPKI = " + CString(b));
} else {
PutModule("Error: Unknown variable");
}
@@ -73,6 +73,18 @@
<label for="doconnect_checkbox"><? FORMAT "Connect to IRC &amp; automatically re-connect" ?></label></div>
</div>
<div class="subsection">
<div class="inputlabel"><? FORMAT "Trust all certs:" ?></div>
<div class="checkbox"><input type="checkbox" name="trustallcerts" id="trustallcerts_checkbox"<? IF TrustAllCerts ?> checked="checked"<? ENDIF ?> />
<label for="trustallcerts_checkbox"><? FORMAT "Disable certificate validation (takes precedence over TrustPKI). INSECURE!" ?></label></div>
</div>
<div class="subsection">
<div class="inputlabel"><? FORMAT "Trust the PKI:" ?></div>
<div class="checkbox"><input type="checkbox" name="trustpki" id="trustpki_checkbox"<? IF TrustPKI ?> checked="checked"<? ENDIF ?> />
<label for="trustpki_checkbox"><? FORMAT "Setting this to false will trust only certificates you added fingerprints for." ?></label></div>
</div>
<div class="subsection half" id="servers_plain">
<div class="inputlabel"><? FORMAT "Servers of this IRC network:" ?></div>
<div><textarea name="servers" cols="70" rows="5" id="servers_text"><? LOOP ServerLoop ?><? VAR Server ?>
+7
View File
@@ -937,6 +937,8 @@ class CWebAdminMod : public CModule {
Tmpl["IRCConnectEnabled"] =
CString(pNetwork->GetIRCConnectEnabled());
Tmpl["TrustAllCerts"] = CString(pNetwork->GetTrustAllCerts());
Tmpl["TrustPKI"] = CString(pNetwork->GetTrustPKI());
breadNet["Text"] = f("Edit Network [{1}]")(pNetwork->GetName());
@@ -985,6 +987,8 @@ class CWebAdminMod : public CModule {
Tmpl["Title"] =
f("Add Network for User [{1}]")(pUser->GetUserName());
Tmpl["IRCConnectEnabled"] = "true";
Tmpl["TrustAllCerts"] = "false";
Tmpl["TrustPKI"] = "true";
Tmpl["FloodProtection"] = "true";
Tmpl["FloodRate"] = "1.0";
Tmpl["FloodBurst"] = "4";
@@ -1076,6 +1080,9 @@ class CWebAdminMod : public CModule {
pNetwork->SetIRCConnectEnabled(WebSock.GetParam("doconnect").ToBool());
pNetwork->SetTrustAllCerts(WebSock.GetParam("trustallcerts").ToBool());
pNetwork->SetTrustPKI(WebSock.GetParam("trustpki").ToBool());
sArg = WebSock.GetParam("bindhost");
// To change BindHosts be admin or don't have DenySetBindHost
if (spSession->IsAdmin() || !spSession->GetUser()->DenySetBindHost()) {