mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-03-25 02:21:02 +01:00
Updated Gitlab hook script (markdown)
@@ -9,22 +9,23 @@ The script pushes the challenge to the pages git defined in $REPO, waits for it
|
||||
#
|
||||
# dehydrated hook script to deploy a key to Gitlab.
|
||||
#
|
||||
# https://github.com/lukas2511/dehydrated/wiki/Gitlab-hook-script
|
||||
#
|
||||
# Add the following options to your config file:
|
||||
# TOKEN= API token, generate in Gitlab profile settings (select API access)
|
||||
# PROJECT= ID or URL-encoded path of the project (replace / with %2F)
|
||||
# REPO= path to local git repo of your pages project
|
||||
# TOKEN= # API token, generate in Gitlab profile settings (select API access)
|
||||
# PROJECT= # ID or URL-encoded path of the project (replace / with %2F)
|
||||
# REPO= # path to local git repo of your pages project
|
||||
|
||||
. "$BASEDIR/$CONFIG"
|
||||
|
||||
deploy_challenge() {
|
||||
DOMAIN="$1"
|
||||
TOKEN_FILENAME="$2"
|
||||
cd "$REPO"
|
||||
mkdir -p public/.well-known/acme-challenge
|
||||
cp "$WELLKNOWN/$TOKEN_FILENAME" public/.well-known/acme-challenge/
|
||||
git add public/.well-known/acme-challenge/"$TOKEN_FILENAME"
|
||||
git commit -m "Let's Encrypt challenge"
|
||||
git push
|
||||
mkdir -p "$REPO/public/.well-known/acme-challenge"
|
||||
cp "$WELLKNOWN/$TOKEN_FILENAME" "$REPO/public/.well-known/acme-challenge/"
|
||||
git -C "$REPO" add public/.well-known/acme-challenge/"$TOKEN_FILENAME"
|
||||
git -C "$REPO" commit -m "Let's Encrypt challenge"
|
||||
git -C "$REPO" push
|
||||
sleep 20
|
||||
while ! curl --output /dev/null --silent --head --fail "http://$DOMAIN/.well-known/acme-challenge/$TOKEN_FILENAME"; do
|
||||
echo sleeping
|
||||
@@ -34,11 +35,11 @@ deploy_challenge() {
|
||||
|
||||
clean_challenge() {
|
||||
TOKEN_FILENAME="$2"
|
||||
cd "$REPO"
|
||||
git reset --hard HEAD~
|
||||
git push --force-with-lease
|
||||
git -C "$REPO" reset --hard HEAD~
|
||||
git -C "$REPO" push --force-with-lease
|
||||
}
|
||||
|
||||
# https://docs.gitlab.com/ee/api/pages_domains.html
|
||||
deploy_cert() {
|
||||
DOMAIN="$1"
|
||||
KEYFILE="$2"
|
||||
|
||||
Reference in New Issue
Block a user