Giter Site home page Giter Site logo

seils / cas-gclb-rotation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlecloudplatform/cas-gclb-rotation

0.0 2.0 0.0 28 KB

A sample solution that periodically checks the status of SSL proxy load balancers and rotates their certificates from a configured Private CA when they reach a given threshold.

License: Apache License 2.0

Dockerfile 4.11% Python 84.54% Shell 11.35%

cas-gclb-rotation's Introduction

GCLB rotation tool for Certificate Authority Service

This is a sample solution that periodically checks the status of Google Cloud internal or external HTTP(S) load balancers and rotates their certificates (using a configured CA on Certificate Authority Service) when they reach a given percentage of their lifetime.

Note: This solution is not an official product and is not supported by Google, but is a sample provided for your reference. Direct use of this code in production is discouraged, but you may fork, modify and run this code as needed (subject to the license).

Quickstart (for a local run)

Prerequisites:

  1. Docker: used to package and run the code locally.
  2. gcloud: used to bootstrap identity when running locally.
  3. Unix-like shell: needed to run the included scripts. Tested with bash on macOS, but should also work on Linux and WSL.

Steps

  1. Update app/config.yaml with your rotation profiles (see Config file for details).

  2. Run gcloud auth application-default login.

    Make sure the account you use has the appropriate permissions.

  3. Run ./run-local.sh in one terminal to start the rotator server.

  4. Run ./call-local.sh in another terminal to actually initiate the rotation logic.

Deploying to the Cloud

In addition to running locally, you can deploy this tool to the Cloud and run it on a schedule (e.g. every 6 hours) to keep your certificates up-to-date.

The simplest way to do this is to use the publish.sh script to deploy the rotation service to Google Cloud Run, and use Google Cloud Scheduler to define a recurring schedule for calling the rotation service.

You may also modify, package and deploy this tool to run on other platforms, such as VMs or Kubernetes pods.

Config file

This tool uses a YAML config file (app/config.yaml) to discover the load balancers to manage, the certificate authorities to use, and what certificates should look like. It contains a list of rotation profiles, each of which describes a single certificate which must be maintained.

Each rotation profile consists of:

  1. A load balancer instance whose certificates will be rotated.
  2. A Certificate Authority (CA) that will issue new certificates.
  3. The time duration (in days) for which the new certificates should be valid.
  4. A threshold of each certificate's lifetime at which it is rotated. For example, if a certificate's lifetime is 30 days and its rotation threshold is 0.5, it will be considered eligible for rotation when 15 days have passed since it was issued.

IAM roles

The account used by the rotation server must have at least the following IAM role bindings:

  • roles/privateca.certificateRequester on all configured Certificate Authorities.
  • roles/compute.loadBalancerAdmin on the project containing the configured Load Balancers.

Limitations

The following features are currently not supported:

  • Multiple certificates for a single load balancer. Currently, this tool only looks at the first certificate and replaces that.
  • Publicly-trusted certificates. To automate rotation of publicly-trusted certificates, see Using Google-managed SSL certificates.

Community contributions

If you would like to contribute to this project, start by checking the existing issues and pull requests to see if someone else has already suggested a similar edit, idea or question. If you do not see a similar idea already listed, feel free to create one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.