Giter Site home page Giter Site logo

Comments (8)

hslatman avatar hslatman commented on June 2, 2024

@birdie1 what SCEP client are you using? I see it reports as Go-http-client/1.1, but I'm curious what the actual program is. And do you access the SCEP endpoint using HTTPS, or HTTP?

We generally advise to use "includeRoot": false, (you can also leave it out; false is the default), because we've seen some weird behavior with certain clients if it is included, especially on renewals.

Seeing "crt": "/etc/step-ca/certs/client_ca.crt", is a bit surprising, but if that's what you configured before, then I guess you configured your intermediate there? Is the intermediate an ECDSA or RSA certificate?

from certificates.

birdie1 avatar birdie1 commented on June 2, 2024

Currently we are using the scepclient from https://github.com/micromdm/scep for testing purposes. We can access the SCEP endpoint via http and https, but both having the same error.

I removed "includeRoot": false, but it didn't change anything.

Yes, the whole step ca config is under /etc/step-ca.
From my understanding it is RSA, here is the opennsl output:

root@ca1 ~ # openssl x509 -in /etc/step-ca/certs/client_ca.crt -text -noout
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            ***
        Signature Algorithm: sha512WithRSAEncryption
        Issuer: ***
        Validity
            Not Before: Mar 27 12:26:16 2023 GMT
            Not After : Mar 24 12:26:16 2033 GMT
        Subject: ***
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    ***
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Subject Key Identifier: 
                ***
            X509v3 Authority Key Identifier: 
                ***
            X509v3 Basic Constraints: critical
                CA:TRUE, pathlen:0
            X509v3 Key Usage: critical
                Digital Signature, Certificate Sign, CRL Sign
    Signature Algorithm: sha512WithRSAEncryption
    Signature Value:
        ***

from certificates.

hslatman avatar hslatman commented on June 2, 2024

I removed "includeRoot": false, but it didn't change anything.

๐Ÿ‘

Yes, the whole step ca config is under /etc/step-ca. From my understanding it is RSA, here is the opennsl output:

root@ca1 ~ # openssl x509 -in /etc/step-ca/certs/client_ca.crt -text -noout
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            ***
        Signature Algorithm: sha512WithRSAEncryption
        Issuer: ***
        Validity
            Not Before: Mar 27 12:26:16 2023 GMT
            Not After : Mar 24 12:26:16 2033 GMT
        Subject: ***
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    ***
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Subject Key Identifier: 
                ***
            X509v3 Authority Key Identifier: 
                ***
            X509v3 Basic Constraints: critical
                CA:TRUE, pathlen:0
            X509v3 Key Usage: critical
                Digital Signature, Certificate Sign, CRL Sign
    Signature Algorithm: sha512WithRSAEncryption
    Signature Value:
        ***

Looks OK too.

Currently we are using the scepclient from https://github.com/micromdm/scep for testing purposes. We can access the SCEP endpoint via http and https, but both having the same error.

I would advise to use a different SCEP client for testing to reduce the number of moving parts. I've used the one you're using for testing too, and I've observed some non-compatible behavior with it (might be on the CA side; could also be client side), I think especially with renewals. Also see e.g. micromdm/scep#217, which is another case of something I observed while testing with step-ca. I've had good experiences with https://github.com/certnanny/sscep for simple testing purposes, but we've done extensive testing with iOS, macOS and Windows too.

Note that we've forked the MicroMDM repository to maintain the corescep package (in consultation with the awesome people on their side): https://github.com/smallstep/scep. It's possible to build your own client using that lower level client, so that you have more control over the actual behavior. We've done a bit of work to integrate a SCEP client in our client tooling, but that's not available in the CLI yet.

from certificates.

birdie1 avatar birdie1 commented on June 2, 2024

I tried sscep and the first time I got a certificate (Like with the micromdm as well). After that I receive again an error 500, but with a different error message.
Step CA output:

2024-02-21T09:23:21.692495+01:00 ca1 step-ca[19965]: time="2024-02-21T09:23:21+01:00" level=error duration="395.362ยตs" duration-ns=395362 error="scep post request failed: error decrypting encrypted pkcs7 content: pkcs7: no enveloped recipient for provided certificate" fields.time="2024-02-21T09:23:21+01:00" method=POST name=ca path="/scep/802.1x?operation=PKIOperation" protocol=HTTP/1.0 referer= remote-address="::1" request-id=cnar5uemrdkoss8hq6kg size=123 status=500 user-agent= user-id=

sscep output:

sscep enroll -u http://***/scep/802.1x -k privkey.pem -r csr.pem -l client.crt -c ca.crt -v
sscep: starting sscep, version 0.10.0
sscep: new transaction
sscep: transaction id: D41D8CD98F00B204E9800998ECF8427E
sscep: hostname: ***
sscep: directory: scep/802.1x
sscep: port: 80
sscep: SCEP_OPERATION_GETCAPS
sscep: connecting to ***:80
sscep: server response status code: 200, MIME header: text/plain
Renewal
SHA-1
SHA-256
AES
DES3
SCEPStandard
POSTPKIOperation
sscep:  Read request with transaction id: 99E814C8EE0F47E0AE4F055AB3AE47A3
sscep: generating selfsigned certificate
sscep: requesting certificate with serial number 0 and issuer ***
sscep: SCEP_OPERATION_ENROLL
sscep: sending certificate request
sscep: request data dump 
-----BEGIN CERTIFICATE REQUEST-----
***
-----END CERTIFICATE REQUEST-----
sscep: data payload size: 724 bytes
sscep: successfully encrypted payload
sscep: envelope size: 1215 bytes
sscep: creating outer PKCS#7
sscep: PKCS#7 data written successfully
sscep: payload size: 2841 bytes
sscep: connecting to ***:80
sscep: server response status code: 500, MIME header: text/plain
sscep: wrong (or missing) MIME content type
sscep: error while sending message

Any ideas what is wrong there?
Is there any change to get step ca to produce more output?

from certificates.

hslatman avatar hslatman commented on June 2, 2024

@birdie1 I believe I've seen that same behavior as well, although I don't find that specific error message in my notes. I think sscep tries to use an existing certificate in the second request or changes its behavior slightly in some other manner on the renewal. If you remove the privkey.pem, client.crt and csr.pem, and retry, does it work again then?

Based on the two different errors for the two SCEP clients, it seems it might be related to the SCEP client maybe using a wrong recipient public key.

What is the actual SCEP client you're using / integrating with? Currently our CA is in use mostly with iOS, macOS and Windows clients, and for those the current (default) configuration options work well. It has to be noted that these generally request a fully new certificate, not using SCEP renewal, so maybe your problem is related to that? I may be able to try testing it with a client that's closer to your environment to see what's off.

We'll be working on logging improvements in the coming weeks across our stack, so improvements in this area can be expected.

from certificates.

birdie1 avatar birdie1 commented on June 2, 2024

@birdie1 I believe I've seen that same behavior as well, although I don't find that specific error message in my notes. I think sscep tries to use an existing certificate in the second request or changes its behavior slightly in some other manner on the renewal. If you remove the privkey.pem, client.crt and csr.pem, and retry, does it work again then?

After creating a completely new key and csr (with other CN as well) the error persist.

Based on the two different errors for the two SCEP clients, it seems it might be related to the SCEP client maybe using a wrong recipient public key.

What do you mean with this? What can I change to use a valid recipient public key?

What is the actual SCEP client you're using / integrating with? Currently our CA is in use mostly with iOS, macOS and Windows clients, and for those the current (default) configuration options work well. It has to be noted that these generally request a fully new certificate, not using SCEP renewal, so maybe your problem is related to that? I may be able to try testing it with a client that's closer to your environment to see what's off.

We want to use it for our certifcate based 802.1x network authentication. We use ansible for linux, baramundi for windows and Vmware Airwatch for our mobile devices. The SCEP we need for Vmware Airwatch. For the others we can use scripts to provide the certificate with step cli over ssh.

from certificates.

birdie1 avatar birdie1 commented on June 2, 2024

I found at least one thing:
It is working if I use the decrypter certificate, instead of the ca certificate on the sscep cmd:

sscep enroll -u http://ca-clients.disy.net/scep/802.1x -k privkey.pem -r csr.pem -l client.crt -c decryptor.crt -v

from certificates.

hslatman avatar hslatman commented on June 2, 2024

Sounds plausible. The decrypter certificate is the one used to encrypt the message against, and thus used as the recipient. Some clients may need explicit configuration of the recipient, or else might pick the wrong certificate to encrypt against. One of the reasons we added support for the decrypter configuration was to be able to (continue to) use EC keys for signing, but still support SCEP easily. Before we added support, one was required to configure an RSA intermediate (at least) or an RSA chain. In SCEP jargon the decrypter is also known as the registration authority, but we abstained from calling it like that in step-ca, as we already had this concept, and is used in a somewhat (but not exactly) similar way.

from certificates.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.