mirror of
https://github.com/containers/podman.git
synced 2025-11-29 17:48:05 +08:00
Vendor in latest c/common
Pull in updates made to the filters code for images. Filters now perform an AND operation except for th reference filter which does an OR operation for positive case but an AND operation for negative cases. Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
This commit is contained in:
73
vendor/github.com/letsencrypt/boulder/core/objects.go
generated
vendored
73
vendor/github.com/letsencrypt/boulder/core/objects.go
generated
vendored
@@ -75,11 +75,16 @@ type OCSPStatus string
|
||||
const (
|
||||
OCSPStatusGood = OCSPStatus("good")
|
||||
OCSPStatusRevoked = OCSPStatus("revoked")
|
||||
// Not a real OCSP status. This is a placeholder we write before the
|
||||
// actual precertificate is issued, to ensure we never return "good" before
|
||||
// issuance succeeds, for BR compliance reasons.
|
||||
OCSPStatusNotReady = OCSPStatus("wait")
|
||||
)
|
||||
|
||||
var OCSPStatusToInt = map[OCSPStatus]int{
|
||||
OCSPStatusGood: ocsp.Good,
|
||||
OCSPStatusRevoked: ocsp.Revoked,
|
||||
OCSPStatusGood: ocsp.Good,
|
||||
OCSPStatusRevoked: ocsp.Revoked,
|
||||
OCSPStatusNotReady: -1,
|
||||
}
|
||||
|
||||
// DNSPrefix is attached to DNS names in DNS challenges
|
||||
@@ -120,7 +125,7 @@ type ValidationRecord struct {
|
||||
URL string `json:"url,omitempty"`
|
||||
|
||||
// Shared
|
||||
Hostname string `json:"hostname"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Port string `json:"port,omitempty"`
|
||||
AddressesResolved []net.IP `json:"addressesResolved,omitempty"`
|
||||
AddressUsed net.IP `json:"addressUsed,omitempty"`
|
||||
@@ -337,11 +342,18 @@ type Authorization struct {
|
||||
// slice and the order of these challenges may not be predictable.
|
||||
Challenges []Challenge `json:"challenges,omitempty" db:"-"`
|
||||
|
||||
// Wildcard is a Boulder-specific Authorization field that indicates the
|
||||
// authorization was created as a result of an order containing a name with
|
||||
// a `*.`wildcard prefix. This will help convey to users that an
|
||||
// Authorization with the identifier `example.com` and one DNS-01 challenge
|
||||
// corresponds to a name `*.example.com` from an associated order.
|
||||
// https://datatracker.ietf.org/doc/html/rfc8555#page-29
|
||||
//
|
||||
// wildcard (optional, boolean): This field MUST be present and true
|
||||
// for authorizations created as a result of a newOrder request
|
||||
// containing a DNS identifier with a value that was a wildcard
|
||||
// domain name. For other authorizations, it MUST be absent.
|
||||
// Wildcard domain names are described in Section 7.1.3.
|
||||
//
|
||||
// This is not represented in the database because we calculate it from
|
||||
// the identifier stored in the database. Unlike the identifier returned
|
||||
// as part of the authorization, the identifier we store in the database
|
||||
// can contain an asterisk.
|
||||
Wildcard bool `json:"wildcard,omitempty" db:"-"`
|
||||
}
|
||||
|
||||
@@ -406,53 +418,46 @@ type Certificate struct {
|
||||
}
|
||||
|
||||
// CertificateStatus structs are internal to the server. They represent the
|
||||
// latest data about the status of the certificate, required for OCSP updating
|
||||
// and for validating that the subscriber has accepted the certificate.
|
||||
// latest data about the status of the certificate, required for generating new
|
||||
// OCSP responses and determining if a certificate has been revoked.
|
||||
type CertificateStatus struct {
|
||||
ID int64 `db:"id"`
|
||||
|
||||
Serial string `db:"serial"`
|
||||
|
||||
// status: 'good' or 'revoked'. Note that good, expired certificates remain
|
||||
// with status 'good' but don't necessarily get fresh OCSP responses.
|
||||
// with status 'good' but don't necessarily get fresh OCSP responses.
|
||||
Status OCSPStatus `db:"status"`
|
||||
|
||||
// ocspLastUpdated: The date and time of the last time we generated an OCSP
|
||||
// response. If we have never generated one, this has the zero value of
|
||||
// time.Time, i.e. Jan 1 1970.
|
||||
// response. If we have never generated one, this has the zero value of
|
||||
// time.Time, i.e. Jan 1 1970.
|
||||
OCSPLastUpdated time.Time `db:"ocspLastUpdated"`
|
||||
|
||||
// revokedDate: If status is 'revoked', this is the date and time it was
|
||||
// revoked. Otherwise it has the zero value of time.Time, i.e. Jan 1 1970.
|
||||
// revoked. Otherwise it has the zero value of time.Time, i.e. Jan 1 1970.
|
||||
RevokedDate time.Time `db:"revokedDate"`
|
||||
|
||||
// revokedReason: If status is 'revoked', this is the reason code for the
|
||||
// revocation. Otherwise it is zero (which happens to be the reason
|
||||
// code for 'unspecified').
|
||||
// revocation. Otherwise it is zero (which happens to be the reason
|
||||
// code for 'unspecified').
|
||||
RevokedReason revocation.Reason `db:"revokedReason"`
|
||||
|
||||
LastExpirationNagSent time.Time `db:"lastExpirationNagSent"`
|
||||
|
||||
// The encoded and signed OCSP response.
|
||||
OCSPResponse []byte `db:"ocspResponse"`
|
||||
|
||||
// For performance reasons[0] we duplicate the `Expires` field of the
|
||||
// `Certificates` object/table in `CertificateStatus` to avoid a costly `JOIN`
|
||||
// later on just to retrieve this `Time` value. This helps both the OCSP
|
||||
// updater and the expiration-mailer stay performant.
|
||||
//
|
||||
// Similarly, we add an explicit `IsExpired` boolean to `CertificateStatus`
|
||||
// table that the OCSP updater so that the database can create a meaningful
|
||||
// index on `(isExpired, ocspLastUpdated)` without a `JOIN` on `certificates`.
|
||||
// For more detail see Boulder #1864[0].
|
||||
//
|
||||
// [0]: https://github.com/letsencrypt/boulder/issues/1864
|
||||
// NotAfter and IsExpired are convenience columns which allow expensive
|
||||
// queries to quickly filter out certificates that we don't need to care about
|
||||
// anymore. These are particularly useful for the expiration mailer and CRL
|
||||
// updater. See https://github.com/letsencrypt/boulder/issues/1864.
|
||||
NotAfter time.Time `db:"notAfter"`
|
||||
IsExpired bool `db:"isExpired"`
|
||||
|
||||
// TODO(#5152): Change this to an issuance.Issuer(Name)ID after it no longer
|
||||
// has to support both IssuerNameIDs and IssuerIDs.
|
||||
IssuerID int64
|
||||
// Note: this is not an issuance.IssuerNameID because that would create an
|
||||
// import cycle between core and issuance.
|
||||
// Note2: This field used to be called `issuerID`. We keep the old name in
|
||||
// the DB, but update the Go field name to be clear which type of ID this
|
||||
// is.
|
||||
IssuerNameID int64 `db:"issuerID"`
|
||||
}
|
||||
|
||||
// FQDNSet contains the SHA256 hash of the lowercased, comma joined dNSNames
|
||||
@@ -501,7 +506,7 @@ func RenewalInfoSimple(issued time.Time, expires time.Time) RenewalInfo {
|
||||
}
|
||||
|
||||
// RenewalInfoImmediate constructs a `RenewalInfo` object with a suggested
|
||||
// window in the past. Per the draft-ietf-acme-ari-00 spec, clients should
|
||||
// window in the past. Per the draft-ietf-acme-ari-01 spec, clients should
|
||||
// attempt to renew immediately if the suggested window is in the past. The
|
||||
// passed `now` is assumed to be a timestamp representing the current moment in
|
||||
// time.
|
||||
|
||||
47
vendor/github.com/letsencrypt/boulder/core/util.go
generated
vendored
47
vendor/github.com/letsencrypt/boulder/core/util.go
generated
vendored
@@ -1,9 +1,10 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto"
|
||||
"crypto/ecdsa"
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"crypto/sha256"
|
||||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
@@ -16,6 +17,7 @@ import (
|
||||
"math/big"
|
||||
mrand "math/rand"
|
||||
"os"
|
||||
"path"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"sort"
|
||||
@@ -23,7 +25,7 @@ import (
|
||||
"time"
|
||||
"unicode"
|
||||
|
||||
jose "gopkg.in/go-jose/go-jose.v2"
|
||||
"gopkg.in/go-jose/go-jose.v2"
|
||||
)
|
||||
|
||||
const Unspecified = "Unspecified"
|
||||
@@ -96,7 +98,7 @@ func KeyDigest(key crypto.PublicKey) (Sha256Digest, error) {
|
||||
switch t := key.(type) {
|
||||
case *jose.JSONWebKey:
|
||||
if t == nil {
|
||||
return Sha256Digest{}, fmt.Errorf("Cannot compute digest of nil key")
|
||||
return Sha256Digest{}, errors.New("cannot compute digest of nil key")
|
||||
}
|
||||
return KeyDigest(t.Key)
|
||||
case jose.JSONWebKey:
|
||||
@@ -132,21 +134,16 @@ func KeyDigestEquals(j, k crypto.PublicKey) bool {
|
||||
return digestJ == digestK
|
||||
}
|
||||
|
||||
// PublicKeysEqual determines whether two public keys have the same marshalled
|
||||
// bytes as one another
|
||||
func PublicKeysEqual(a, b interface{}) (bool, error) {
|
||||
if a == nil || b == nil {
|
||||
return false, errors.New("One or more nil arguments to PublicKeysEqual")
|
||||
// PublicKeysEqual determines whether two public keys are identical.
|
||||
func PublicKeysEqual(a, b crypto.PublicKey) (bool, error) {
|
||||
switch ak := a.(type) {
|
||||
case *rsa.PublicKey:
|
||||
return ak.Equal(b), nil
|
||||
case *ecdsa.PublicKey:
|
||||
return ak.Equal(b), nil
|
||||
default:
|
||||
return false, fmt.Errorf("unsupported public key type %T", ak)
|
||||
}
|
||||
aBytes, err := x509.MarshalPKIXPublicKey(a)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
bBytes, err := x509.MarshalPKIXPublicKey(b)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return bytes.Equal(aBytes, bBytes), nil
|
||||
}
|
||||
|
||||
// SerialToString converts a certificate serial number (big.Int) to a String
|
||||
@@ -160,7 +157,7 @@ func SerialToString(serial *big.Int) string {
|
||||
func StringToSerial(serial string) (*big.Int, error) {
|
||||
var serialNum big.Int
|
||||
if !ValidSerial(serial) {
|
||||
return &serialNum, errors.New("Invalid serial number")
|
||||
return &serialNum, fmt.Errorf("invalid serial number %q", serial)
|
||||
}
|
||||
_, err := fmt.Sscanf(serial, "%036x", &serialNum)
|
||||
return &serialNum, err
|
||||
@@ -245,6 +242,14 @@ func UniqueLowerNames(names []string) (unique []string) {
|
||||
return
|
||||
}
|
||||
|
||||
// HashNames returns a hash of the names requested. This is intended for use
|
||||
// when interacting with the orderFqdnSets table and rate limiting.
|
||||
func HashNames(names []string) []byte {
|
||||
names = UniqueLowerNames(names)
|
||||
hash := sha256.Sum256([]byte(strings.Join(names, ",")))
|
||||
return hash[:]
|
||||
}
|
||||
|
||||
// LoadCert loads a PEM certificate specified by filename or returns an error
|
||||
func LoadCert(filename string) (*x509.Certificate, error) {
|
||||
certPEM, err := os.ReadFile(filename)
|
||||
@@ -253,7 +258,7 @@ func LoadCert(filename string) (*x509.Certificate, error) {
|
||||
}
|
||||
block, _ := pem.Decode(certPEM)
|
||||
if block == nil {
|
||||
return nil, fmt.Errorf("No data in cert PEM file %s", filename)
|
||||
return nil, fmt.Errorf("no data in cert PEM file %q", filename)
|
||||
}
|
||||
cert, err := x509.ParseCertificate(block.Bytes)
|
||||
if err != nil {
|
||||
@@ -298,3 +303,7 @@ func IsASCII(str string) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func Command() string {
|
||||
return path.Base(os.Args[0])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user