-
Notifications
You must be signed in to change notification settings - Fork 913
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
For the govc -cert and -key parameters, how can we get these two files? #1931
Comments
What are you trying to do? The govc |
I was trying to connect to vCenter and get datacenter.info. I was trying to not use this login information to connect to vCenter. |
ok, the article you link to is unrelated then. If you want to use client side token auth, see: https://github.com/vmware/govmomi/blob/master/govc/USAGE.md#sessionlogin And info on creating a solution user: https://github.com/vmware/govmomi/blob/master/govc/USAGE.md#ssousercreate https://vmware.github.io/vsphere-storage-for-kubernetes/documentation/saml-token-authentication.html |
Hi Doug, I am following these steps:
But ./govc sso.user.ls only shows these four users:
I can't find my k8s-vcp account listed here.
My goal is to generate the cert and key files locally and then acknowledge them with the remote vCenter so I can use these cert and key files with govc to perform some datacenter operations like listing datacenter info. |
1-3 are fine, but for the next step you need to use session.login to issue a token and then use the token to login: % token=$(govc session.login -u $host -cert ~/key/k8s-vcp.crt -key ~/key/k8s-vcp.key -issue)
% govc session.login -u $host -cert ~/key/k8s-vcp.crt -key ~/key/k8s-vcp.key -token "$token" After that, you'll have a cached session and all commands just need % govc datacenter.info -u $host Or instead of |
Thanks Doug. Two questions: However, session login failed: I tried to run this session.login command with/without exporting GOVC_USERNAME and GOVC_PASSWORD. But both failed. Another question is after creating sso user by: I am able to see this user via: But I can't see it from vCenter UI user section and Where is user k8s-vcp? |
You do need to unset GOVC_USERNAME and GOVC_PASSWORD, I don't think the UI displays solution users anywhere. |
Yes, I only have GOVC_USERNAME and GOVC_PASSWORD SET during the sso.user.create(we must have them set).
These two variables are empty.
Till here, we are fine.
We failed here. |
Not sure, can you check the vCenter logs at |
I was able to get it work in 6.5 and 7.0 vCenter. Don't know why it failed only with 6.7 vCenter.
Thanks for your help! |
|
Closing as stale. Feel free to reopen if this is still an issue. |
Hi , I am following this link. My goal is to set up access to our vCenter using govc from one of our management Linux node without giving the password, so we can write the scripts to do the tasks
Getting this error now
How can resolve this issue? Thanks in advance |
Hi VMware team,
I am following this article to generate the cert and key(use /usr/lib/vmware-vmca/bin/certificate-manager):
https://www.dasher.com/vmware-vcenter-certificate-replacement/
After getting the cert and key files, I am getting the following error when using govc
./govc datacenter.info -cert ~/certs/vmca_issued_csr.csr -key ~/certs/vmca_issued_key.key
./govc: tls: failed to find "CERTIFICATE" PEM block in certificate input after skipping PEM blocks of the following types: [CERTIFICATE REQUEST]
I tried to replace my cert file with the following command:
openssl req -new -x509 -sha256 -key ~/certs/vmca_issued_key.key -out ~/certs/vmca_issued_csr_new.csr -days 100
and use the new cert file for govc, but now I am getting "./govc: NotAuthenticated". Can you help me with this problem?
Al the best
The text was updated successfully, but these errors were encountered: