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

TLS Client Certificate validation policy [THREESCALE-1671] #966

Merged
merged 4 commits into from
Jan 25, 2019

Conversation

mikz
Copy link
Contributor

@mikz mikz commented Dec 6, 2018

Experiment with FFI and OpenSSL to validate client certificates.

  • package this as a customization for APIcast 3.4 (https://github.com/mikz/apicast-tls-validation-policy)
  • test expired certificate
  • test certificate use before its issue date (or not valid before)
  • rover exec bin/busted spec/resty/openssl --repeat=10000 --no-auto-insulate without memory leaks
  • policy unit tests
  • policy integration tests

In case of expired or not yet valid certificate nginx rejects the client certificate right away before applying any policies.

@mikz mikz requested a review from a team as a code owner December 6, 2018 17:21
@y-tabata
Copy link
Contributor

Hi @mikz.
We're interested in Mutual SSL between a client application and APIcast.
Is this policy testing of that?

gateway/src/resty/openssl/x509/name.lua Outdated Show resolved Hide resolved
gateway/src/resty/openssl/x509/name.lua Outdated Show resolved Hide resolved
gateway/src/resty/openssl/x509/name.lua Outdated Show resolved Hide resolved
gateway/src/resty/openssl/x509/name.lua Outdated Show resolved Hide resolved
gateway/src/resty/openssl/x509/name.lua Outdated Show resolved Hide resolved
gateway/src/resty/openssl/x509/name.lua Outdated Show resolved Hide resolved
gateway/src/resty/openssl/x509/name.lua Outdated Show resolved Hide resolved
gateway/src/resty/openssl/x509/name.lua Outdated Show resolved Hide resolved
gateway/src/resty/openssl/x509/name.lua Outdated Show resolved Hide resolved
gateway/config/development.lua Outdated Show resolved Hide resolved
@mikz
Copy link
Contributor Author

mikz commented Jan 15, 2019

@y-tabata yes, this policy enables validation of TLS Client certificates used by clients when connecting to APIcast.

@davidor davidor added this to the 3.5 milestone Jan 15, 2019
mikz added a commit to mikz/apicast-tls-validation-policy that referenced this pull request Jan 15, 2019
@mikz mikz force-pushed the tls-validation-poc branch 6 times, most recently from 52f7c1b to 777a66e Compare January 16, 2019 07:55
@mikz mikz changed the title [WIP] TLS validation PoC TLS Client Certificate validation policy Jan 16, 2019
@mikz mikz requested a review from davidor January 16, 2019 07:55
mikz added a commit to mikz/apicast-tls-validation-policy that referenced this pull request Jan 16, 2019
proxy_ssl_certificate_key $TEST_NGINX_SERVER_ROOT/html/client.key;
proxy_pass https://$server_addr:$apicast_port/t;
proxy_set_header Host localhost;
log_by_lua_block { collectgarbage() }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To run the Test::Nginx memory leak test mode. I was worried that there are some memory leaks in the OpenSSL wrapper, so I was running the memory leak checker.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


policy:access()

assert.stub(ngx.exit).was_called_with(400)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would 403 be more appropriate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I got the 400 from testing normal nginx certificate veritifation.

mikz added a commit to mikz/apicast-tls-validation-policy that referenced this pull request Jan 21, 2019
mikz added a commit to mikz/apicast-tls-validation-policy that referenced this pull request Jan 22, 2019
mikz added a commit to mikz/apicast-tls-validation-policy that referenced this pull request Jan 22, 2019
mikz added 2 commits January 25, 2019 11:15
BIO, EVP, X509, X509 Store and CTX to read, print and validate
certificates.
mikz added 2 commits January 25, 2019 11:15
Validate TLS Client Certiticate against a whitelist of
individual certificates or CAs.
@mikz mikz force-pushed the tls-validation-poc branch from 777a66e to 31e6c22 Compare January 25, 2019 10:24
@mikz mikz merged commit f2690af into master Jan 25, 2019
@mikz mikz deleted the tls-validation-poc branch January 25, 2019 10:45
@mikz mikz changed the title TLS Client Certificate validation policy TLS Client Certificate validation policy [THREESCALE-1671] Feb 22, 2019
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.

3 participants