#!/bin/bash
#  certbot - LetsEncrypt certbot support library

set -e


######
# Settings

sec_tool_certbot_config_init() {
	lib_setting_arrays certbot_bin certbot_opts

	# Our downloaded certbot executable
	certbot_bin="$datadir/bin/certbot-auto"

	# Default options for certbot
	certbot_opts=( )
}

######
# Certbot support

run_certbot() {
	[ -f "$certbot_bin" ] || certbot_download
	run_sudo "$certbot_bin" "${certbot_opts[@]}" "$@"
}

certbot_download() {
	local dir
	dir=$(dirname "$certbot_bin")
	run_mkdir "$dir"
	run wget -P "$dir" https://dl.eff.org/certbot-auto
	run chmod a+x "$certbot_bin"
}

certbot_request() {
	min_args 1 "$@"
	local -a request_opts
	for_each "list_append request_opts -d" "$@"
	run_certbot "${request_opts[@]}" certonly
}

certbot_renew() {
	local log
	log=$(script_log_filename "renew")
	file_mkdir "$log"

	log_rotate "$log" 8

	local -a certbot_opts=( )
	run_certbot renew "$@" >"$log" 2>&1
	in_list --quiet "$@" || cat "$log"
}

View the Developer Guide Index

View the Reference Manual Index


Generated on Fri Jul 28 14:35:57 PDT 2017 by mcsh d14 v0.23.0.