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

CertExtractor filter #474

Merged
merged 8 commits into from
Feb 10, 2022
Merged

Conversation

samutamm
Copy link
Contributor

@samutamm samutamm commented Jan 24, 2022

Resolve #467

CertExtractor filter adds values from certificates Subject or Issuer to headers.

Here's an example config:

  - kind: "CertExtractor"
    name: "cn-extractor"
    certIndex: -1
    target: "subject"
    field: "CommonName"
    headerKey: "X-AUTH-USER"

that extracts the "CommonName" field's value from the subject of the last certificate. The value is set to "X-AUTH-USER" request header.

Here's an example that sets CommonName value for new certificate: https://github.com/haoel/mTLS/blob/main/certs.go#L141

References:

@codecov-commenter
Copy link

codecov-commenter commented Jan 24, 2022

Codecov Report

Merging #474 (db593d7) into main (d14d7fe) will increase coverage by 0.12%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #474      +/-   ##
==========================================
+ Coverage   80.35%   80.47%   +0.12%     
==========================================
  Files          83       84       +1     
  Lines        9685     9758      +73     
==========================================
+ Hits         7782     7853      +71     
- Misses       1461     1463       +2     
  Partials      442      442              
Impacted Files Coverage Δ
pkg/filter/certextractor/certextractor.go 100.00% <100.00%> (ø)
pkg/object/mqttproxy/client.go 79.63% <0.00%> (-0.91%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d14d7fe...db593d7. Read the comment docs.

doc/reference/filters.md Outdated Show resolved Hide resolved
pkg/context/httpcontext.go Outdated Show resolved Hide resolved
pkg/filter/certextractor/certextractor.go Outdated Show resolved Hide resolved
pkg/filter/certextractor/spec.go Outdated Show resolved Hide resolved
@samutamm samutamm merged commit 2c8b26a into easegress-io:main Feb 10, 2022
@samutamm samutamm deleted the cert-extractor-filter branch February 10, 2022 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support mTLS client certificate authenticating
4 participants