feat: adapt on nginx versionning
All checks were successful
Continuous Integration / lint_n_build (push) Successful in 39s
All checks were successful
Continuous Integration / lint_n_build (push) Successful in 39s
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
%define debug_package %{nil}
|
||||
|
||||
Name: %(make name)
|
||||
Epoch: %(make epoch)
|
||||
Version: %(make version)
|
||||
Release: %(make release)
|
||||
Release: %(make release)%{?dist}
|
||||
|
||||
Summary: %(make summary)
|
||||
License: %(make license)
|
||||
URL: %(make url)
|
||||
@@ -10,7 +12,13 @@ URL: %(make url)
|
||||
Source0: %(make source0)
|
||||
Buildarch: %(make arch)
|
||||
BuildRequires: make
|
||||
Requires: nginx python3 python-devel (augeas-devel or augeas-libs) gcc openssl
|
||||
|
||||
Requires: nginx = %{epoch}:%{version}-%{release}
|
||||
Requires: python3
|
||||
Requires: python-devel
|
||||
Requires: (augeas-devel or augeas-libs)
|
||||
Requires: gcc
|
||||
Requires: openssl
|
||||
|
||||
%description
|
||||
Install the reverse proxy called nginx with a predefined configuration and with TLS certificates attached to netoik.io
|
||||
@@ -45,12 +53,24 @@ if [ -z $SKIP_CERTBOT ]; then
|
||||
|
||||
# Create certbot certificates
|
||||
if ! certbot certificates --cert-name netoik.io | grep --quiet netoik.io; then
|
||||
certbot certonly --cert-name netoik.io --non-interactive --agree-tos --email samuel.campos@netoik.io --dns-ovh --dns-ovh-credentials %{_sysconfdir}/certbot/ovh.ini -d *.netoik.io -d *.samuel-campos.fr
|
||||
certbot certonly --cert-name netoik.io \
|
||||
--non-interactive \
|
||||
--agree-tos \
|
||||
--email samuel.campos@netoik.io \
|
||||
--dns-ovh --dns-ovh-credentials %{_sysconfdir}/certbot/ovh.ini \
|
||||
-d *.netoik.io \
|
||||
-d *.samuel-campos.fr
|
||||
fi
|
||||
else
|
||||
# Skipping certbot, so create self-signed certificate
|
||||
mkdir --parents /etc/letsencrypt/live/netoik.io
|
||||
openssl req -newkey rsa:4096 -nodes -keyout /etc/letsencrypt/live/netoik.io/privkey.pem -x509 -days 365 -out /etc/letsencrypt/live/netoik.io/fullchain.pem -subj "/C=US/ST=State/L=City/O=Organization/OU=Department/CN=netoik.io"
|
||||
openssl req -newkey rsa:4096 \
|
||||
-nodes \
|
||||
-keyout /etc/letsencrypt/live/netoik.io/privkey.pem \
|
||||
-x509 \
|
||||
-days 365 \
|
||||
-out /etc/letsencrypt/live/netoik.io/fullchain.pem \
|
||||
-subj "/C=US/ST=State/L=City/O=Organization/OU=Department/CN=netoik.io"
|
||||
fi
|
||||
|
||||
# Create ssl dh params if not already exists
|
||||
@@ -66,14 +86,14 @@ systemctl restart nginx.service certbot-renew.timer
|
||||
%postun
|
||||
# Remove folders after uninstall
|
||||
if [ $1 == 0 ]; then
|
||||
/opt/certbot/bin/certbot delete --cert-name netoik.io --non-interactive
|
||||
/opt/certbot/bin/certbot delete --cert-name netoik.io --non-interactive
|
||||
rm --recursive --force /opt/certbot
|
||||
rm --recursive --force %{_sysconfdir}/certbot
|
||||
rm --recursive --force %{_sysconfdir}/certbot
|
||||
fi
|
||||
|
||||
%files
|
||||
%attr(644, root, root) %{_sysconfdir}/nginx/conf.d/0_security.conf
|
||||
%attr(644, root, root) %{_sysconfdir}/nginx/conf.d/z_default.conf
|
||||
%config %attr(644, root, root) %{_sysconfdir}/nginx/conf.d/0_security.conf
|
||||
%config %attr(644, root, root) %{_sysconfdir}/nginx/conf.d/z_default.conf
|
||||
|
||||
%attr(755, root, root) %dir %{_sysconfdir}/certbot
|
||||
%attr(600, root, root) %{_sysconfdir}/certbot/ovh.ini
|
||||
|
||||
Reference in New Issue
Block a user