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

Importing Corporate Root CA is not working as advertised #6577

Closed
CrossBound opened this issue Feb 10, 2020 · 17 comments · Fixed by #6889
Closed

Importing Corporate Root CA is not working as advertised #6577

CrossBound opened this issue Feb 10, 2020 · 17 comments · Fixed by #6889
Assignees
Labels
ev/certificate-errors failed due to certificate issues kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to documentation. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@CrossBound
Copy link
Contributor

According to merge #5015 and https://minikube.sigs.k8s.io/docs/tutorials/untrusted_root_certificate/ I should be able to drop my corporate root certificate into my $home\.minikube\certs directory and it would get copied to the minikube vm during startup. I have done this and I see evidence of this in the vm (output below), however it only creates symlinks in the /etc/ssl/certs folder and there are no files there. Attempting to use curl from within the VM returns a problem with the TLS trust.

I have confirmed that if I manually create the file in the /etc/ssl/certs folder it resolves the issue.

Expected Result:
Copying my root certificate into $home.minikube\certs folder (as PEM format) and then starting the vm should copy the file to the vm's /etc/ssl/certs folder which will resolve TLS connection issues protected by our corporate root certificate. After this ssh'ing into the vm ( minikube ssh ) and then calling the service ( curl https://service.domain:0000 ) should succeed.

Actual Results:
A symlink is created in the /etc/ssl/certs folder, but not the actual certificate file.
After this ssh'ing into the vm ( minikube ssh ) and then calling the service ( curl https://service.domain:0000 ) returns an error:

In the output below, lbrtca01-ca.pem is my corporate root certificate.

PS D:\Projects\LEAF\Kubernetes\Config> dir $home\.minikube\certs

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        1/29/2020   2:25 PM           1679 ca-key.pem
-a----        1/29/2020   2:25 PM           1046 ca.pem
-a----        1/29/2020   2:25 PM           1086 cert.pem
-a----        1/29/2020   2:25 PM           1675 key.pem
-a----        2/10/2020  11:03 AM           2062 lbrtca01-ca.pem
-a----        2/10/2020  11:04 AM           1984 legacy01-svcert01-ca.pem

PS D:\Projects\LEAF\Kubernetes\Config> minikube ssh
                         _             _
            _         _ ( )           ( )
  ___ ___  (_)  ___  (_)| |/')  _   _ | |_      __
/' _ ` _ `\| |/' _ `\| || , <  ( ) ( )| '_`\  /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )(  ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)

$
$ ls -l /etc/ssl/certs | grep -i 'lbrt'
lrwxrwxrwx 1 root root     30 Feb 10 17:44 9373d18b.0 -> /etc/ssl/certs/LBRTCA01-CA.pem
$ sudo cat /etc/ssl/certs/LBRTCA01-CA.pem
cat: /etc/ssl/certs/LBRTCA01-CA.pem: No such file or directory
$
$ openssl s_client -connect dnaleafas.legacy01.legacybank.com:10001
CONNECTED(00000003)
depth=1 DC = com, DC = LegacyBank, DC = Legacy01, CN = Legacy01-SVCERT01-CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/CN=DNALEAFAS.Legacy01.LegacyBank.com
   i:/DC=com/DC=LegacyBank/DC=Legacy01/CN=Legacy01-SVCERT01-CA
 1 s:/DC=com/DC=LegacyBank/DC=Legacy01/CN=Legacy01-SVCERT01-CA
   i:/DC=com/DC=LegacyBank/DC=Legacy01/CN=LBRTCA01-CA
---

I am running minikube version v.1.7.1 with the Hyper-V VM driver on Windows 10 Enterprise Version 1809 x64.

Thank You

@michaeljohn32
Copy link

I am also experiencing this issue with the same workaround (copied cert to both .minikube/files/etc/ssl/certs/myCA.pem and .minikube/certs/myCA.pem)

minikube v1.7.3, Virtualbox Driver on MacOSX 10.14.6

@medyagh
Copy link
Member

medyagh commented Feb 23, 2020

I wonder if the filesync is working on mac... We had a bug about file sync but I believe we fixed it

@medyagh medyagh added kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Feb 23, 2020
@medyagh
Copy link
Member

medyagh commented Feb 23, 2020

Could you please do minikube ssh
And verify the certs have not been copied ?

@michaeljohn32
Copy link

If I use a minikube ssh with just the pem file copied to ~/.minikube/certs/MyCA.pem, I see that the pem file is not copied. The symbolic link with the hash is there, but that is all. If I copy the pem to ~/.minikube/files/etc/ssl/certs/MyCA.pem, the cert is copied/synced.

@medyagh
Copy link
Member

medyagh commented Feb 24, 2020

@michaeljohn32 as far I know you are supposed to copy to the files folder. As you noted lastly.

Anything you put in that folder will be synced to the VM.

So if that is the case that putting it in files folder fixes the corp ! Then the documentation should say that too.

Do you mind sharing the link to the wrong documentation?

@CrossBound
Copy link
Contributor Author

CrossBound commented Feb 24, 2020 via email

@CrossBound
Copy link
Contributor Author

CrossBound commented Feb 24, 2020

Interestingly, putting the root certificate in the $home\.minikube\files\etc\ssl\certs\ folder on my workstation still doesn't copy the file to the minikube vm for me.

Here is my output after using minikube ssh

$ ls -l /etc/ssl/certs | grep -i 'lbrt'
lrwxrwxrwx 1 root root     30 Feb 24 23:06 9373d18b.0 -> /etc/ssl/certs/LBRTCA01-CA.pem
$

@medyagh
Copy link
Member

medyagh commented Feb 24, 2020

@CrossBound admitably I didnt fully read your comment ! sorry about that.

I am curious would you mind trying minkube stop , start
(or at least minikube start again)
as far I know the file sync gets triggered on each start

@medyagh
Copy link
Member

medyagh commented Feb 24, 2020

@CrossBound also I just noticed you are using v.1.7.1 we had a file sync bug in 1.7.1
would u mind trying with 1.7.3 ?

@medyagh medyagh added the triage/needs-information Indicates an issue needs more information in order to work on it. label Feb 24, 2020
@CrossBound
Copy link
Contributor Author

After updating to v1.7.3 it fixes the issue where files in my .minikube\files directory are not copied, however, it still requires me to put the root certificate in .minikube\files\etc\ssl\certs for it to work.

Based on the documentation listed in my first comment it sounds like all you should have to do is put the file in the .minikube\certs folder for it to work. If that is not the case maybe the docs just need to be updated?

@medyagh
Copy link
Member

medyagh commented Feb 25, 2020

thank you @CrossBound for trying new version and updating this issue,

indeed the docs needs to be udpated I wonder if that is the case only for windows or mac too ?

I would happily review any PR that fixes this documenation.

@medyagh medyagh added kind/documentation Categorizes issue or PR as related to documentation. and removed triage/needs-information Indicates an issue needs more information in order to work on it. labels Feb 25, 2020
@michaeljohn32
Copy link

michaeljohn32 commented Feb 25, 2020

@medyagh, in at least one previous version of minikube, it was not necessary to put the cert in both ~/.minikube/files/... and ~/.minikube/certs. I do not recall what version I had installed(I believe it was 1.6.0), but it used to work (both the hash and the certificate would be copied to the correct location) with just putting the certificate file in the ~/.minkube/certs folder. The documentation was correct. This is a regression.

@CrossBound
Copy link
Contributor Author

I might also add that I'm confused about the purpose of merge #5015 if you still have to go the other route, seems pointless if it doesn't really solve the problem.

@kristoflemmens
Copy link

I have the same problem. Did some tests and it worked in version 1.6.2 and stopped working in version 1.7.0

@medyagh
Copy link
Member

medyagh commented Mar 4, 2020

This sounds like a regression ! we will need to fix it.

we will fix this and add integration tests for it so it never happens again.

thank you everyone for bringing this to our attention. @michaeljohn32 @kristoflemmens @CrossBound

and thanks @kristoflemmens for provoding the exact versions that works.

@medyagh medyagh added the ev/certificate-errors failed due to certificate issues label Mar 4, 2020
@tstromberg
Copy link
Contributor

I'm pretty sure I broke this feature when refactoring file synchronization, though I'm not exactly sure how yet. I'll need to do some git bisect work to narrow it down. Thank you for reporting this!

@tstromberg
Copy link
Contributor

tstromberg commented Mar 4, 2020

Sent out a fix PR. The underlying issue was a combination of an inverted boolean check and inverting the arguments to ln. Somehow, after 25 years of using UNIX, I can never get ln -s arguments correct.

I've added a comprehensive integration test for certificate synchronization so that this feature does not unexpectedly break in the future.

Thank you @CrossBound for the comprehensive bug report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ev/certificate-errors failed due to certificate issues kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to documentation. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants