Code Monkey home page Code Monkey logo

porkcron's Introduction

porkcron

Automatically renew SSL certificate for your Porkbun domain.

๐Ÿ“Œ About

porkcron is a simple alternative to certbot. If you own a domain registered by Porkbun, they offer you a free SSL certificate issued by Let's Encrypt. So instead of getting it from scratch yourself, you can periodically download the certificate using the Porkbun API. porkcron is designed to automate this process. It can be run as a systemd timer or in a Docker container.

๐Ÿ“ฆ Install

First, you need to generate the API keys following this guide. Do not forget to enable the API access for your domain!

When you're ready, clone the repository somewhere on your server:

git clone https://github.com/tmzane/porkcron

Take a look at the .env.example file. It contains all the environment variables used by porkcron. Rename it to .env and fill it with the values you got earlier.

Name Description Required Default
DOMAIN your Porkbun domain yes -
API_KEY your Porkbun API key yes -
SECRET_KEY your Porkbun API secret key yes -
API_URL the Porkbun API address no https://porkbun.com/api/json/v3
CERTIFICATE_PATH the path to save the certificate to no /etc/porkcron/certificate.pem
PRIVATE_KEY_PATH the path to save the private key to no /etc/porkcron/private_key.pem

Now you need to choose the installation method.

Using systemd

Run the following commands:

cd systemd
chmod +x install.sh
./install.sh

This will install the script in /usr/local/bin and enable the timer. The first run will be triggered immediately, check the log to make sure it was successful:

systemctl status porkcron.service

Using Docker

Run the following commands:

cd docker
docker compose up

This will create the porkcron container and download the certificate bundle into the ssl volume.

Changing the run schedule

By default, the script is run once per week, which is plenty since the certificate is valid for 3 months. You can change the schedule by modifying systemd/porkcron.timer (for systemd) or docker/crontab (for Docker).

Configuring a web server

This repository contains an example for the nginx web server, but you can use porkcron with the one of your choice. See Mozilla's SSL config generator for a quick start.

For nginx, see nginx/nginx.conf for a minimal SSL-ready config. You should modify it for your needs.

If you're using systemd, copy the modified config to /etc/nginx/conf.d and reload nginx. Then uncomment the ExecStartPost line in systemd/porkcron.service.

If you're using Docker, just uncomment the nginx section in docker/compose.yml.

Finally, reinstall porkcron to apply the changes and try hitting https://your.domain. The rest is up to you, happy hacking!

porkcron's People

Contributors

tmzane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

porkcron's Issues

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.