Repository navigation
Conversation
|
@janhoy you gave me some feedback I think, but now I can't find it ;-( |
…ecurity.json" and then uploading it.. we can't use server side apis.
Instead of burying them deep in the solr.include.sh file!
There was a problem hiding this comment.
I wonder jhow much of this can be pulled out and be it's own refactoring? Like this guy..
| .required() | ||
| .desc("Name of the example to launch, one of: cloud, techproducts, schemaless, films.") | ||
| .desc( | ||
| "Name of the example to launch, one of: cloud, techproducts, secure-setup, schemaless, films.") |
There was a problem hiding this comment.
do we need to be smart and not show secure-setup on windows?
| paramLabel = "NAME", | ||
| description = | ||
| "Name of the example to launch, one of: cloud, techproducts, schemaless, films.") | ||
| "Name of the example to launch, one of: cloud, techproducts, secure-setup, schemaless, films.") |
There was a problem hiding this comment.
also needs to be aware of windows!
| changePasswords | ||
| ? promptPassword(input, "Password for zk-readonly [SolrRocks]: ", "zk-readonly") | ||
| : "SolrRocks"; | ||
| secureZk.create(zkAdminPassword, zkReadonlyPassword); |
There was a problem hiding this comment.
i wonder if this should be it's won bin/solr auth tool? or bin/solr zk auth tool call? Probably bin/solr auth?
| Map<String, Object> publicMonitoring = new HashMap<>(); | ||
| publicMonitoring.put("name", "public-monitoring"); | ||
| publicMonitoring.put("collection", null); | ||
| publicMonitoring.put("path", List.of("/____v2/node/health", "/____v2/metrics")); |
There was a problem hiding this comment.
ugh, I hate teh ____v2 here!
| String zkPassword = zkCredentials.getProperty("zkDigestPassword"); | ||
| echo("List ZooKeeper data with TLS and digest authentication:"); | ||
| echo( | ||
| "bin/solr zk ls / --zk-tls-ca-file '" |
There was a problem hiding this comment.
are we missing --zk-tls ??
|
|
||
| private void configureSecureExampleSSL(Scanner input, StartSolrParams start, boolean noPrompt) | ||
| throws Exception { | ||
| echo("Generating sample PEM certificate and key files. OpenSSL must be available on PATH."); |
| ("techproducts".equals(params.example()) || "secure-setup".equals(params.example())) | ||
| ? "-Dsolr.modules=clustering,extraction,langid,ltr,scripting,sql -Dsolr.ltr.enabled=true -Dsolr.clustering.enabled=true" | ||
| : ""; | ||
| if ("secure-setup".equals(params.example())) { |
There was a problem hiding this comment.
i thought we had a constant we added so we didn't need "secure-setup"?
| "Unsupported example " | ||
| + exampleType | ||
| + "! Please choose one of: cloud, schemaless, techproducts, or films"); | ||
| + "! Please choose one of: cloud, schemaless, techproducts, secure-setup, or films"); |
There was a problem hiding this comment.
also need to filter on windows. I think we show the list like three times!
| import java.util.Properties; | ||
|
|
||
| /** Persists HTTP credentials so the secure example can restart without password prompts. */ | ||
| final class SecureExampleCredentials { |
There was a problem hiding this comment.
this feels like step one towards "solr.properties" ;-)
| "[req]\ndistinguished_name=dn\n[dn]\n[v3]\nsubjectAltName=DNS:localhost,IP:127.0.0.1\n"); | ||
| run( | ||
| List.of( | ||
| "openssl", |
There was a problem hiding this comment.
could be all java! don't we run openssl elsewhere too?
| } | ||
|
|
||
| Path credentialsFile() { | ||
| return home.resolve("zk-credentials.properties"); |
There was a problem hiding this comment.
I think this should just be solr.properties
| picocli.CommandLine commandLine = new picocli.CommandLine(new SolrCLI()); | ||
| propagateCommandSettings(commandLine); | ||
| exit(commandLine.execute(stripEmptyLeadingArg(args))); | ||
| return commandLine.execute(stripEmptyLeadingArg(args)); |
There was a problem hiding this comment.
interesting, hope this doesn't break something else!
| private Path keystore; | ||
|
|
||
| @CommandLine.Option( | ||
| names = "--store-type", |
There was a problem hiding this comment.
do we need two types of store?
| } | ||
| String type = params.storeType().toUpperCase(Locale.ROOT); | ||
| if (!type.equals("JKS") && !type.equals("PKCS12")) { | ||
| throw new IllegalArgumentException("--store-type must be JKS or PKCS12."); |
There was a problem hiding this comment.
okay, "PKCS12" is apparently better, and also the future... JKS is deprecated.. so let's not sue it anymore.
| trust.setCertificateEntry("solr-" + i, chain[i]); | ||
| } | ||
| String original = Files.readString(include); | ||
| Map<String, String> settings = new LinkedHashMap<>(); |
There was a problem hiding this comment.
this is jsut so messy!
| @CommandLine.Option( | ||
| names = {"-e", "--example"}, | ||
| description = "Run an example: cloud, techproducts, schemaless, films") | ||
| description = "Run an example: cloud, techproducts, secure-setup, schemaless, films") |
There was a problem hiding this comment.
and one more example ;-)
| assertTrue(enabled.contains(sslSetting)); | ||
| assertTrue( | ||
| enabled.contains( | ||
| Constants.WINDOWS ? "set SOLR_AUTH_TYPE=basic" : "SOLR_AUTH_TYPE='basic'")); |
There was a problem hiding this comment.
ugh, yeah, come on .toml or .yaml or even .properties
| dir.resolve("openssl.cnf"), | ||
| "[req]\ndistinguished_name=dn\n[dn]\n[v3]\nsubjectAltName=DNS:localhost,IP:127.0.0.1\n"); | ||
| try { | ||
| Process process = |
There was a problem hiding this comment.
is this how we test these things?
| ( | ||
| cd "$ssl_dir" | ||
| rm -f solr-ssl.keystore.p12 solr-ssl.pem | ||
| keytool -genkeypair -alias solr-ssl -keyalg RSA -keysize 2048 -keypass secret -storepass secret -validity 9999 -keystore solr-ssl.keystore.p12 -storetype PKCS12 -ext SAN=DNS:localhost,IP:127.0.0.1 -dname "CN=localhost, OU=Organizational Unit, O=Organization, L=Location, ST=State, C=Country" |
There was a problem hiding this comment.
what is the relationship between keytool and openssl? Is one better? Why did we delete this in vaour of openssl?
|
🤖 AI text below 🤖 (reviewed by Nick Shanin) Prepared fixes for the November 2 review, integrated with your current head: compare 7d193dac0f...F4 The branch merges your head Verification on Linux at 7aa3f77
One limit: the packaging BATS suites (test_ssl and test_secure_example in both parser modes) have not been run on this combined head yet, so the end-to-end shell credential flow and the ZK TLS example are verified by the unit suites above, not by BATS. If the To take the branch onto your PR head (your head is an ancestor, so this fast-forwards): You're welcome to take the commits or adapt the changes. Nick Shanin directed the work and takes responsibility for this contribution. |
interesting... So, I actually don't have a good sense of if our examples actually work well if you run jthem twice... generally in development I'l do a so that process still works... I actually wou'ndt be surprise if you got werid shit, I've never tested that flow.. interested in poking at that? |
|
I had a long chat with @Gerlowski and I wanted to capture some notes:
|
|
Hi! I think you've mentioned the wrong account — I'm not involved in Solr and don't recall any conversation about this. You probably meant @gerlowskija (Jason Gerlowski). Cheers! |
WIP exploration for SOLR-8442 and related security usability work. This work is intended to be split into smaller, focused PRs once I get some community feedback.
Description
Make it easier to configure and try Solr security from the command line. This branch adds a guided
bin/solr start -e secure-setupexample that combines HTTPS, HTTP authentication and authorization, and ZooKeeper access control in a two-node SolrCloud cluster using embedded ZooKeeper.Solution
bin/solr sslcommand that imports PEM certificates and private keys into JKS or PKCS12 keystores, builds a truststore, updates the include file, and optionally sets the SolrCloudurlSchemeproperty. Support encrypted private keys and password files. Thanks @janhoy for the suggestion.secure-setupexample set up! Generate a local self-signed certificate, show the generated file locations, and prompt the user to verify HTTPS with a v2 curl request before configuring HTTP accounts. Unfortunantly osx/linux only as I couldn't test effectively on windowsindexuser, and exercise distributed updates and queries with security enabled. Preserve existing collections and reuse saved credentials and TLS configuration on restart.superadminandadmin;indexhas indexing and search roles;searchhas the search role. Use demonstration passwords by default, offer password customization, and retry invalid wizard input using the shared password validation.security.json, permission order, and v2 monitoring checks in the tutorial.--zk-credentialsto the ZooKeeper CLI commands in both CLI implementations, independently of HTTP--credentials. Preserve configured ACL providers when supplying explicit connection credentials. Trying to get away from the weird hardcoded settings insolr.in.shapproach for a cli tool!Significant implementation, documentation, and test work was assisted by OpenAI Codex.
Tests
./gradlew iTest --tests test_secure_example.bats: HTTPS verification guidance, two-node setup and restart, anonymous monitoring, HTTP roles, and ZooKeeper ACLs../gradlew iTest --tests test_ssl.bats: all seven tests pass, covering HTTPS, Basic Authentication, hostname checks, client truststores, required/optional mTLS, and keystore reload.Checklist
mainbranch../gradlew check.