snmagn / cert-manager-webhook-sacloud

A cert-manager repository for creating an ACME DNS01 solver webhook (sacloud)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ACME webhook の非公式さくらクラウドDNS実装

このリポジトリはACME webhook の非公式さくらクラウドDNS実装です。 fork元のソースの通りApache-2.0ライセンスで公開しています。 ご利用に関しては自己責任でお願いします。

テストツールの実装はcert-manager-webhook-dnsmadeeasyを、 webhook本体の実装はcert-manager-webhook-gandisacloud /cert-managersacloud package · go.devを参考にしています。 各作者様に感謝を!

Image

Ready made images are hosted on Docker Hub (image tags). Use at your own risk:

snmagn/cert-manager-webhook-sacloud

Install

requirements

for helm

add repogitory

$ helm repo add cert-manager-webhook-sacloud https://snmagn.github.io/cert-manager-webhook-sacloud/
$ helm repo update

helm2

$ helm install \
       --name cert-manager-webhook-sacloud \
       cert-manager-webhook-sacloud/cert-manager-webhook-sacloud \
       --namespace cert-manager \
       --set image.repository="snmagn/cert-manager-webhook-sacloud" \
       --set image.tag="latest"

or

helm3

$ helm install \
       cert-manager-webhook-sacloud \
       cert-manager-webhook-sacloud/cert-manager-webhook-sacloud \
       --namespace cert-manager \
       --set image.repository="snmagn/cert-manager-webhook-sacloud" \
       --set image.tag="latest"

Test

1.以下のテスト定義をコピーし、ご自分のAPIトークン情報に置き換えてください。

test-certificate.yaml

apiVersion: v1
kind: Secret
metadata:
  name: sacloud-api-secret
  namespace: cert-manager
type: Opaque
data:
  token: BASE64_ENCODED_TOKEN
  secret: BASE64_ENCODED_SECRET
  zone: BASE64_ENCODED_ZONE

---
apiVersion: cert-manager.io/v1alpha2
kind: ClusterIssuer
metadata:
  name: example-issuer
  namespace: cert-manager
spec:
  acme:
    email: hogehoge@example.com
    server: https://acme-staging-v02.api.letsencrypt.org/directory
    privateKeySecretRef:
      name: example-issuer-account-key
    solvers:
    - dns01:
        webhook:
          groupName: snmagn.github.com
          solverName: sacloud
          config:
            apiAccessTokenRef:
              name: sacloud-api-secret
              key: token
            apiAccessSecretRef:
              name: sacloud-api-secret
              key: secret
            apiZoneRef:
              name: sacloud-api-secret
              key: zone

---
apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
 name: example-tls
 namespace: default
spec:
  secretName: example-tls
  commonName: '*.example.com'
  dnsNames:
    - '*.example.com'
  issuerRef:
    name: example-issuer
    kind: ClusterIssuer

2.次のコマンドを実行します。

kubectl apply -f test-certificate.yaml

3.次のコマンドを実行します。

kubectl describe certificate

次の様な表示がなされ、末尾に「Certificate issued successfully」が表示されていればテストは成功です。 DNS01のチャレンジ状況によって「Created new CertificateRequest resource "example-tls-XXXXXXXXX"」の表示だけが表示される場合があります。 その場合は、しばらく経ってから再度「kubectl describe certificate」を実行してください。

Name:         example-tls
Namespace:    default
Labels:       <none>
Annotations:  API Version:  cert-manager.io/v1alpha3
Kind:         Certificate
Metadata:
  Creation Timestamp:  2020-05-10T05:56:09Z
  Generation:          1
  Managed Fields:
    API Version:  cert-manager.io/v1alpha2
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
      f:spec:
        .:
        f:commonName:
        f:dnsNames:
        f:issuerRef:
          .:
          f:kind:
          f:name:
        f:secretName:
    Manager:      kubectl
    Operation:    Update
    Time:         2020-05-10T05:56:09Z
    API Version:  cert-manager.io/v1alpha2
    Fields Type:  FieldsV1
    fieldsV1:
      f:status:
        .:
        f:conditions:
        f:notAfter:
    Manager:         controller
    Operation:       Update
    Time:            2020-05-10T05:58:20Z
  Resource Version:  XXXXXX
  Self Link:         /apis/cert-manager.io/v1alpha3/namespaces/default/certificates/example-tls
  UID:               AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE
Spec:
  Common Name:  *.example.com
  Dns Names:
    *.example.com
  Issuer Ref:
    Kind:       ClusterIssuer
    Name:       example-issuer
  Secret Name:  example-tls
Status:
  Conditions:
    Last Transition Time:  2020-05-10T05:58:20Z
    Message:               Certificate is up to date and has not expired
    Reason:                Ready
    Status:                True
    Type:                  Ready
  Not After:               2020-08-08T04:58:19Z
Events:
  Type    Reason     Age    From          Message
  ----    ------     ----   ----          -------
  Normal  Requested  6m18s  cert-manager  Created new CertificateRequest resource "example-tls-XXXXXXXXX"
  Normal  Issued     4m7s   cert-manager  Certificate issued successfully

ご利用にあたって

cert-managerのDNS01のwebhookプロバイダを使用する場合は以下のページが参考になります。 上記のテスト定義と合わせてご自分の環境に合わせた定義を作成するのに役立ててください。

About

A cert-manager repository for creating an ACME DNS01 solver webhook (sacloud)

License:Apache License 2.0


Languages

Language:Go 61.4%Language:Makefile 22.1%Language:Mustache 6.5%Language:Shell 5.9%Language:Dockerfile 3.2%Language:PowerShell 0.8%