Certificates and settings for EvaluateSTIG to send findings to stig-manager #1288
Replies: 4 comments 15 replies
-
I'd suggest reaching out to the Evaluate-STIG team for guidance. But from what I can see above, Evaluate-STIG is configured to authenticate using the OIDC Signed JWT method, which requires a private key and, usually, the passphase for that key. It may be that Evaluate-STIG refers to the key as a "cert" (the error message refers to the PEM not containing a key) but now I'm getting beyond my area of knowledge. |
Beta Was this translation helpful? Give feedback.
-
Actually, it is clear I'm not an Eval-STIG expert! When I look more closely, it seems the Eval-STIG config file refers to both a CERT and an KEY. The CERT might be the server cert which would be used to validate the TLS session over which a client authentication occurs. The KEY is likely to be the private key used for that authentication. Apologies in advance if I keep getting this wrong because I'm wandering outside the STIG Manager swim lanes... |
Beta Was this translation helpful? Give feedback.
-
The collectionId is the number in parenthesis at the top of this image: |
Beta Was this translation helpful? Give feedback.
-
Joining this thread a bit late, but with a solution! This was a pain and more difficult then it needs to be so hopefully this will help a lot of people. This was all retyped, apologize if there is a typo in one of the longer commmands/code blocks if someone copy pastes and it doesnt work. The setup this is working on:RHEL 8.10
STIG-Manager 1.4.13
Evaluate-STIG (ES) 2407.0
Windows Server 2019
Issues Encountered & ResolutionsThe ES STIG-Manger guide that was included in the ES 2407.0 has the following issues
Following the ES STIG-Manger guide after correcting the first two bullets above you still get this generic error when running ES.
By default Keycloak also doesn't log events, so if you enable event logging in the realm you would see another error, CLIENT_LOGIN_ERROR that looks like the below for the client evaluatestig.
*Note "service-account-evaluatestig" is not the grant name to provision in STIG-manager, it is the clientID configured in Keycloak, which in my case is "evaluatestig" After a lot of Duck Duck Go to no avail, I decided to look at how ES interacts with STIG-manager, all of the relevant code is in Modules\Master_Functiuons\STIGManager\STIGManager.psm1. There is a try/catch block in there that hides the true error and outputs the generic error stated above. Ripping all of this out into a new powershell script and modifying the variables so it just tries to read the cert/key, get a token directly without doing anything else and getting rid of the try/catch yielded:
As that failed the follow on code that tried to create a JWT and get a token via Keycloak would fail, and that caused the the logs/events present in Keycloak as described above. My certificate was not incorrect, and the password is correct, openssl decodes it just fine and you can validate your certs with
So that's a bummer, some more Duck Duck Go but nothing caught my eye but ES also lets you just give it a cert with an unencrypted key in it, so lets try that! In a lot of cases it is probably some person running ES and typing in the passphrase on the terminal anyways but if someone can get around the issue with the Crypto call in powershell then you could go back to an encrypted key.
The preferences.xml file should now look like this:
Once that was fixed, it still did not work and I received a new error message in my powershell script at the Invoke-RestMethod section
As stated in bullet # 3 of the ES issues, RS256 works, RS512 does not, unknown if anything else other then RS256 will work. Regenerating the evaluatestig clientID pkcs12 file with RS256 and exporting the new cert solved this issue. And running it again now produced the last error which was
Changing the client scopes in Keycloak to match what ES is sending as stated in bullet # 4 of the ES issues fixed that. And now your ES instance should be able to send to STIG-Manger automatically, when you run ES, you should no longer get an generic error and instead at the end of the scan see
Keycloak events should also show successful CLIENT_LOGIN events for the client evaluatestig that look like:
Hope this is of use to others out there! |
Beta Was this translation helpful? Give feedback.
-
Hi,
I recently got an instance deployed of stig-manager using self provided certificates. STIG-Manager is running fine with a domain and valid cert.
What I am now attempting to do is tell EvaluateSTIG to send it's results to my instance. Using the latest version 1.2404.0. There's not a lot of settings to configure for the integration but I can't seem to crack the code for uploads.
This is from the EvaluateSTIG preferences.xml file
<SMImport_API_BASE>https://mysite.com/api</SMImport_API_BASE> <SMImport_AUTHORITY>https://mysite.com/kc/realms/stigman</SMImport_AUTHORITY> <SMImport_COLLECTION Name="collection1"> <SMImport_CLIENT_ID>stig-manager</SMImport_CLIENT_ID> <SMImport_CLIENT_CERT>C:\Users\Admin\Downloads\Evaluate-STIG\Prerequisites\Certificates\localhost.crt</SMImport_CLIENT_CERT> <SMImport_CLIENT_CERT_KEY></SMImport_CLIENT_CERT_KEY> <SMImport_COLLECTION_ID>1</SMImport_COLLECTION_ID> </SMImport_COLLECTION> </STIGManager>
Some of the errors I get are
ERROR: Exception calling "CreateFromPemFile" with "1" argument(s): "The key contents do not contain a PEM, the content is malformed, or the key does not match the certificate.
ERROR: Unable to create Access Request Token. ERROR: Unable to obtain stig, aborting...
2024-05-20 14:09:18,089 WARN [org.keycloak.events] (executor-thread-1) type=CLIENT_LOGIN_ERROR, realmId=stigman, clientId=stig-manager, userId=null, ipAddress=172.19.0.1, error=invalid_client_credentials, grant_type=client_credentials
I saw an error once that said something like the certificate supplied must have a plain text key in it or else the key must be specified and the passphrase.
Given the provided repo here; https://github.com/NUWCDIVNPT/stigman-orchestration/tree/demo-auth-no-CAC what is the right combination of certificates to use and where to put them?
Also, the EvaluateSTIG preferences.xml file asks for the SMImport_COLLECTION_ID and says
Required. The collectionID of your desired collection. This can be found by a user with Manage permissions on the collection. After selecting to manage the collection, reference the "ID" value in the Collection Properties window.
I don't see ID anywhere in collections or manage collection.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions