Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

celmatcher: Implement pkix.Name conversion to string #5492

Merged
merged 1 commit into from
Apr 19, 2023
Merged

Conversation

francislavoie
Copy link
Member

For #5491

@ethack
Copy link

ethack commented Apr 17, 2023

I believe I have caddy built on this commit.

caddy version
v2.6.5-0.20230415014855-be34eab96247 h1:d0I4nO5yuDmaJz8YnFSxKThUPDpEXcmQ3gDSx/CyxS0=

But still get the same error with the scenario from #5491.

openssl x509 -in certs/user.crt -text | grep Subject | head -1
        Subject: CN = [email protected]

curl -k --cert certs/user.crt --key secrets/user.key https://subjectEndsWith.acme.corp/

No output from curl command, but an error in the logs:

{"level":"error","ts":1681765850.4929817,"logger":"http.matchers.expression","msg":"evaluating expression","error":"internal error: interface conversion: caddyhttp.celPkixName is not traits.Receiver: missing method Receive"}
{"level":"error","ts":1681765850.493016,"logger":"http.log.error","msg":"internal error: interface conversion: caddyhttp.celPkixName is not traits.Receiver: missing method Receive","request":{"remote_ip":"172.23.0.1","remote_port":"44312","client_ip":"172.23.0.1","proto":"HTTP/2.0","method":"GET","host":"subjectEndsWith.acme.corp","uri":"/","headers":{"User-Agent":["curl/7.81.0"],"Accept":["*/*"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"subjectendswith.acme.corp","client_common_name":"[email protected]","client_serial":"284678274866306650542870557902111780363"}},"duration":0.000138086}

@francislavoie
Copy link
Member Author

You would need to explicitly type convert it to a string first I think:

string({http.request.tls.client.san.emails}).exists(email, email == "[email protected]")

Or with dyn as Tristan suggested, maybe:

dyn({http.request.tls.client.san.emails}).exists(email, email == "[email protected]")

@ethack
Copy link

ethack commented Apr 18, 2023

Got it. Both string(...) and string(dyn(...)) work. Straight dyn(...) does not. Seems like that's expected so it's just fyi.

@francislavoie francislavoie added this to the v2.7.0 milestone Apr 19, 2023
@francislavoie francislavoie merged commit b301a3d into master Apr 19, 2023
@francislavoie francislavoie deleted the cel-pkix branch April 19, 2023 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants