mirror of https://github.com/apache/lucene.git
SOLR-13972: Warn about insecure settings on startup (#1058)
This commit is contained in:
parent
2ef2ddd77c
commit
d8aa04575f
|
@ -40,6 +40,7 @@ import java.util.concurrent.Future;
|
|||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.auth.AuthSchemeProvider;
|
||||
import org.apache.http.client.CredentialsProvider;
|
||||
import org.apache.http.config.Lookup;
|
||||
|
@ -657,6 +658,7 @@ public class CoreContainer {
|
|||
|
||||
securityConfHandler = isZooKeeperAware() ? new SecurityConfHandlerZk(this) : new SecurityConfHandlerLocal(this);
|
||||
reloadSecurityProperties();
|
||||
warnUsersOfInsecureSettings();
|
||||
this.backupRepoFactory = new BackupRepositoryFactory(cfg.getBackupRepositoryPlugins());
|
||||
|
||||
createHandler(ZK_PATH, ZookeeperInfoHandler.class.getName(), ZookeeperInfoHandler.class);
|
||||
|
@ -897,6 +899,21 @@ public class CoreContainer {
|
|||
initializeAuditloggerPlugin((Map<String, Object>) securityConfig.getData().get("auditlogging"));
|
||||
}
|
||||
|
||||
private void warnUsersOfInsecureSettings() {
|
||||
if (authenticationPlugin == null || authorizationPlugin == null) {
|
||||
log.warn("Not all security plugins configured! authentication={} authorization={}. Solr is only as secure as " +
|
||||
"you make it. Consider configuring authentication/authorization before exposing Solr to users internal or " +
|
||||
"external. See https://s.apache.org/solrsecurity for more info",
|
||||
(authenticationPlugin != null) ? "enabled" : "disabled",
|
||||
(authorizationPlugin != null) ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
if (authenticationPlugin !=null && StringUtils.isNotEmpty(System.getProperty("solr.jetty.https.port"))) {
|
||||
log.warn("Solr authentication is enabled, but SSL is off. Consider enabling SSL to protect user credentials and " +
|
||||
"data with encryption.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkForDuplicateCoreNames(List<CoreDescriptor> cds) {
|
||||
Map<String, Path> addedCores = Maps.newHashMap();
|
||||
for (CoreDescriptor cd : cds) {
|
||||
|
|
Loading…
Reference in New Issue