55 Commits
Author SHA1 Message Date
Ashley Davis 168b47f1b0 install ginkgo version from go.mod, rather than explicit ver
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-06 16:53:36 +00:00
Ashley Davis 5a5c94a3f1 match upstream boilerplate verification for files w/ go:build
the regex being replaced doesn't match files which only contain go:build
although as of go 1.17 (which we require for cert-manager) that's
totally valid.

this commit updates the regex to match upstream k8s, which is the
original source of the boilerplate verification script in any case

upstream:
https://github.com/kubernetes/kubernetes/blob/47ff335d4c678f8ebe12369055d4b3806d0fb9f4/hack/boilerplate/boilerplate.py#L219-L223

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-06 14:57:21 +00:00
Ashley Davis 80648321f8 add install for ginkgo, used for e2e tests
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-06 14:06:29 +00:00
Ashley Davis 1b3ac23659 add goimports verification and skeleton ci presubmit check
CI check will be built upon as Make is improved to reach testing partiy
with bazel

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-05 15:28:38 +00:00
Ashley Davis 727e29a747 three small goimports fixes against current HEAD
rather than using the default suggested `v1` names for some imports, we
use more descriptive names

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-04 16:05:42 +00:00
Ashley Davis b2e63dbed3 bump base images
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-04 14:49:15 +00:00
Ashley Davis 5a261d789a move checksum verification to tool target over temp target (#4678)
when on temp target, the object being verified will still be written and
so a second invocation of `make tools` will succeed and install an
unverified version

For more information see attached issue

Fixes #4678

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-12-20 14:39:59 +00:00
Ashley Davis ef26e7974e always embed version number into temporary downloaded tools artifacts
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-12-20 14:35:40 +00:00
Ashley Davis 9efd933c40 add a specific link to the LICENSES file in the repo
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-12-17 15:23:50 +00:00
Ashley Davis 32d716654a Add a makefile flow for building artifacts
Includes targets for:

- all "server" binaries, for all arches
- all containers for all server binaries for all arches
- all client binaries (kubectl plugin / cmctl) for all arches
- the cert-manager helm chart + signature
- the cert-manager static manifests + CRDs
- tools which bazel would download, with checksum verification
- (commented out) a signed SHA256SUM file for client binaries

Upgrades from the bazel flow include that:

- we use OS-specific base images rather than just using amd64 everywhere
- we easily add support for signing artifacts at build time
- we add ".exe" to the end of windows executables
- we add a zip file for windows executables, for easier consumption
- we concatenate YAML files more robustly
- staging a full release should be much faster
- hopefully, it's easier to change things!
- licenses are trimmed down to reduce bloat in images (the license
  bundle was 1.4MB in size alone)

Changes from the bazel flow include:

- containers no longer have a symlink to the binary at an unusual
  path, but instead just have the binary at a more predictable path
  (e.g. /app/cmd/webhook/webhook instead of
  /app/cmd/webhook/webhook.runfiles/com_github_jetstack_cert_manager/cmd/webhook/webhook_/webhook)

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-12-15 09:54:15 +00:00
Ashley Davis 6734e9b746 add scripts for sha256 sum calculations
hash.sh returns just the sha256sum of its input file

checkhash.sh uses ha.sh to get the sha256sum of its first argument and
then validates that the checksum matches the value provided in its
second argument

hash.sh isn't currently fully portable since sha256sum isn't present
by default on macOS, but it provides a single point around which we can
do hashing to validate checksums

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-12-15 09:54:15 +00:00
Ashley Davis 7a99e7c834 add script for writing make variables for base images
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-12-15 09:54:12 +00:00
Ashley Davis 115b70cfef update link to k8s security context spec
the old link was for 1.16 and actually led to a site with a certificate error

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-11-19 13:55:02 +00:00
Ashley Davis 0e9c9e3481 bump supported k8s version in helm chart readme
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-11-19 13:54:22 +00:00
Ashley Davis 8b0b639496 add additional warnings when setting up a CI cluster
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-11-11 12:59:35 +00:00
Ashley Davis 0955aa4531 bump version of haproxy ingress to latest and limit connections
this works around a limit on file descriptors which we encounter in kind
in CI. newer kind images impose a limit of 1024 file descriptors which
isn't trivial to change; haproxy seems to try to request just over 2*n
file descriptors where n is the max number of connections; as such, if
we limit max-connections to 250 we should be comfortably within the
limit

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-11-10 17:38:49 +00:00
Ashley Davis 5c7bbb068d bump version of kind node images
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-11-09 17:21:56 +00:00
Ashley Davis 845dd26ef7 add comments detailing kind network footgun
also adds a variable for the network name, potentially making it easier
to change in the future if kind improves its support for this kind of
thing

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-11-09 17:21:47 +00:00
Ashley Davis 6f8ef26c07 add a script + flow for getting latest kind images
the script will need to be manually updated if we want to add a new
k8s version, but it should be trivial to do that

the actual kind image SHAsums aren't updated, so that the addition of
the script can be separate from the act of updating the images

also adds a make target for creating a kind cluster with CI deps

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-11-08 16:58:16 +00:00
Ashley Davis 68cd5c61b8 bump base images to latest versions
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-11-05 11:15:59 +00:00
Ashley Davis 4bc906ee8d remove old draft release notes
this repo isn't the source of truth for release notes, and if these are
drafts anyway they don't need to be kept around

(and they will still be available in git history anyway!)

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-11-04 16:42:47 +00:00
Ashley Davis bfecde8116 update keystore-go library version
Following the release of cert-manager v1.6.0, it was observed that an
update to the keystore-go library was backwards-incompatible; it
introduced a 6-character minimum length on passwords which wasn't
previously in force.

This led to https://github.com/pavel-v-chernykh/keystore-go/issues/30
which in turn led to https://github.com/pavel-v-chernykh/keystore-go/pull/31

This commit bumps to use the new version, which by default doesn't have
a min password length

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-10-28 10:10:45 +01:00
Ashley Davis aa0ec3e01c add artifacthub badge
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-10-26 16:58:32 +01:00
Ashley Davis 12651853fa bump distroless base images to latest versions
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-10-08 13:50:32 +01:00
Ashley Davis 0f3925f6c8 update base images + update instructions for checking
reg isn't trivially installable with `go install`, and `go get` now has a
deprecation warning. `crane` solves this issue!

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-09-24 11:24:02 +01:00
Ashley Davis b2f7aa57ea remove krew automation
github actions is pretty flawed in several ways, and it's missing
features which would make it usable for us.

we want to trigger our krew automation when a new stable release of our
latest supported cert-manager release is published. github has all this
information, but it's not easy to _use_ that information when triggering
a github action.

we also only want to trigger the action on the main repo and not on
forks.

if we end up having to write custom code to do this, we might as well
add that code into cmrel and not have to deal with the flaws in gh
actions.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-08-24 11:24:52 +01:00
Ashley Davis 68f5ceb3b4 Fix manually specified Certificate and CertificateRequest versions
Basically all modern X.509 certs are version 3, but confusingly to
specify "version 3" in an encoded cert, the version number is actually
2.

For PKCS#10 CSRs, the only valid version is 1, which again
confusingly has the value "0" when encoded.

This was incorrect in many places, including one place in which the
version number on a CSR was used as a certificate's version number,
when the two are entirely unrelated.

Go ignores these values, so there's no functional changes here; still,
it's better to be accurate.

Go ignoring CSR version and specifying 0:
https://cs.opensource.google/go/go/+/refs/tags/go1.17:src/crypto/x509/x509.go;l=1958

Go ignoring Certificate version and specifying 2:
https://cs.opensource.google/go/go/+/refs/tags/go1.17:src/crypto/x509/x509.go;l=1534

PKCS#10 CSR specification in RFC 2986 section 4.1:
https://datatracker.ietf.org/doc/html/rfc2986#section-4

X.509 Cert specification in RFC 5280 section 4.1.2.1:
https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.1

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-08-19 14:48:12 +01:00
Ashley Davis b069056e0a update trigger for gh action, add arm64 darwin for krew
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-08-16 17:21:07 +01:00
Ashley Davis e0e5a50f31 fix mistakenly changed CRDs for v1beta1 (#4352)
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-08-13 13:44:05 +01:00
Ashley Davis 43e83df619 add krew automation for releases
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-08-10 16:15:11 +01:00
Ashley Davis d5da86fb45 re-enable venafi tests
Revert "Disable the TPP conformance tests"

This reverts commit cc0b6d4455.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-08-09 15:55:23 +01:00
Ashley Davis e787888c31 adds an explicit timeout when pre-checking HTTP-01 challenges
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-08-05 15:22:51 +01:00
Ashley Davis 2ee4abeb24 handle individual certs in ParseSingleCertificateChain
roots are handled differently because they're their own CAs

also adds test cases for each of:

- a lone leaf
- a lone intermediate
- a lone root

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-07-28 14:06:57 +01:00
Ashley Davis 17ec9ea8e7 fix check for self-signed certs in EncodeX509Chain
see also https://github.com/jetstack/cert-manager/issues/4142

EncodeX509Chain checked for self-signed certs by comparing the subject
and issuer of the cert in question, which is invalid since it's
perfectly fine for those to match.

the correct behavior is to use cert.CheckSignatureFrom(cert). this bug
was exposed in 1.4 when ParseSingleCertificateChain started using
EncodeX509Chain in the critical path of several issuers; when end-users
had leaf certificates with subjects matching their issuer's subject, the
bug was triggered.

includes newly written tests for EncodeX509Chain and a test for
ParseSingleCertificateChain

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-07-21 16:45:48 +01:00
Ashley Davis 05b31e96f2 add conformance suite check for issuing CA certificates
this is disabled for all issuers except selfsigned and CA. the intention
is to pave the way for adding maxPathLen support later.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-07-20 12:09:17 +01:00
Ashley Davis 6b5df6b42b remove unused ValidateIssuedCertificate function
this function doesn't appear to be used anywhere, which makes it a
little confusing when trying to work out how the checks are done in the
e2e tests.

given that we encourage people not to import cert-manager as a module
and that anyone who does is likely not to use functions in the test
directory, it seems safe enough to remove this rather than deprecating
it.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-07-20 12:08:06 +01:00
Ashley Davis 24baa7e526 minor code style / comment changes in test files
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-07-19 17:19:13 +01:00
Ashley Davis c86f20f4b5 add crd make target & don't change GOPROXY in update-codegen.sh
there seems to be justification for setting GOSUMDB to a universal value
here, but setting GOPROXY doesn't seem to provide value here

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-07-19 17:19:13 +01:00
Ashley Davis 10aba07dad add .PHONY next to targets
having .PHONY next to the target which it's marking
helps with identifying which targets have been marked and makes it
easier to spot a missing .PHONY

also tweaks the find command to avoid piping, and cleans up a duplicated
ctl target

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-06-16 14:57:18 +01:00
Ashley Davis 219a620871 static analysis fixes
pkg/ctl/scheme.go:17:1: package comment should be of the form "Package ctl ..."
pkg/issuer/acme/dns/acmedns/acmedns.go:43:2: var accountJson should be accountJSON
pkg/issuer/acme/dns/acmedns/acmedns.go:50:43: func parameter accountJson should be accountJSON
pkg/controller/certificates/trigger/policies/policies.go:57:1: comment on exported type Chain should be of the form "Chain ..." (with optional leading article)
pkg/controller/ingress-shim/sync.go:36:2: package "github.com/jetstack/cert-manager/pkg/logs" is being imported more than once (ST1019)
pkg/controller/ingress-shim/sync.go:37:2: other import of "github.com/jetstack/cert-manager/pkg/logs"

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-05-21 12:04:11 +01:00
Ashley Davis 333af8fd94 further static check fixes
pkg/internal/apis/certmanager/validation/certificate_for_issuer_test.go:34:2 deadcode `defaultTestCrtName` is unused
pkg/issuer/acme/dns/rfc2136/provider_test.go:42:23 errcheck Error return value of `server.Shutdown` is not checked
pkg/issuer/acme/dns/rfc2136/provider_test.go:77:23 errcheck Error return value of `server.Shutdown` is not checked
pkg/issuer/vault/setup.go:37:2 deadcode `messageVaultHealthCheckFailed` is unused
pkg/issuer/venafi/client/request.go:143:5 gosimple S1023: redundant break statement
pkg/logs/logs.go:68:8 errcheck Error return value of `fs.Set` is not checked

the following fixes introduce a panic when the returned error is
non-nil, which could be a breaking change but was deemed to be worth it
pkg/webhook/server/server.go:58:30 errcheck Error return value is not checked
pkg/webhook/server/server.go:59:25 errcheck Error return value is not checked

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-05-21 12:04:05 +01:00
Ashley Davis c67c2c4f47 static analysis: pkg/controller
fixes the following issues:

pkg/controller/acmeorders/util.go:84:6 deadcode `hashChallenge` is unused
pkg/controller/certificaterequests/approver/approver.go:72:14 staticcheck SA4021: x = append(y) is equivalent to x = y
pkg/controller/certificaterequests/vault/vault_test.go:535:21 errcheck Error return value of `controller.Register` is not checked
pkg/controller/certificates/trigger/policies/policies.go:121:26 gosimple S1039: unnecessary use of fmt.Sprintf
pkg/controller/clusterissuers/sync_test.go:55:12 errcheck Error return value of `c.Register` is not checked
pkg/controller/ingress-shim/sync.go:301:2 gosimple S1005: unnecessary assignment to the blank identifier

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-05-21 12:03:47 +01:00
Ashley Davis 1adadc83e0 update distroless/static base images to latest version
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-05-20 18:33:03 +01:00
Ashley Davis 154c34ada7 update old references to replaced/obsolete email addresses
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-05-20 18:05:02 +01:00
Ashley Davis a75b9e828e change default devel K8S_VERSION to 1.20
1.17 is no longer supported by upstream, and 1.21 didn't work with just
a trivial version change, suggesting more work may need to be done

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-05-17 16:15:16 +01:00
Ashley Davis 00d017da78 add @munnerz to SECURITY_CONTACTS.md
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-05-05 17:35:10 +01:00
Ashley Davis 3df1173a22 fix incorrect comparison function for public keys
also adds/improves doc comments on related functions, and adds tests of
comparisons RSA keys and ECDSA keys. these tests failed as expected
before the function was changed, e.g.:

```text
Executing tests from //pkg/util/pki:go_default_test
---------------------------------------------------
--- FAIL: TestPublicKeysEqualECDSA (0.00s)
  generate_test.go:492: got an incorrect match from different curves:
    pub1 type: "P-256"
    pub2 type: "P-521"
--- FAIL: TestPublicKeysEqualRSA (0.00s)
  generate_test.go:560: got an incorrect match from different RSA keys:
    pub1: &rsa.PublicKey{N:2293...<snip>...8869, E:65537}
    pub2: &rsa.PublicKey{N:2293...<snip>...8869, E:3}
```

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-04-22 16:07:18 +01:00
Ashley Davis 4b000dd05a Add note about module compat and code style
Also includes some minor changes to language and title casing

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-04-20 13:20:04 +01:00
Ashley Davis 630bc78e32 Add SECURITY.md documenting vuln report process
Ideally, SECURITY.md will be the central source of truth to answer the
question "How do I report a security vulnerability in a cert-manager
project?"

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-03-30 14:20:31 +01:00
Ashley Davis 5e31fa37ff selfsigned: warn when certs have empty issuer DNs
as raised in#3634 - RFC 5280 states that the issuer field cannot be
empty, but this could easily happen with selfsigned certs which had
an empty subject (as the issuer matches the subject when the cert is
self signed)

this commit detects when a cert would be issued selfsigned with an
empty subject DN and emits a warning event, allowing cluster operators
to detect the warning and potentially either re-issue to generate a
compliant cert, or else accept the risk.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-03-26 11:51:46 +00:00
Ashley Davis ef5aa91f35 improve comment to match the function definition
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-03-19 13:59:33 +00:00
Ashley Davis 2404aceef4 remove unused function
this behaviour seems to be handled by translateIngressAnnotations

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-03-19 13:59:33 +00:00
Ashley Davis b246c92a45 clarify exact curve types of current ECDSA keys
it's conceivable that in the future we could have Ed25519 certs,
which would also have a key size of 256 but would be a new named entry
here

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-03-19 13:59:30 +00:00
Ashley Davis ef2006d7b6 skip clouddns test when gcloud isn't initialized
If gcloud hasn't been installed, or if it has but the default application credential file
at .config/gcloud/application_default_credentials.json hasn't been configured, this test
would segfault since the assertion at the start fails but doesn't stop the test

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-03-09 14:54:12 +00:00
Ashley Davis bd52e45d5c Match CONTRIBUTING language to existing copyright notices
Also fixes some copy-pasted comments in a few devel/ scripts

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-03-05 13:56:21 +00:00