-
Notifications
You must be signed in to change notification settings - Fork 0
Sync #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync #16
Changes from all commits
74769fd
35b557e
b47ec15
33b51d0
d46e64d
b0efef1
f0dbd1e
3f79957
a930807
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,7 +7,12 @@ while true; do | |||||||||
| for path in "${WWWDATA_PATHS[@]}"; do | ||||||||||
| if [[ -d "$path" ]]; then | ||||||||||
| echo "[INFO] Setting permissions for $path to $WWDATA_PERMISSION_CODE" | ||||||||||
| chmod -R "$WWDATA_PERMISSION_CODE" "$path" | ||||||||||
| FINAL_PERMCODE="$WWDATA_PERMISSION_CODE" | ||||||||||
| if [[ "$path" == "/run/php" ]]; then | ||||||||||
| FINAL_PERMCODE=0777 | ||||||||||
| echo "[INFO] Special case for $path: setting permissions to $FINAL_PERMCODE" | ||||||||||
|
Comment on lines
+12
to
+13
|
||||||||||
| FINAL_PERMCODE=0777 | |
| echo "[INFO] Special case for $path: setting permissions to $FINAL_PERMCODE" | |
| FINAL_PERMCODE=0750 | |
| echo "[INFO] Special case for $path: setting permissions to $FINAL_PERMCODE (restricted for PHP-FPM runtime)" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17,15 +17,31 @@ if ! checkDir $sslDirPath; then | |||||
| fi | ||||||
|
|
||||||
| WEBROOT_OPTS="--webroot --webroot-path $certStuffRoot" | ||||||
| CLOUDFLARE_USED=false | ||||||
| if [ -f "/cloudflare-account.ini" ]; then | ||||||
| echo "Using CloudFlare API for DNS" | ||||||
| WEBROOT_OPTS="--dns-cloudflare --dns-cloudflare-credentials /cloudflare-account.ini" | ||||||
| unset CLOUDFLARE_USED | ||||||
| CLOUDFLARE_USED=true | ||||||
| fi | ||||||
|
|
||||||
| echo "Creating a cert for ${1}" | ||||||
| certbot certonly --config-dir $sslDirPath $WEBROOT_OPTS -n --agree-tos --register-unsafely-without-email -d ${1} | ||||||
| if [ $? -ne 0 ]; then | ||||||
| echo "[Failure] Unable to create certificate '${1}' due to an error" | ||||||
| if [ $CLOUDFLARE_USED = true ]; then | ||||||
|
||||||
| if [ $CLOUDFLARE_USED = true ]; then | |
| if [ "$CLOUDFLARE_USED" = true ]; then |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ checkFile() { | |
|
|
||
| certStuffRoot="/web/cert_webroot" | ||
| sslDirPath="/web/ssl" | ||
| sslLiveDirPath="/web/ssl/live" | ||
| logFile="/scripts/letsencrypt/letsencrypt-renew.log" | ||
|
|
||
| if ! checkDir $certStuffRoot; then | ||
|
|
@@ -26,10 +27,39 @@ if ! checkFile $logFile; then | |
| touch $logFile | ||
| fi | ||
|
|
||
| WEBROOT_OPTS="--webroot --webroot-path $certStuffRoot" | ||
| if [ -f "/cloudflare-account.ini" ]; then | ||
| echo "Using CloudFlare API for DNS" | ||
| WEBROOT_OPTS="--dns-cloudflare --dns-cloudflare-credentials /cloudflare-account.ini" | ||
| fi | ||
| function renew() { | ||
| local certName="$1" | ||
| local WEBROOT_OPTS="--webroot --webroot-path $certStuffRoot" | ||
| local CLOUDFLARE_USED=false | ||
| if [ -f "/cloudflare-account.ini" ]; then | ||
| echo "Using CloudFlare API for DNS" | ||
| WEBROOT_OPTS="--dns-cloudflare --dns-cloudflare-credentials /cloudflare-account.ini" | ||
| CLOUDFLARE_USED=true | ||
| fi | ||
| echo "Renewing certificate for $certName" | ||
| certbot renew --config-dir $sslDirPath $WEBROOT_OPTS --cert-name "$certName" | ||
| if [ $? -ne 0 ]; then | ||
| echo "Failed to renew certificate for $certName" | ||
| if [ "$CLOUDFLARE_USED" = true ]; then | ||
| echo "Please check your CloudFlare API credentials and permissions. Using webroot method as a fallback." | ||
| unset WEBROOT_OPTS | ||
| WEBROOT_OPTS="--webroot --webroot-path $certStuffRoot" | ||
| certbot renew --config-dir $sslDirPath $WEBROOT_OPTS --cert-name "$certName" | ||
| if [ $? -ne 0 ]; then | ||
| echo "Failed to renew certificate for $certName using webroot method as well." | ||
| return 1 | ||
| else | ||
| echo "Successfully renewed certificate for $certName using webroot method." | ||
| return 0 | ||
| fi | ||
| fi | ||
| return 1 | ||
| fi | ||
| } | ||
|
Comment on lines
+30
to
+58
|
||
|
|
||
| certbot renew --config-dir $sslDirPath $WEBROOT_OPTS >> /scripts/letsencrypt/letsencrypt-renew.log | ||
| for certPath in "$sslLiveDirPath"/*; do | ||
| if [ -d "$certPath" ]; then | ||
| certName=$(basename "$certPath") | ||
| renew "$certName" | ||
| fi | ||
| done | ||
|
Comment on lines
+60
to
+65
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -21,5 +21,8 @@ function reloadService() { | |||||
| echo "$service_name started successfully." | ||||||
| } | ||||||
|
|
||||||
| chmod 0777 -R /run/php | ||||||
|
||||||
| chmod 0777 -R /run/php | |
| chmod 0750 -R /run/php |
Uh oh!
There was an error while loading. Please reload this page.