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

Relaxing the validation of server certificates when using self-signed embedded certs #82

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kkieffer
Copy link
Contributor

When using embedded self-signed (pinned) certificates, the default validation is to use the SSL policy, which is more restrictive than necessary. In addition to validating the x509 certificate, the SSL policy checks that the hostname you are connecting to is listed on the certificate. In iOS13 and MacOS Catalina, Apple has increased the certificate requirements. The hostname must be in the subject alternative field, and the certificate cannot be valid for more than 825 days.

When using certificate pinning, checking the hostname is not necessary because the client is only using the embedded cert for verification (see https://tools.ietf.org/html/rfc2818#section-3.1). Checking the hostname also precludes connecting to a server by IP address instead of a hostname.

To provide flexibility for self-signed certificates, this pull request changes the trust policy from SSL to x509 only when evaluating self-signed certificates.

Also updated the README to describe using embedded self-signed certs.

Motivation and Context

Relaxes certificate requirements that aren't necessary for pinned self-signed certs.

How Has This Been Tested?

Running swift tests, all tests pass. Have also validated against my own server using a self-signed cert that doesn't pass the requirements in ios13.

Checklist:

  • I have submitted a CLA form
  • [x ] If applicable, I have updated the documentation accordingly.
  • [n/a ] If applicable, I have added tests to cover my changes.

…signed (pinned) certificates using the x509 policy. The SSL policy adds hostname validation, and on ios13 additional restrictions in valid dates which aren't applicable when the client already has the server certificate. This modification allows for IP hostnames and self-signed certificates with longer validity before expiration. Also update the README to include using embedded self-signed certs.
@kkieffer
Copy link
Contributor Author

Just checking in to see if there are any comments/questions on this PR....

@djones6
Copy link
Contributor

djones6 commented Jan 8, 2020

@kkieffer This looks and sounds reasonable, though I'm not a subject matter expert. @billabt any thoughts?

@djones6 djones6 requested a review from billabt January 8, 2020 13:36
@kkieffer
Copy link
Contributor Author

@billabt would you review?

@CLAassistant
Copy link

CLAassistant commented Sep 27, 2020

CLA assistant check
All committers have signed the CLA.

@sonarcloud
Copy link

sonarcloud bot commented Nov 25, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Member

@mbarnach mbarnach left a comment

Choose a reason for hiding this comment

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

This looks interesting to me.
@dannys42 Do you want to have a look?

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.

4 participants