parent
317d6b0e3a
commit
628f37fa37
@ -0,0 +1,38 @@ |
|||||||
|
#!/bin/bash |
||||||
|
die() { echo >&2 "$@" ; exit 1 ; } |
||||||
|
|
||||||
|
DIRNAME="$(dirname $0)" |
||||||
|
cd "$DIRNAME" |
||||||
|
|
||||||
|
source ../env.production || die "no top levle env?" |
||||||
|
source env.production || die "no local env?" |
||||||
|
source env.secrets || die "no local secrets?" |
||||||
|
|
||||||
|
# try to get the clients by name |
||||||
|
CLIENT_NAME="$1" |
||||||
|
if [ -z "$CLIENT_NAME" ]; then |
||||||
|
die "usage: $0 clientName" |
||||||
|
fi |
||||||
|
|
||||||
|
CLIENT_ID="$(docker-compose exec -T keycloak \ |
||||||
|
/opt/keycloak/bin/kcadm.sh \ |
||||||
|
get clients \ |
||||||
|
--server http://localhost:8080/ \ |
||||||
|
--user admin \ |
||||||
|
--password "$KEYCLOAK_ADMIN_PASSWORD" \ |
||||||
|
-r "$REALM" \ |
||||||
|
| jq -r ".[] | select( .clientId == \"$CLIENT_NAME\" ).id")" |
||||||
|
|
||||||
|
if [ -z "$CLIENT_ID" ]; then |
||||||
|
die "$CLIENT_NAME: no such client" |
||||||
|
fi |
||||||
|
|
||||||
|
echo "$0: $CLIENT_NAME = $CLIENT_ID" |
||||||
|
docker-compose exec -T keycloak \ |
||||||
|
/opt/keycloak/bin/kcadm.sh \ |
||||||
|
delete "clients/$CLIENT_ID" \ |
||||||
|
--server http://localhost:8080/ \ |
||||||
|
--user admin \ |
||||||
|
--password "$KEYCLOAK_ADMIN_PASSWORD" \ |
||||||
|
-r "$REALM" \ |
||||||
|
|| die "$CLIENT_NAME($CLIENT_ID): unable to remove" |
@ -1 +0,0 @@ |
|||||||
KEYCLOAK_ADMIN_PASSWORD=abcd@1234! |
|
@ -1 +1 @@ |
|||||||
NEXTCLOUD_ADMIN_PASSWORD=admin |
# non-secret nextcloud config |
||||||
|
@ -1,28 +1,39 @@ |
|||||||
#!/bin/bash |
#!/bin/bash |
||||||
die() { echo >&2 "$@" ; exit 1 ; } |
die() { echo >&2 "$@" ; exit 1 ; } |
||||||
|
|
||||||
ENV=env.production |
DIRNAME="$(dirname $0)" |
||||||
if [ ! -r "$ENV" ]; then |
cd "$DIRNAME" |
||||||
die "$ENV: not found?" |
|
||||||
fi |
|
||||||
|
|
||||||
source ../env.production |
source ../env.production || die "no top level env" |
||||||
source env.production |
source env.production || die "no local env" |
||||||
|
|
||||||
if [ -z "${DOMAIN_NAME}" ]; then |
if [ -z "${DOMAIN_NAME}" ]; then |
||||||
die "DOMAIN_NAME not set" |
die "DOMAIN_NAME not set" |
||||||
fi |
fi |
||||||
|
|
||||||
|
docker-compose down |
||||||
|
|
||||||
certdir="data/certbot/conf/live/${DOMAIN_NAME}" |
certdir="data/certbot/conf/live/${DOMAIN_NAME}" |
||||||
mkdir -p "$certdir" || die "$certdir: unable to make" |
mkdir -p "$certdir" || die "$certdir: unable to make" |
||||||
|
|
||||||
openssl req \ |
if [ ! -r "$certdir/privkey.pem" ]; then |
||||||
-x509 \ |
openssl req \ |
||||||
-newkey rsa:2048 \ |
-x509 \ |
||||||
-keyout "$certdir/privkey.pem" \ |
-newkey rsa:2048 \ |
||||||
-out "$certdir/fullchain.pem" \ |
-keyout "$certdir/privkey.pem" \ |
||||||
-sha256 \ |
-out "$certdir/fullchain.pem" \ |
||||||
-nodes \ |
-sha256 \ |
||||||
-days 365 \ |
-nodes \ |
||||||
-subj "/CN=${DOMAIN_NAME}'" \ |
-days 365 \ |
||||||
|| die "$certdir/privkey.pem: unable to create temp key" |
-subj "/CN=${DOMAIN_NAME}'" \ |
||||||
|
|| die "$certdir/privkey.pem: unable to create temp key" |
||||||
|
fi |
||||||
|
|
||||||
|
docker-compose up -d || die "unable to bring up nginx" |
||||||
|
|
||||||
|
echo "SLEEPING..." |
||||||
|
sleep 10 |
||||||
|
|
||||||
|
./certbot-renew || die "unable to create certs" |
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in new issue