#!/bin/bash # Let's encrypt certbot installation on Raspbian # # Copyleft 2017 by Ignacio Nunez Hernanz # GPL licensed (see end of file) * Use at your own risk! # # More at https://ownyourbits.com/2017/03/17/lets-encrypt-installer-for-apache/ DOMAIN_=mycloud.ownyourbits.com EMAIL_=mycloud@ownyourbits.com NOTIFYUSER_=ncp NCDIR=/var/www/nextcloud OCC="$NCDIR/occ" VHOSTCFG=/etc/apache2/sites-available/nextcloud.conf VHOSTCFG2=/etc/apache2/sites-available/ncp.conf DESCRIPTION="Automatic signed SSL certificates" INFOTITLE="Warning" INFO="Internet access is required for this configuration to complete Both ports 80 and 443 need to be accessible from the internet Your certificate will be automatically renewed every month" is_active() { [[ $( find /etc/letsencrypt/live/ -maxdepth 0 -empty | wc -l ) == 0 ]] } install() { cd /etc || return 1 apt-get update apt-get install --no-install-recommends -y letsencrypt mkdir -p /etc/letsencrypt/live [[ "$DOCKERBUILD" == 1 ]] && { # execute before lamp stack cat > /etc/services-available.d/009letsencrypt < /etc/cron.weekly/letsencrypt-ncp </dev/null & rm -rf $NCDIR/.well-known # Update configuration [[ "$DOCKERBUILD" == 1 ]] && update-rc.d letsencrypt enable return 0 } rm -rf $NCDIR/.well-known return 1 } # License # # This script is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This script is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this script; if not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, # Boston, MA 02111-1307 USA