2017-01-27 11:00:22 +01:00
|
|
|
#
|
|
|
|
# spec file for package dehydrated
|
|
|
|
#
|
2018-01-15 12:59:16 +01:00
|
|
|
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
2017-01-27 11:00:22 +01:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
2017-02-13 07:49:05 +01:00
|
|
|
|
2017-09-27 18:31:31 +02:00
|
|
|
%define _challengedir %{_localstatedir}/lib/acme-challenge
|
2017-01-27 11:00:22 +01:00
|
|
|
%define _user dehydrated
|
2017-09-27 18:31:31 +02:00
|
|
|
%define _home %{_sysconfdir}/dehydrated
|
2017-10-06 12:52:01 +02:00
|
|
|
%define _postrunhooks %{_home}/postrun-hooks.d
|
2017-01-27 11:00:22 +01:00
|
|
|
|
2017-02-13 07:49:05 +01:00
|
|
|
%if 0%{?suse_version} > 1230
|
|
|
|
%define _lock_dir /run/dehydrated
|
2017-09-27 18:31:31 +02:00
|
|
|
%bcond_without systemd
|
2017-02-13 07:49:05 +01:00
|
|
|
%else
|
2017-09-27 18:31:31 +02:00
|
|
|
%define _lock_dir %{_localstatedir}/run/dehydrated
|
2017-02-13 07:49:05 +01:00
|
|
|
%bcond_with systemd
|
|
|
|
%endif
|
|
|
|
|
2017-10-06 12:52:01 +02:00
|
|
|
%if 0%{?is_opensuse} || %{defined fedora}
|
2017-02-13 07:49:05 +01:00
|
|
|
%bcond_without nginx
|
|
|
|
%bcond_without lighttpd
|
2017-09-27 18:31:31 +02:00
|
|
|
%else
|
|
|
|
%bcond_with nginx
|
|
|
|
%bcond_with lighttpd
|
2017-02-13 07:49:05 +01:00
|
|
|
%endif
|
2017-09-27 18:31:31 +02:00
|
|
|
%{!?_tmpfilesdir: %global _tmpfilesdir %{_prefix}/lib/tmpfiles.d }
|
|
|
|
# See also http://en.opensuse.org/openSUSE:Specfile_guidelines
|
2017-02-13 07:49:05 +01:00
|
|
|
|
2017-09-27 18:31:31 +02:00
|
|
|
%if 0%{?suse_version}
|
|
|
|
%define _apache apache2
|
|
|
|
%else
|
|
|
|
%define _apache httpd
|
|
|
|
%endif
|
2017-02-13 07:49:05 +01:00
|
|
|
|
2017-01-27 11:00:22 +01:00
|
|
|
Name: dehydrated
|
2018-01-15 12:59:16 +01:00
|
|
|
Version: 0.5.0
|
2017-01-27 11:00:22 +01:00
|
|
|
Release: 0
|
|
|
|
Summary: A client for signing certificates with an ACME server
|
|
|
|
License: MIT
|
|
|
|
Group: Productivity/Networking/Security
|
|
|
|
Url: https://github.com/lukas2511/dehydrated
|
|
|
|
Source0: %{name}-%{version}.tar.gz
|
2017-02-21 13:11:20 +01:00
|
|
|
Source1: acme-challenge.conf.apache.in
|
|
|
|
Source2: acme-challenge.conf.nginx.in
|
2017-02-13 07:49:05 +01:00
|
|
|
Source3: acme-challenge.conf.lighttpd.in
|
|
|
|
Source4: dehydrated.cron.in
|
|
|
|
Source5: dehydrated.tmpfiles.d
|
2017-09-27 18:31:31 +02:00
|
|
|
Source6: dehydrated.service.in
|
|
|
|
Source7: dehydrated.timer
|
|
|
|
Source9: README.SUSE
|
|
|
|
Source10: README.Fedora
|
2017-10-06 12:52:01 +02:00
|
|
|
Source11: README.hooks
|
2018-01-15 12:59:16 +01:00
|
|
|
Source12: %{name}-%{version}.tar.gz.asc
|
|
|
|
Source13: %{name}.keyring
|
2017-02-13 07:49:05 +01:00
|
|
|
BuildRequires: %{_apache}
|
2017-09-27 18:31:31 +02:00
|
|
|
Requires: coreutils
|
|
|
|
Requires: curl
|
|
|
|
Requires: openssl
|
2017-10-20 11:54:53 +02:00
|
|
|
Requires: sudo
|
2017-09-27 18:31:31 +02:00
|
|
|
Requires(pre): %{_bindir}/getent
|
|
|
|
Requires(pre): %{_sbindir}/groupadd
|
|
|
|
Requires(pre): %{_sbindir}/useradd
|
|
|
|
Obsoletes: letsencrypt.sh < %{version}
|
|
|
|
Provides: letsencrypt.sh = %{version}
|
2017-02-13 07:49:05 +01:00
|
|
|
%if %{with lighttpd}
|
|
|
|
BuildRequires: lighttpd
|
|
|
|
%endif
|
|
|
|
%if %{with nginx}
|
|
|
|
BuildRequires: nginx
|
|
|
|
%endif
|
2017-09-27 18:31:31 +02:00
|
|
|
%if %{defined fedora}
|
2017-02-13 07:49:05 +01:00
|
|
|
BuildRequires: generic-logos
|
|
|
|
BuildRequires: generic-logos-httpd
|
|
|
|
%endif
|
2017-01-27 11:00:22 +01:00
|
|
|
# openSUSE >= 12.3 has shadow, pwdutils is provided but obsoleted.
|
|
|
|
%if 0%{?suse_version} >= 1230
|
|
|
|
BuildRequires: shadow
|
|
|
|
%endif
|
2017-02-13 07:49:05 +01:00
|
|
|
%if %{with systemd}
|
|
|
|
BuildRequires: pkgconfig(systemd)
|
|
|
|
%{?systemd_requires}
|
2017-09-19 17:42:45 +02:00
|
|
|
%else #with_systemd
|
|
|
|
%if 0%{?suse_version}
|
|
|
|
Requires: cron
|
|
|
|
%endif
|
|
|
|
%endif #with_systemd
|
|
|
|
%if 0%{?suse_version}
|
|
|
|
Recommends: dehydrated-acmeresponder
|
2017-02-13 07:49:05 +01:00
|
|
|
%endif
|
2017-01-27 11:00:22 +01:00
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
2018-01-15 13:32:30 +01:00
|
|
|
BuildArch: noarch
|
2017-01-27 11:00:22 +01:00
|
|
|
|
|
|
|
%description
|
|
|
|
This is a client for signing certificates with an ACME server
|
|
|
|
(currently only provided by letsencrypt) implemented as a relatively
|
|
|
|
simple bash-script.
|
|
|
|
|
|
|
|
It uses the openssl utility for everything related to actually
|
|
|
|
handling keys and certificates, so you need to have that installed.
|
|
|
|
|
|
|
|
Other dependencies are: curl, sed, grep, mktemp (all found on almost
|
|
|
|
any system, curl being the only exception)
|
|
|
|
|
|
|
|
Current features:
|
|
|
|
|
|
|
|
* Signing of a list of domains
|
|
|
|
* Signing of a CSR
|
|
|
|
* Renewal if a certificate is about to expire or SAN (subdomains) changed
|
|
|
|
* Certificate revocation
|
|
|
|
|
|
|
|
%package %{_apache}
|
2017-09-27 18:31:31 +02:00
|
|
|
Summary: Apache Integration for dehydrated
|
|
|
|
Group: Productivity/Networking/Security
|
2017-02-13 07:49:05 +01:00
|
|
|
Requires: %{_apache}
|
|
|
|
Requires: %{name}
|
2017-09-27 18:31:31 +02:00
|
|
|
Obsoletes: letsencrypt.sh-%{_apache} < %{version}
|
|
|
|
Provides: letsencrypt.sh-%{_apache} = %{version}
|
2017-01-27 11:00:22 +01:00
|
|
|
%if ! 0%{?suse_version}
|
2017-02-13 07:49:05 +01:00
|
|
|
Requires: mod_ssl
|
2017-01-27 11:00:22 +01:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%description %{_apache}
|
|
|
|
This adds a configuration file for dehydrated's acme-challenge to Apache.
|
|
|
|
|
2017-02-13 07:49:05 +01:00
|
|
|
%if %{with nginx}
|
2017-01-27 11:00:22 +01:00
|
|
|
%package nginx
|
2017-09-27 18:31:31 +02:00
|
|
|
Summary: Nginx Integration for dehydrated
|
|
|
|
Group: Productivity/Networking/Security
|
2017-02-13 07:49:05 +01:00
|
|
|
Requires: %{name}
|
|
|
|
Requires: nginx
|
|
|
|
Obsoletes: letsencrypt.sh-nginx < %{version}
|
|
|
|
Provides: letsencrypt.sh-nginx = %{version}
|
2017-01-27 11:00:22 +01:00
|
|
|
|
|
|
|
%description nginx
|
|
|
|
This adds a configuration file for dehydrated's acme-challenge to nginx.
|
2017-02-13 07:49:05 +01:00
|
|
|
%endif #with nginx
|
|
|
|
|
|
|
|
%if %{with lighttpd}
|
|
|
|
%package lighttpd
|
|
|
|
Summary: Lighttpd Integration for dehydrated
|
|
|
|
Group: Productivity/Networking/Security
|
2017-09-27 18:31:31 +02:00
|
|
|
Requires: %{name}
|
|
|
|
Requires: lighttpd
|
2017-02-13 07:49:05 +01:00
|
|
|
|
|
|
|
%description lighttpd
|
|
|
|
This adds a configuration file for dehydrated's acme-challenge to lighttpd.
|
2017-09-27 18:31:31 +02:00
|
|
|
%endif #with lighttpd
|
2017-01-27 11:00:22 +01:00
|
|
|
|
|
|
|
%pre
|
2017-09-27 18:31:31 +02:00
|
|
|
getent group %{_user} >/dev/null || %{_sbindir}/groupadd -r %{_user}
|
|
|
|
getent passwd %{_user} >/dev/null || %{_sbindir}/useradd -g %{_user} \
|
2017-01-27 11:00:22 +01:00
|
|
|
-s /bin/false -r -c "%{_user}" -d %{_home} %{_user}
|
2017-09-27 18:31:31 +02:00
|
|
|
if [ -d %{_sysconfdir}/letsencrypt.sh ]; then mv %{_sysconfdir}/letsencrypt.sh %{_sysconfdir}/dehydrated; chown -R %{_user} %{_sysconfdir}/dehydrated; fi
|
|
|
|
if [ -e %{_sysconfdir}/dehydrated/config.sh ]; then mv %{_sysconfdir}/dehydrated/config.sh %{_sysconfdir}/dehydrated/config; fi
|
2017-01-27 11:00:22 +01:00
|
|
|
|
2017-02-13 07:49:05 +01:00
|
|
|
%if %{with systemd}
|
2017-09-27 18:31:31 +02:00
|
|
|
%service_add_pre dehydrated.service dehydrated.timer
|
2017-09-19 17:42:45 +02:00
|
|
|
|
2017-02-13 07:49:05 +01:00
|
|
|
%post
|
|
|
|
systemd-tmpfiles --create %{_tmpfilesdir}/%{name}.conf ||:
|
2017-09-27 18:31:31 +02:00
|
|
|
%service_add_post dehydrated.service dehydrated.timer
|
2017-09-19 17:42:45 +02:00
|
|
|
|
|
|
|
%preun
|
2017-09-27 18:31:31 +02:00
|
|
|
%service_del_preun dehydrated.service dehydrated.timer
|
2017-09-19 17:42:45 +02:00
|
|
|
|
|
|
|
%postun
|
2017-09-27 18:31:31 +02:00
|
|
|
%service_del_postun dehydrated.service dehydrated.timer
|
2017-02-13 07:49:05 +01:00
|
|
|
%endif
|
|
|
|
|
2017-01-27 11:00:22 +01:00
|
|
|
%prep
|
|
|
|
%setup -q
|
2017-09-27 18:31:31 +02:00
|
|
|
cp %{SOURCE9} .
|
|
|
|
cp %{SOURCE10} .
|
2017-01-27 11:00:22 +01:00
|
|
|
|
|
|
|
%build
|
|
|
|
|
|
|
|
%install
|
|
|
|
# sensitive keys
|
2018-01-15 16:33:17 +01:00
|
|
|
mkdir -p %{buildroot}%{_home}/{accounts,certs,chains}
|
2017-09-19 17:42:45 +02:00
|
|
|
mkdir -p %{buildroot}%{_sbindir}
|
2017-09-22 15:35:31 +02:00
|
|
|
mkdir -p %{buildroot}%{_mandir}/man1
|
|
|
|
mkdir -p %{buildroot}%{_home}/config.d
|
2017-10-06 12:52:01 +02:00
|
|
|
mkdir -p %{buildroot}%{_postrunhooks}
|
2017-09-22 15:35:31 +02:00
|
|
|
|
2018-01-15 12:59:16 +01:00
|
|
|
cat dehydrated.1 | gzip > %{buildroot}%{_mandir}/man1/dehydrated.1.gz
|
2017-01-27 11:00:22 +01:00
|
|
|
|
2017-10-20 11:54:53 +02:00
|
|
|
# Silence E: env-script-interpreter
|
2017-10-20 12:57:53 +02:00
|
|
|
find \( -name \*.sh -o -name dehydrated \) -exec sed -i "s,#!/usr/bin/env bash,#!$(command -v bash),g" {} \;
|
2017-10-20 11:54:53 +02:00
|
|
|
|
2017-01-27 11:00:22 +01:00
|
|
|
sed -i "s,#WELLKNOWN=.*,WELLKNOWN=%{_challengedir},g" docs/examples/config
|
|
|
|
install -m 0644 docs/examples/* %{buildroot}%{_home}
|
2017-10-06 12:52:01 +02:00
|
|
|
install -m 0644 %{SOURCE11} %{buildroot}%{_postrunhooks}
|
2017-09-27 18:31:31 +02:00
|
|
|
install -m 0755 -d %{buildroot}%{_bindir}
|
|
|
|
install -m 0755 dehydrated %{buildroot}%{_bindir}
|
2017-01-27 11:00:22 +01:00
|
|
|
install -m 0755 -d %{buildroot}%{_challengedir}
|
|
|
|
|
2017-09-27 18:31:31 +02:00
|
|
|
install -m 0755 -d %{buildroot}%{_sysconfdir}/%{_apache}/conf.d
|
2017-01-27 11:00:22 +01:00
|
|
|
sed "s,@CHALLENGEDIR@,%{_challengedir},g" %{SOURCE1} > acme-challenge.conf
|
2017-09-27 18:31:31 +02:00
|
|
|
install -m 0644 acme-challenge.conf %{buildroot}%{_sysconfdir}/%{_apache}/conf.d
|
2017-02-13 07:49:05 +01:00
|
|
|
|
|
|
|
%if %{with nginx}
|
2017-09-27 18:31:31 +02:00
|
|
|
install -m 0755 -d %{buildroot}%{_sysconfdir}/nginx
|
2017-01-27 11:00:22 +01:00
|
|
|
sed "s,@CHALLENGEDIR@,%{_challengedir},g" %{SOURCE2} > acme-challenge
|
2017-09-27 18:31:31 +02:00
|
|
|
install -m 0644 acme-challenge %{buildroot}%{_sysconfdir}/nginx
|
2017-02-13 07:49:05 +01:00
|
|
|
%endif #with nginx
|
|
|
|
|
|
|
|
%if %{with lighttpd}
|
2017-09-27 18:31:31 +02:00
|
|
|
install -m 0755 -d %{buildroot}%{_sysconfdir}/lighttpd/conf.d
|
2017-02-13 07:49:05 +01:00
|
|
|
sed "s,@CHALLENGEDIR@,%{_challengedir},g" %{SOURCE3} > acme-challenge
|
2017-09-27 18:31:31 +02:00
|
|
|
install -m 0644 acme-challenge %{buildroot}%{_sysconfdir}/lighttpd/conf.d
|
2017-02-13 07:49:05 +01:00
|
|
|
%endif #with lighttpd
|
|
|
|
|
|
|
|
%if %{with systemd}
|
2017-09-27 18:31:31 +02:00
|
|
|
install -D -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf
|
2017-09-19 17:42:45 +02:00
|
|
|
# Use timer
|
2017-10-06 12:52:01 +02:00
|
|
|
sed "s,@POSTRUNHOOKS_DIR@,%{_postrunhooks},g" %{SOURCE6} > dehydrated.service
|
2017-09-27 18:31:31 +02:00
|
|
|
install -D -m 644 dehydrated.service %{buildroot}%{_unitdir}/dehydrated.service
|
2017-10-06 12:52:01 +02:00
|
|
|
install -D -m 644 %{SOURCE7} %{buildroot}%{_unitdir}/dehydrated.timer
|
2017-09-19 17:42:45 +02:00
|
|
|
%if 0%{?suse_version}
|
2017-09-27 18:31:31 +02:00
|
|
|
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcdehydrated
|
2017-02-13 07:49:05 +01:00
|
|
|
%endif
|
2017-09-19 17:42:45 +02:00
|
|
|
%else #with systemd
|
|
|
|
install -D -d -m 0750 %{buildroot}%{_lock_dir}
|
|
|
|
# Use cron
|
2017-09-27 18:31:31 +02:00
|
|
|
install -m 0755 -d %{buildroot}%{_sysconfdir}/cron.d
|
2017-10-06 12:52:01 +02:00
|
|
|
sed "s,@POSTRUNHOOKS_DIR@,%{_postrunhooks},g" %{SOURCE4} > dehydrated.cron
|
2017-09-27 18:31:31 +02:00
|
|
|
install -m 0644 dehydrated.cron %{buildroot}%{_sysconfdir}/cron.d/dehydrated
|
2017-09-19 17:42:45 +02:00
|
|
|
%endif #with systemd
|
2017-09-22 15:35:31 +02:00
|
|
|
|
|
|
|
# Adjust config file
|
|
|
|
perl -p -i -e 's|#LOCKFILE="\$\{BASEDIR\}/lock"|LOCKFILE="%{_lock_dir}/lock"|' %{buildroot}%{_home}/config
|
|
|
|
perl -p -i -e 's|#CONFIG_D=|CONFIG_D="%{_home}/config.d"|' %{buildroot}%{_home}/config
|
|
|
|
perl -p -i -e 's|#DEHYDRATED_USER=|DEHYDRATED_USER="%{_user}"|' %{buildroot}%{_home}/config
|
|
|
|
perl -p -i -e 's|#DEHYDRATED_GROUP=|DEHYDRATED_GROUP="%{_user}"|' %{buildroot}%{_home}/config
|
|
|
|
|
2017-02-13 07:49:05 +01:00
|
|
|
diff -urN docs/examples/config %{buildroot}%{_home}/config ||:
|
2017-01-27 11:00:22 +01:00
|
|
|
|
|
|
|
%files
|
|
|
|
%defattr(-,root,root)
|
2017-02-13 07:49:05 +01:00
|
|
|
%attr(750,root,%{_user}) %dir %{_sysconfdir}/dehydrated
|
|
|
|
%attr(700,%{_user},%{_user}) %dir %{_sysconfdir}/dehydrated/accounts
|
|
|
|
%attr(700,%{_user},%{_user}) %dir %{_sysconfdir}/dehydrated/certs
|
2018-01-15 16:33:17 +01:00
|
|
|
%attr(700,%{_user},%{_user}) %dir %{_sysconfdir}/dehydrated/chains
|
2017-02-13 07:49:05 +01:00
|
|
|
%config(noreplace) %attr(640,root,%{_user}) %{_sysconfdir}/dehydrated/config
|
2017-09-22 15:35:31 +02:00
|
|
|
%config(noreplace) %attr(750,root,%{_user}) %{_sysconfdir}/dehydrated/config.d
|
2017-02-13 07:49:05 +01:00
|
|
|
%config(noreplace) %attr(640,root,%{_user}) %{_sysconfdir}/dehydrated/domains.txt
|
|
|
|
%config(noreplace) %attr(750,root,%{_user}) %{_sysconfdir}/dehydrated/hook.sh
|
2017-10-06 12:52:01 +02:00
|
|
|
%dir %attr(750,root,%{_user}) %{_postrunhooks}
|
|
|
|
%config(noreplace) %attr(640,root,%{_user}) %{_postrunhooks}/README.hooks
|
2017-01-27 11:00:22 +01:00
|
|
|
%{_bindir}/dehydrated
|
|
|
|
%attr(-,%{_user},root) %dir %{_localstatedir}/lib/acme-challenge
|
2017-09-22 15:35:31 +02:00
|
|
|
%{_mandir}/man1/*
|
2017-01-27 11:00:22 +01:00
|
|
|
%doc LICENSE README.md docs/*.md docs/*.jpg
|
2017-09-27 18:31:31 +02:00
|
|
|
%doc README.SUSE
|
|
|
|
%if %{defined redhat}
|
|
|
|
%doc README.Fedora
|
|
|
|
%endif
|
2017-02-13 07:49:05 +01:00
|
|
|
%if %{with systemd}
|
|
|
|
%{_tmpfilesdir}/%{name}.conf
|
2017-09-27 18:31:31 +02:00
|
|
|
%{_unitdir}/dehydrated.service
|
|
|
|
%{_unitdir}/dehydrated.timer
|
|
|
|
%{_sbindir}/rcdehydrated
|
2017-02-13 07:49:05 +01:00
|
|
|
%ghost %attr(700,%{_user},%{_user}) %dir %{_lock_dir}
|
|
|
|
%else
|
2017-09-19 17:42:45 +02:00
|
|
|
%config %{_sysconfdir}/cron.d/dehydrated
|
2017-02-13 07:49:05 +01:00
|
|
|
%attr(700,%{_user},%{_user}) %dir %{_lock_dir}
|
|
|
|
%endif
|
2017-01-27 11:00:22 +01:00
|
|
|
|
|
|
|
%files %{_apache}
|
2017-09-27 18:31:31 +02:00
|
|
|
%defattr(-,root,root)
|
2017-02-13 07:49:05 +01:00
|
|
|
%config %{_sysconfdir}/%{_apache}/conf.d/acme-challenge.conf
|
2017-01-27 11:00:22 +01:00
|
|
|
|
2017-02-13 07:49:05 +01:00
|
|
|
%if %{with nginx}
|
2017-01-27 11:00:22 +01:00
|
|
|
%files nginx
|
2017-09-27 18:31:31 +02:00
|
|
|
%defattr(-,root,root)
|
2017-02-13 07:49:05 +01:00
|
|
|
%config %attr(640,root,nginx) %{_sysconfdir}/nginx/acme-challenge
|
|
|
|
%endif #with nginx
|
2017-01-27 11:00:22 +01:00
|
|
|
|
2017-02-13 07:49:05 +01:00
|
|
|
%if %{with lighttpd}
|
|
|
|
%files lighttpd
|
2017-09-27 18:31:31 +02:00
|
|
|
%defattr(-,root,root)
|
2017-02-13 07:49:05 +01:00
|
|
|
%config %attr(640,root,lighttpd) %{_sysconfdir}/lighttpd/conf.d/acme-challenge
|
|
|
|
%endif #with lighttpd
|
2017-01-27 11:00:22 +01:00
|
|
|
|
2017-02-13 07:49:05 +01:00
|
|
|
%changelog
|