This open source project is community-supported. To report a problem or share an idea, use the
Issues tab; and if you have a suggestion for fixing the issue, please include those details, too.
In addition, use the Pull requests tab to contribute actual bug fixes or proposed enhancements.
We welcome and appreciate all contributions.
VCert
VCert is a Go library, SDK, and command line utility designed to simplify key generation and enrollment of machine identities (also known as SSL/TLS certificates and keys) that comply with enterprise security policy by using the Venafi Platform or Venafi Cloud.
Compatibility
VCert releases are tested using the latest version of Trust Protection Platform. General functionality of the latest VCert release should be compatible with Trust Protection Platform 17.3 or higher. Custom Fields and Instance Tracking require TPP 18.2 or higher, and Token Authentication requires TPP 19.2 or higher.
Installation
- Configure your Go environment according to https://golang.org/doc/install.
- Verify that GOPATH environment variable is set correctly
- Download the source code:
go get github.com/Venafi/vcertor
git clone https://github.com/Venafi/vcert.git $GOPATH/src/github.com/Venafi/vcert- Build the command line utilities for Linux, MacOS, and Windows:
make buildUsage examples
For code samples of programmatic use, please review the files in /examples.
Common part
- In your main.go file, make the following import declarations:
github.com/Venafi/vcert,github.com/Venafi/vcert/pkg/certificate, andgithub.com/Venafi/vcert/pkg/endpoint. - Create a configuration object of type
&vcert.Configthat specifies the Venafi connection details. Solutions are typically designed to get those details from a secrets vault, .ini file, environment variables, or command line parameters.
Enroll certificate
- Instantiate a client by calling the
NewClientmethod of the vcert class with the configuration object. - Compose a certiticate request object of type
&certificate.Request. - Generate a key pair and CSR for the certificate request by calling the
GenerateRequestmethod of the client. - Submit the request by passing the certificate request object to the
RequestCertificatemethod of the client. - Use the request ID to pickup the certificate using the
RetrieveCertificatemethod of the client.
New TLS listener for domain
- Call
vcert.ConfigmethodNewListenerwith list of domains as arguments. For example("test.example.com:8443", "example.com") - Use gotten
net.Listeneras argument to built-inhttp.Serveor other https servers.
Samples are in a state where you can build/execute them using the following commands (after setting the environment variables discussed later):
go build -o cli ./example
go test -v ./example -run TestRequestCertificateFor command line examples, please see the Knowledge Base at support.venafi.com.
Prerequisites for using with Trust Protection Platform
- A user account that has been granted WebSDK Access
- A folder (zone) where the user has been granted the following permissions: View, Read, Write, Create, Revoke (for the revoke action), and Private Key Read (for the pickup action when CSR is service generated)
- Policy applied to the folder which specifies:
- CA Template that Trust Protection Platform will use to enroll certificate requests submitted by VCert
- Subject DN values for Organizational Unit (OU), Organization (O), City (L), State (ST) and Country (C)
- Management Type not locked or locked to 'Enrollment'
- Certificate Signing Request (CSR) Generation not locked or locked to 'Service Generated CSR'
- Generate Key/CSR on Application not locked or locked to 'No'
- (Recommended) Disable Automatic Renewal set to 'Yes'
- (Recommended) Key Bit Strength set to 2048 or higher
- (Recommended) Domain Whitelisting policy appropriately assigned
The requirement for the CA Template to be assigned by policy follows a long standing Venafi best practice which also met our design objective to keep the certificate request process simple for VCert users. If you require the ability to specify the CA Template with the request you can use the TPP REST APIs but please be advised this goes against Venafi recommendations.
Testing with Trust Protection Platform and Cloud
Unit tests:
make testIntegration tests for Trust Protection Platform and Cloud products require endpoint connection variables (Venafi Cloud products display the API key and Zone values in the user interface):
export TPP_URL=https://tpp.venafi.example/vedsdk
export TPP_USER=tpp-user
export TPP_PASSWORD=tpp-password
export TPP_ZONE='some\policy'
make tpp_testexport CLOUD_URL=https://api.venafi.cloud/v1
export CLOUD_APIKEY=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export CLOUD_ZONE=zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz
make cloud_testCommand line utility tests make use of Cucumber & Aruba feature files.
- To run tests for all features in parallel:
make cucumber- To run tests only for a specific feature (e.g. basic, config, enroll, format, gencsr, renew, or revoke):
make cucumber FEATURE=./features/basic/version.featureWhen run, these tests will be executed in their own Docker container using the Ruby version of Cucumber.
The completed test run will report on the number of test "scenarios" and "steps" that passed, failed, or were skipped.
Contributing to VCert
Venafi welcomes contributions from the developer community.
- Fork it to your account (https://github.com/Venafi/vcert/fork)
- Clone your fork (
git clone git@github.com:youracct/vcert.git) - Create a feature branch (
git checkout -b your-branch-name) - Implement and test your changes
- Commit your changes (
git commit -am 'Added some cool functionality') - Push to the branch (
git push origin your-branch-name) - Create a new Pull Request (https://github.com/youracct/vcert/pull/new/your-branch-name)
License
Copyright © Venafi, Inc. All rights reserved.
VCert is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.
Please direct questions/comments to opensource@venafi.com.