Skip to content

Commit

Permalink
Fix #73 / #75 : rename all to acme
Browse files Browse the repository at this point in the history
* Certbot is any more local name, we use acme by default
* certbot is only binary used to get certificate
  • Loading branch information
camlafit committed May 3, 2022
1 parent 80e995a commit 934e569
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
8 changes: 4 additions & 4 deletions debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ case "$1" in

if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
#Jessie, Stretch
ln -sf /etc/alternc/alternc-certbot.conf /etc/apache2/conf-available/alternc-certbot.conf
ln -sf /etc/alternc/alternc-acme.conf /etc/apache2/conf-available/alternc-acme.conf
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke enconf alternc-certbot > /dev/null 2>&1 || true
apache2_invoke enconf alternc-acme > /dev/null 2>&1 || true
else
#Wheezy
ln -s /etc/alternc/alternc-certbot.conf /etc/apache2/conf.d/alternc-certbot.conf
ln -s /etc/alternc/alternc-acme.conf /etc/apache2/conf.d/alternc-acme.conf
invoke-rc.d apache2 force-reload > /dev/null 2>&1 || true
fi

chmod 744 /etc/cron.d/alternc-certbot
chmod 744 /etc/cron.d/alternc-acme

echo -e "\033[31m**********************************************"
echo "* *"
Expand Down
6 changes: 3 additions & 3 deletions debian/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ case "$1" in
if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
#Jessie, Stretch
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke disconf alternc-certbot > /dev/null 2>&1 || true
rm -f /etc/apache2/conf-available/alternc-certbot.conf
apache2_invoke disconf alternc-acme > /dev/null 2>&1 || true
rm -f /etc/apache2/conf-available/alternc-acme.conf
else
#Wheezy
rm -f /etc/apache2/conf.d/alternc-certbot.conf
rm -f /etc/apache2/conf.d/alternc-acme.conf
invoke-rc.d apache2 force-reload > /dev/null 2>&1 || true
fi
# Run also specific purge action
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# alternc-certbot default Apache configuration
# alternc-acme default Apache configuration
# Symlink following apache2.x version

Alias /.well-known/acme-challenge/ "/var/lib/acme/.well-known/acme-challenge/"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Twice a day, every 12 hours :
# - renew the certificate of the panel (alternc-cerbot)
# - generate or renew the certificates of every domain available (generate_certbot.php via alternc-certbot)
0 */12 * * * root /usr/lib/alternc/install.d/alternc-certbot apache2 --quiet --all
# - generate or renew the certificates of every domain available (generate_acme.php via alternc-acme)
0 */12 * * * root /usr/lib/alternc/install.d/alternc-acme apache2 --quiet --all
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ function vprint( $message, $params ){
if ($REQUEST_CERTS == 'all' || $REQUEST_CERTS == 'system') {
foreach($ssl->get_fqdn_specials() as $specialfqdn) {
vprint( _("\r$spacer\rRequesting domain %s"), array( $specialfqdn ));
if( ! $certbot->isLocalAlterncDomain( $specialfqdn ) ){
if( ! $acme->isLocalAlterncDomain( $specialfqdn ) ){
continue;
}
vprint( _(" hosted locally, running certbot..."), array( ));
vprint( _(" hosted locally, running acme..."), array( ));

$certbot->import($specialfqdn);
$acme->import($specialfqdn);
}
vprintf(_("\rFinished renewal for system certificates\n"), array());
}
Expand Down Expand Up @@ -123,7 +123,7 @@ function vprint( $message, $params ){
// Need to request anything:
if( count( $domainsList ) ){

vprint( _("Requiring Certbot renewal for %s domains\n"), count( $domainsList ));
vprint( _("Requiring acme renewal for %s domains\n"), count( $domainsList ));
foreach ($domainsList as $key => $sub_domain) {
$mem->su($sub_domain["cuid"]);
// Check if we already have a valid cert for this domain (valid for more than $VALID_DAYS days
Expand All @@ -150,19 +150,19 @@ function vprint( $message, $params ){

// not found or invalid or expired soon, let's get one:
vprint( _("\r$spacer\rRequesting domain %d/%d: %s"), array( $key + 1, count( $domainsList),$sub_domain["sub_domain"]["fqdn"] ));
if( ! $certbot->isLocalAlterncDomain( $sub_domain["sub_domain"]["fqdn"] ) ){
if( ! $acme->isLocalAlterncDomain( $sub_domain["sub_domain"]["fqdn"] ) ){
continue;
}
vprint( _(" hosted locally, running certbot..."), array( ));
$certbot->import($sub_domain["sub_domain"]["fqdn"]);
vprint( _(" hosted locally, running acme..."), array( ));
$acme->import($sub_domain["sub_domain"]["fqdn"]);
}
vprint( _("\nFinished Certbot renewal for non-system certificates"), count( $domainsList ));
vprint( _("\nFinished acme renewal for non-system certificates"), count( $domainsList ));
} else {
vprint( _("\nNo standard Certbot renewal for non-system-certificates"), count( $domainsList ));
vprint( _("\nNo standard acme renewal for non-system-certificates"), count( $domainsList ));
}
}
else {
vprint(_("Skipping non-system certificates, requested certificates type: %s"), array($REQUEST_CERTS));
}

vprint( _("\nFinished Certbot renewal\n"), array());
vprint( _("\nFinished acme renewal\n"), array());
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ fi
if [ "$1" == "apache2" ]; then

##Generate let's encrypt certificate
ALTERNC_REQUEST_CERTIFICATES="$ALTERNC_REQUEST_CERTIFICATES" /usr/lib/alternc/generate_certbot.php "$VERBOSE" "$CERTS"
ALTERNC_REQUEST_CERTIFICATES="$ALTERNC_REQUEST_CERTIFICATES" /usr/lib/alternc/generate_acme.php "$VERBOSE" "$CERTS"
fi
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ if ($argv[1] == "dns_reload_zone" && !empty($argv[2])) {
$db->query('select id, compte from domaines where domaine = ?',
array($domain_name));
if (!$db->next_record()) {
$err->log('certbot', 'reload.d - dns_reload_z<one - Unable to find domain information for ' . $domain_name);
$err->log('acme', 'reload.d - dns_reload_z<one - Unable to find domain information for ' . $domain_name);
exit -1;
}
$mem->su($db->f('compte'));

$dom->lock();
$domains = $dom->get_domain_all($domain_name);
$sub_domains = array();
$certbot->import($domain_name);
$acme->import($domain_name);
// Build a list of fqdns to import, excluding dns only entries.
// This reduces repeat calls to import for duplicate sub domains.
foreach ($domains['sub'] as $index => $sub_domain) {
Expand All @@ -33,7 +33,7 @@ if ($argv[1] == "dns_reload_zone" && !empty($argv[2])) {
}
}
foreach ($sub_domains as $fqdn) {
$certbot->import($fqdn);
$acme->import($fqdn);
}
$dom->unlock();
$mem->unsu();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
/**
* TLS Certificates management class
*/
class m_certbot
class m_acme
{

// -----------------------------------------------------------------
/**
* Constructor
*/
public function m_certbot()
public function m_acme()
{
}

Expand All @@ -50,7 +50,7 @@ public function m_certbot()
public function import($fqdn)
{
global $cuid, $msg, $ssl;
$msg->log("certbot", "import","$fqdn");
$msg->log("acme", "import","$fqdn");

$output = array();
$return_var = -1;
Expand All @@ -61,12 +61,12 @@ public function import($fqdn)
$key = file_get_contents('/etc/letsencrypt/live/'.$fqdn.'/privkey.pem');
$crt = file_get_contents('/etc/letsencrypt/live/'.$fqdn.'/cert.pem');
$chain = file_get_contents('/etc/letsencrypt/live/'.$fqdn.'/chain.pem');
$msg->log("certbot", "import","new cert $fqdn OK");
$msg->log("acme", "import","new cert $fqdn OK");

return $ssl->import_cert($key, $crt, $chain, "letsencrypt");
}
// Or log the error:
$msg->log("certbot", "import","import failed, log is ".implode("\n ",$output));
$msg->log("acme", "import","import failed, log is ".implode("\n ",$output));
return false;
}

Expand All @@ -92,4 +92,4 @@ public function isLocalAlterncDomain($fqdn)
}
}

/* Class m_certbot */
/* Class m_acme */

0 comments on commit 934e569

Please sign in to comment.