Adapt for the rename to dehydrated

tags/smeserver-letsencrypt-client-0.2.4-1
Daniel Berteaud 8 years ago
parent fe296869b3
commit ded0c3eb5e
  1. 8
      createlinks
  2. 0
      root/etc/dehydrated/hooks_clean_challenge.d/10smeserver.sh
  3. 0
      root/etc/dehydrated/hooks_deploy_cert.d/10smeserver.sh
  4. 26
      root/etc/e-smith/db/configuration/migrate/Letsencrypt.sh2Dehydrated
  5. 11
      root/etc/e-smith/templates/etc/cron.daily/dehydrated/10All
  6. 11
      root/etc/e-smith/templates/etc/cron.daily/letsencrypt.sh/10All
  7. 0
      root/etc/e-smith/templates/etc/dehydrated/config/10Uri
  8. 2
      root/etc/e-smith/templates/etc/dehydrated/config/20BaseDir
  9. 0
      root/etc/e-smith/templates/etc/dehydrated/config/30WellKnown
  10. 0
      root/etc/e-smith/templates/etc/dehydrated/config/40KeySize
  11. 0
      root/etc/e-smith/templates/etc/dehydrated/config/50Hook
  12. 0
      root/etc/e-smith/templates/etc/dehydrated/config/60Renew
  13. 0
      root/etc/e-smith/templates/etc/dehydrated/domains.txt/10domains
  14. 0
      root/etc/e-smith/templates/etc/dehydrated/domains.txt/template-begin
  15. 2
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/80LetsencryptChallengeDir
  16. 2
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/Ejabberd/80Letsencrypt
  17. 2
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/LemonLDAPManager/80Letsencrypt
  18. 2
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/LemonLDAPPortal/80Letsencrypt
  19. 2
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/LemonLDAPSoap/80Letsencrypt
  20. 2
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/UserManagerVirtualHost/80Letsencrypt
  21. 2
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/80Letsencrypt
  22. 2
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost/80Letsencrypt
  23. 2
      root/etc/e-smith/templates/etc/letsencrypt.sh/config/20BaseDir
  24. 4
      root/sbin/e-smith/dehydrated
  25. 18
      smeserver-letsencrypt-client.spec

@ -2,9 +2,9 @@
use esmith::Build::CreateLinks qw(:all);
templates2events("/etc/letsencrypt.sh/config", qw(letsencrypt-update bootstrap-console-save));
templates2events("/etc/cron.daily/letsencrypt.sh", qw(letsencrypt-update));
templates2events("/etc/letsencrypt.sh/domains.txt",
templates2events("/etc/dehydrated/config", qw(letsencrypt-update bootstrap-console-save));
templates2events("/etc/cron.daily/dehydrated", qw(letsencrypt-update));
templates2events("/etc/dehydrated/domains.txt",
qw(
letsencrypt-update
bootstrap-console-save
@ -16,4 +16,4 @@ templates2events("/etc/letsencrypt.sh/domains.txt",
));
templates2events("/etc/httpd/conf/httpd.conf", qw(letsencrypt-update));
safe_symlink("sigusr1", "root/etc/e-smith/events/letsencrypt-update/services2adjust/httpd-e-smith");
safe_symlink("/etc/e-smith/templates-default/template-begin-shell", "root/etc/e-smith/templates/etc/cron.daily/letsencrypt.sh/template-begin");
safe_symlink("/etc/e-smith/templates-default/template-begin-shell", "root/etc/e-smith/templates/etc/cron.daily/dehydrated/template-begin");

@ -0,0 +1,26 @@
{
my $ssl = $DB->get('modSSL');
my $crt = $ssl->prop('crt');
my $key = $ssl->prop('key');
my $chain = $ssl->prop('CertificateChainFile');
return unless (
defined $crt &&
defined $key &&
defined $chain
);
my ($new_crt, $new_key, $new_chain) = ($crt, $key, $chain);
$new_crt =~ s|/home/e-smith/db/letsencrypt\.sh|/home/e-smith/db/dehydrated|;
$new_key =~ s|/home/e-smith/db/letsencrypt\.sh|/home/e-smith/db/dehydrated|;
$new_chain =~ s|/home/e-smith/db/letsencrypt\.sh|/home/e-smith/db/dehydrated|;
return unless (
$crt ne $new_crt &&
$key ne $new_key &&
$chain ne $new_chain
);
$ssl->set_prop('crt', $crt);
$ssl->set_prop('key', $key);
$ssl->set_prop('CertificateChainFile', $new_chain);
}

@ -0,0 +1,11 @@
{
if (($letsencrypt{'status'} || 'disabled') eq 'enabled'){
$OUT .= 'sleep $[ $RANDOM % 3600 ];' . "\n";
$OUT .= "/sbin/e-smith/dehydrated -c 2>&1 | awk '{ print strftime(), \$0; fflush(); }' >> /var/log/dehydrated.log\n";
if (($letsencrypt{'RevokeOldCertificates'} || 'disabled') =~ m/^enabled|on|yes|1$/){
$OUT .= "/usr/bin/dehydrated_revoke 2>&1 | awk '{ print strftime(), \$0; fflush(); }' >> /var/log/dehydrated.log\n";
}
}
}

@ -1,11 +0,0 @@
{
if (($letsencrypt{'status'} || 'disabled') eq 'enabled'){
$OUT .= 'sleep $[ $RANDOM % 3600 ];' . "\n";
$OUT .= "/sbin/e-smith/letsencrypt.sh -c 2>&1 | awk '{ print strftime(), \$0; fflush(); }' >> /var/log/letsencrypt.sh.log\n";
if (($letsencrypt{'RevokeOldCertificates'} || 'disabled') =~ m/^enabled|on|yes|1$/){
$OUT .= "/usr/bin/le_revoke.sh 2>&1 | awk '{ print strftime(), \$0; fflush(); }' >> /var/log/letsencrypt.sh.log\n";
}
}
}

@ -0,0 +1,2 @@
BASEDIR=/home/e-smith/db/dehydrated/
DOMAINS_TXT=/etc/dehydrated/domains.txt

@ -2,7 +2,7 @@
if (($letsencrypt{'status'} || 'disabled') eq 'enabled'){
$OUT .=<<"_EOF";
<Directory /var/lib/letsencrypt.sh/challenges>
<Directory /var/lib/dehydrated/challenges>
Options None
AllowOverride None
Order deny,allow

@ -1,7 +1,7 @@
{
if (($domain->prop('Letsencrypt') || 'enabled') ne 'disabled' && ((${'httpd-e-smith'}{'TCPPort'} || '80') eq $port)){
$OUT .=<<"_EOF";
Alias /.well-known/acme-challenge/ /var/lib/letsencrypt.sh/challenges/
Alias /.well-known/acme-challenge/ /var/lib/dehydrated/challenges/
<Location /.well-known/acme-challenge/>
Allow from all
</Location>

@ -1,7 +1,7 @@
{
if (($domain->prop('Letsencrypt') || 'enabled') ne 'disabled' && ((${'httpd-e-smith'}{'TCPPort'} || '80') eq $port)){
$OUT .=<<"_EOF";
Alias /.well-known/acme-challenge/ /var/lib/letsencrypt.sh/challenges/
Alias /.well-known/acme-challenge/ /var/lib/dehydrated/challenges/
<Location /.well-known/acme-challenge/>
Allow from all
</Location>

@ -1,7 +1,7 @@
{
if (($domain->prop('Letsencrypt') || 'enabled') ne 'disabled' && ((${'httpd-e-smith'}{'TCPPort'} || '80') eq $port)){
$OUT .=<<"_EOF";
Alias /.well-known/acme-challenge/ /var/lib/letsencrypt.sh/challenges/
Alias /.well-known/acme-challenge/ /var/lib/dehydrated/challenges/
<Location /.well-known/acme-challenge/>
Allow from all
</Location>

@ -1,7 +1,7 @@
{
if (($domain->prop('Letsencrypt') || 'enabled') ne 'disabled' && ((${'httpd-e-smith'}{'TCPPort'} || '80') eq $port)){
$OUT .=<<"_EOF";
Alias /.well-known/acme-challenge/ /var/lib/letsencrypt.sh/challenges/
Alias /.well-known/acme-challenge/ /var/lib/dehydrated/challenges/
<Location /.well-known/acme-challenge/>
Allow from all
</Location>

@ -1,7 +1,7 @@
{
if (($domain->prop('Letsencrypt') || 'enabled') ne 'disabled' && ((${'httpd-e-smith'}{'TCPPort'} || '80') eq $port)){
$OUT .=<<"_EOF";
Alias /.well-known/acme-challenge/ /var/lib/letsencrypt.sh/challenges/
Alias /.well-known/acme-challenge/ /var/lib/dehydrated/challenges/
<Location /.well-known/acme-challenge/>
Allow from all
</Location>

@ -1,4 +1,4 @@
Alias /.well-known/acme-challenge/ /var/lib/letsencrypt.sh/challenges/
Alias /.well-known/acme-challenge/ /var/lib/dehydrated/challenges/
<Location /.well-known/acme-challenge/>
Allow from all
</Location>

@ -1,4 +1,4 @@
Alias /.well-known/acme-challenge/ /var/lib/letsencrypt.sh/challenges/
Alias /.well-known/acme-challenge/ /var/lib/dehydrated/challenges/
<Location /.well-known/acme-challenge/>
Allow from all
</Location>

@ -1,2 +0,0 @@
BASEDIR=/home/e-smith/db/letsencrypt.sh/
DOMAINS_TXT=/etc/letsencrypt.sh/domains.txt

@ -30,8 +30,8 @@ if (@domains > 0){
event_signal("letsencrypt-update");
}
# Execute the real letsencrypt script, passing any arg
system("/usr/bin/letsencrypt.sh", @ARGV);
# Execute the real dehydrated script, passing any arg
system("/usr/bin/dehydrated", @ARGV);
# Enable proxypass again
if (@domains > 0){

@ -15,11 +15,11 @@ BuildArchitectures: noarch
BuildRequires: e-smith-devtools
Requires: e-smith-base
Requires: letsencrypt.sh
Requires: dehydrated
%description
Automatically get certificates from letsencrypt
Using https://github.com/lukas2511/letsencrypt.sh
Using https://github.com/lukas2511/dehydrated
%changelog
* Mon Jun 27 2016 Daniel Berteaud <daniel@firewall-services.com> - 0.1.10-1.sme
@ -66,7 +66,7 @@ Using https://github.com/lukas2511/letsencrypt.sh
%setup -q -n %{name}-%{version}
%build
%{__mkdir_p} root/home/e-smith/db/letsencrypt.sh
%{__mkdir_p} root/home/e-smith/db/dehydrated
perl createlinks
%install
@ -74,9 +74,9 @@ perl createlinks
(cd root; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT)
/bin/rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
--dir /home/e-smith/db/letsencrypt.sh 'attr(0750,root,root)' \
--file /etc/letsencrypt.sh/hooks_deploy_cert.d/10smeserver.sh 'attr(0755,root,root)' \
--file /etc/letsencrypt.sh/hooks_clean_challenge.d/10smeserver.sh 'attr(0755,root,root)' \
--dir /home/e-smith/db/dehydrated 'attr(0750,root,root)' \
--file /etc/dehydrated/hooks_deploy_cert.d/10smeserver.sh 'attr(0755,root,root)' \
--file /etc/dehydrated/hooks_clean_challenge.d/10smeserver.sh 'attr(0755,root,root)' \
> %{name}-%{version}-filelist
%clean
@ -88,4 +88,8 @@ rm -rf $RPM_BUILD_ROOT
%pre
%post
# Migrate from letsencrypt.sh to dehydrated
if [ -d /home/e-smith/db/letsencrypt.sh/ ]; then
mv /home/e-smith/db/letsencrypt.sh/* /home/e-smith/db/dehydrated/
rmdir /home/e-smith/db/letsencrypt.sh/
fi

Loading…
Cancel
Save