Subversion Repositories ALCASAR

Rev

Rev 2870 | Rev 2881 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2870 Rev 2874
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#  $Id: alcasar.sh 2870 2020-10-27 23:16:41Z rexy $
2
#  $Id: alcasar.sh 2874 2020-10-31 13:54:28Z rexy $
3
 
3
 
4
# alcasar.sh
4
# alcasar.sh
5
# ALCASAR is a Free and open source NAC created by Franck BOUIJOUX (3abtux), Pascal LEVANT and Richard REY (Rexy)
5
# ALCASAR is a Free and open source NAC created by Franck BOUIJOUX (3abtux), Pascal LEVANT and Richard REY (Rexy)
6
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
7
#  team@alcasar.net
7
#  team@alcasar.net
Line 2076... Line 2076...
2076
## - Prepare Let's Encrypt ALCASAR configuration file           ##
2076
## - Prepare Let's Encrypt ALCASAR configuration file           ##
2077
##################################################################
2077
##################################################################
2078
letsencrypt()
2078
letsencrypt()
2079
{
2079
{
2080
	echo "Installing Let's Encrypt client..."
2080
	echo "Installing Let's Encrypt client..."
2081
 
-
 
2082
	# Remove potential old installers
2081
	# Remove potential old installers
2083
	rm -rf /tmp/acme.sh-*
2082
	rm -rf /tmp/acme.sh-*
2084
 
-
 
2085
	# Extract acme.sh
2083
	# Extract acme.sh
2086
	tar xzf ./conf/letsencrypt-client/acme.sh-*.tar.gz -C /tmp/
2084
	tar xzf ./conf/letsencrypt-client/acme.sh-*.tar.gz -C /tmp/
2087
 
-
 
2088
	pwdInstall=$(pwd)
2085
	pwdInstall=$(pwd)
2089
	cd /tmp/acme.sh-* || { echo "Unable to find ACME directory"; exit 1; }
2086
	cd /tmp/acme.sh-* || { echo "Unable to find ACME directory"; exit 1; }
2090
 
-
 
2091
	acmesh_installDir="/opt/acme.sh"
2087
	acmesh_installDir="/opt/acme.sh"
2092
	acmesh_confDir="/usr/local/etc/letsencrypt"
2088
	acmesh_confDir="/usr/local/etc/letsencrypt"
2093
	acmesh_userAgent="ALCASAR"
2089
	acmesh_userAgent="ALCASAR"
2094
 
-
 
2095
	# Install acme.sh
2090
	# Install acme.sh
2096
	./acme.sh --install \
2091
	./acme.sh --install \
2097
		--home $acmesh_installDir \
2092
		--home $acmesh_installDir \
2098
		--config-home $acmesh_confDir/data \
2093
		--config-home $acmesh_confDir/data \
2099
		--certhome $acmesh_confDir/certs \
2094
		--certhome $acmesh_confDir/certs \
2100
		--accountkey $acmesh_confDir/ca/account.key \
2095
		--accountkey $acmesh_confDir/ca/account.key \
2101
		--accountconf $acmesh_confDir/data/account.conf \
2096
		--accountconf $acmesh_confDir/data/account.conf \
2102
		--useragent $acmesh_userAgent \
2097
		--useragent $acmesh_userAgent \
2103
		--nocron \
2098
		--nocron \
2104
		> /dev/null
2099
		> /dev/null
2105
 
-
 
2106
	if [ $? -ne 0 ]; then
2100
	if [ $? -ne 0 ]; then
2107
		echo "Error during installation of Let's Encrypt client (acme.sh)."
2101
		echo "Error during installation of Let's Encrypt client (acme.sh)."
2108
	fi
2102
	fi
2109
 
-
 
2110
	# Create configuration file
2103
	# Create configuration file
2111
	cat <<EOF > /usr/local/etc/alcasar-letsencrypt
2104
	cat <<EOF > /usr/local/etc/alcasar-letsencrypt
2112
email=
2105
email=
2113
dateIssueRequest=
2106
dateIssueRequest=
2114
domainRequest=
2107
domainRequest=
2115
challenge=
2108
challenge=
2116
dateIssued=
2109
dateIssued=
2117
dnsapi=
2110
dnsapi=
2118
dateNextRenewal=
2111
dateNextRenewal=
2119
EOF
2112
EOF
2120
 
-
 
2121
	cd $pwdInstall || { echo "Unable to find $pwdInstall directory"; exit 1; }
2113
	cd $pwdInstall || { echo "Unable to find $pwdInstall directory"; exit 1; }
2122
	rm -rf /tmp/acme.sh-*
2114
	rm -rf /tmp/acme.sh-*
2123
 
-
 
2124
} # End of letsencrypt()
2115
} # End of letsencrypt()
2125
 
2116
 
2126
##################################################################
2117
##################################################################
2127
##                    Fonction "post_install"                   ##
2118
##                    Fonction "post_install"                   ##
2128
## - Modifying banners (locals et ssh) & prompts                ##
2119
## - Modifying banners (locals et ssh) & prompts                ##