27ce825
%if 0%{?fedora} || 0%{?rhel} > 7
27ce825
# Enable python3 build by default
27ce825
%bcond_without python3
10e487b
%else
27ce825
%bcond_with python3
Simo Sorce b50bb18
%endif
Simo Sorce b50bb18
27ce825
%if 0%{?rhel} > 7
27ce825
# Disable python2 build by default
27ce825
%bcond_with python2
90a7d5f
%else
27ce825
%bcond_without python2
90a7d5f
%endif
90a7d5f
27ce825
%{!?python3_pkgversion:%global python3_pkgversion 3}
27ce825
Simo Sorce b50bb18
Name:           custodia
27ce825
Version:        0.6.0
b070300
Release:        4%{?dist}
cfa9dab
Summary:        A service to manage, retrieve and store secrets for other processes
Simo Sorce b50bb18
Simo Sorce b50bb18
License:        GPLv3+
Simo Sorce 777ccdb
URL:            https://github.com/latchset/%{name}
Simo Sorce 8bea4eb
Source0:        https://github.com/latchset/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz
Simo Sorce 8bea4eb
Source2:        custodia.conf
70e700f
Source3:        custodia@.service
70e700f
Source4:        custodia@.socket
cfa9dab
Source5:        custodia.tmpfiles.conf
Simo Sorce b50bb18
bae82e3
Patch1:         nonfatal_deprecation.patch
bae82e3
Simo Sorce b50bb18
BuildArch:      noarch
Simo Sorce b50bb18
ff92ce4
BuildRequires:      systemd
27ce825
27ce825
%if %{?with_python2}
Simo Sorce 8bea4eb
BuildRequires:      python2-devel
e55b5c5
BuildRequires:      python2-jwcrypto >= 0.4.2
Simo Sorce 8bea4eb
BuildRequires:      python2-requests
Simo Sorce 8bea4eb
BuildRequires:      python2-setuptools >= 18
Simo Sorce 8bea4eb
BuildRequires:      python2-coverage
Simo Sorce 8bea4eb
BuildRequires:      python2-pytest
e55b5c5
BuildRequires:      python2-docutils
Simo Sorce 8b5a03c
BuildRequires:      python2-configparser
f59292a
BuildRequires:      python2-systemd
049ac89
BuildRequires:      tox >= 2.3.1
27ce825
%endif
Simo Sorce b50bb18
Simo Sorce b50bb18
%if 0%{?with_python3}
e55b5c5
BuildRequires:      python%{python3_pkgversion}-devel
e55b5c5
BuildRequires:      python%{python3_pkgversion}-jwcrypto >= 0.4.2
e55b5c5
BuildRequires:      python%{python3_pkgversion}-requests
e55b5c5
BuildRequires:      python%{python3_pkgversion}-setuptools > 18
e55b5c5
BuildRequires:      python%{python3_pkgversion}-coverage
e55b5c5
BuildRequires:      python%{python3_pkgversion}-pytest
e55b5c5
BuildRequires:      python%{python3_pkgversion}-docutils
e55b5c5
BuildRequires:      python%{python3_pkgversion}-systemd
Simo Sorce b50bb18
%endif
Simo Sorce b50bb18
c3551c3
%if 0%{?with_python3}
e55b5c5
Requires:           python%{python3_pkgversion}-custodia = %{version}-%{release}
c3551c3
%else
Simo Sorce 8bea4eb
Requires:           python2-custodia = %{version}-%{release}
c3551c3
%endif
Simo Sorce b50bb18
10e487b
Requires(preun):    systemd-units
10e487b
Requires(postun):   systemd-units
10e487b
Requires(post):     systemd-units
10e487b
81f2fa4
cfa9dab
%global overview                                                           \
cfa9dab
Custodia is a Secrets Service Provider, it stores or proxies access to     \
cfa9dab
keys, password, and secret material in general. Custodia is built to       \
cfa9dab
use the HTTP protocol and a RESTful API as an IPC mechanism over a local   \
cfa9dab
Unix Socket. It can also be exposed to a network via a Reverse Proxy       \
cfa9dab
service assuming proper authentication and header validation is            \
cfa9dab
implemented in the Proxy.                                                  \
cfa9dab
                                                                           \
cfa9dab
Custodia is modular, the configuration file controls how authentication,   \
cfa9dab
authorization, storage and API plugins are combined and exposed.
cfa9dab
cfa9dab
Simo Sorce b50bb18
%description
cfa9dab
A service to manage, retrieve and store secrets for other processes
Simo Sorce b50bb18
cfa9dab
%{overview}
Simo Sorce 8bea4eb
27ce825
%if 0%{?with_python2}
Simo Sorce 8bea4eb
%package -n python2-custodia
cfa9dab
Summary:    Sub-package with python2 custodia modules
e55b5c5
%{?python_provide:%python_provide python2-%{name}}
Simo Sorce 8bea4eb
Requires:   python2-configparser
90a7d5f
Requires:   python2-jwcrypto >= 0.4.2
Simo Sorce 8bea4eb
Requires:   python2-requests
Simo Sorce 8bea4eb
Requires:   python2-setuptools
f59292a
Requires:   python2-systemd
27ce825
Conflicts:  python2-custodia-extra < %{version}
Simo Sorce b50bb18
Simo Sorce 8bea4eb
%description -n python2-custodia
cfa9dab
Sub-package with python custodia modules
cfa9dab
cfa9dab
%{overview}
27ce825
%endif
Simo Sorce 8bea4eb
Simo Sorce b50bb18
%if 0%{?with_python3}
e55b5c5
%package -n python%{python3_pkgversion}-custodia
cfa9dab
Summary:    Sub-package with python3 custodia modules
e55b5c5
%{?python_provide:%python_provide python3-%{name}}
e55b5c5
Requires:   python%{python3_pkgversion}-jwcrypto >= 0.4.2
e55b5c5
Requires:   python%{python3_pkgversion}-requests
e55b5c5
Requires:   python%{python3_pkgversion}-setuptools
e55b5c5
Requires:   python%{python3_pkgversion}-systemd
27ce825
Conflicts:  python%{python3_pkgversion}-custodia-extra < %{version}
e55b5c5
e55b5c5
%description -n python%{python3_pkgversion}-custodia
cfa9dab
Sub-package with python custodia modules
cfa9dab
cfa9dab
%{overview}
cfa9dab
10e487b
%endif  # with_python3
Simo Sorce b50bb18
Simo Sorce 8bea4eb
Simo Sorce b50bb18
%prep
bae82e3
%autosetup -p1
Simo Sorce b50bb18
Simo Sorce 8bea4eb
Simo Sorce b50bb18
%build
27ce825
%if 0%{?with_python2}
e55b5c5
%py2_build
27ce825
%endif
Simo Sorce b50bb18
%if 0%{?with_python3}
e55b5c5
%py3_build
Simo Sorce b50bb18
%endif
Simo Sorce b50bb18
Simo Sorce b50bb18
Simo Sorce b50bb18
%check
Simo Sorce 8bea4eb
# don't download packages
Simo Sorce 8bea4eb
export PIP_INDEX_URL=http://host.invalid./
e55b5c5
# Don't try to download dnspython3. The package is provided by python%{python3_pkgversion}-dns
f59292a
export PIP_NO_DEPS=yes
d042c28
# Ignore all install packages to enforce installation of sdist. Otherwise tox
d042c28
# may pick up this package from global site-packages instead of source dist.
d042c28
export PIP_IGNORE_INSTALLED=yes
f59292a
27ce825
%if 0%{?with_python2}
10e487b
tox --sitepackages -e py%{python2_version_nodots} -- --skip-servertests
27ce825
%endif
27ce825
Simo Sorce 8bea4eb
%if 0%{?with_python3}
27ce825
# Test custodia in a virtual environment
27ce825
%{__python3} -m venv --system-site-packages testenv
27ce825
testenv/bin/pip install .
27ce825
testenv/bin/python -m pytest --capture=no --strict --skip-servertests
Simo Sorce 8bea4eb
%endif
Simo Sorce b50bb18
Simo Sorce b50bb18
Simo Sorce b50bb18
%install
Simo Sorce b50bb18
mkdir -p %{buildroot}/%{_sbindir}
Simo Sorce 8bea4eb
mkdir -p %{buildroot}/%{_mandir}/man7
Simo Sorce 8bea4eb
mkdir -p %{buildroot}/%{_defaultdocdir}/custodia
Simo Sorce 8bea4eb
mkdir -p %{buildroot}/%{_defaultdocdir}/custodia/examples
Simo Sorce 8bea4eb
mkdir -p %{buildroot}/%{_sysconfdir}/custodia
Simo Sorce 8bea4eb
mkdir -p %{buildroot}/%{_unitdir}
cfa9dab
mkdir -p %{buildroot}/%{_tmpfilesdir}
Simo Sorce 8bea4eb
mkdir -p %{buildroot}/%{_localstatedir}/lib/custodia
Simo Sorce 8bea4eb
mkdir -p %{buildroot}/%{_localstatedir}/log/custodia
70e700f
mkdir -p %{buildroot}/%{_localstatedir}/run/custodia
Simo Sorce 8bea4eb
27ce825
%if 0%{?with_python2}
e55b5c5
%py2_install
Simo Sorce b50bb18
mv %{buildroot}/%{_bindir}/custodia %{buildroot}/%{_sbindir}/custodia
6384312
cp %{buildroot}/%{_sbindir}/custodia %{buildroot}/%{_sbindir}/custodia-2
6384312
cp %{buildroot}/%{_bindir}/custodia-cli %{buildroot}/%{_bindir}/custodia-cli-2
27ce825
%endif
Simo Sorce 8bea4eb
Simo Sorce b50bb18
%if 0%{?with_python3}
c3551c3
# overrides /usr/bin/custodia-cli and /usr/sbin/custodia with Python 3 shebang
e55b5c5
%py3_install
c3551c3
mv %{buildroot}/%{_bindir}/custodia %{buildroot}/%{_sbindir}/custodia
6384312
cp %{buildroot}/%{_sbindir}/custodia %{buildroot}/%{_sbindir}/custodia-3
6384312
cp %{buildroot}/%{_bindir}/custodia-cli %{buildroot}/%{_bindir}/custodia-cli-3
Simo Sorce b50bb18
%endif
Simo Sorce b50bb18
27ce825
install -m 644 -t "%{buildroot}/%{_mandir}/man7" man/custodia.7
27ce825
install -m 644 -t "%{buildroot}/%{_defaultdocdir}/custodia" README API.md
27ce825
install -m 644 -t "%{buildroot}/%{_defaultdocdir}/custodia/examples" custodia.conf
27ce825
install -m 600 %{SOURCE2} %{buildroot}%{_sysconfdir}/custodia
27ce825
install -m 644 %{SOURCE3} %{buildroot}%{_unitdir}
27ce825
install -m 644 %{SOURCE4} %{buildroot}%{_unitdir}
27ce825
install -m 644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/custodia.conf
27ce825
27ce825
Simo Sorce b50bb18
70e700f
%pre
70e700f
getent group custodia >/dev/null || groupadd -r custodia
70e700f
getent passwd custodia >/dev/null || \
70e700f
    useradd -r -g custodia -d / -s /sbin/nologin \
70e700f
    -c "User for custodia" custodia
70e700f
exit 0
70e700f
70e700f
10e487b
%post
70e700f
%systemd_post custodia@\*.socket
70e700f
%systemd_post custodia@\*.service
10e487b
10e487b
10e487b
%preun
70e700f
%systemd_preun custodia@\*.socket
70e700f
%systemd_preun custodia@\*.service
10e487b
10e487b
10e487b
%postun
70e700f
%systemd_postun custodia@\*.socket
70e700f
%systemd_postun custodia@\*.service
10e487b
10e487b
Simo Sorce b50bb18
%files
Simo Sorce 8bea4eb
%doc README API.md
Simo Sorce 8bea4eb
%doc %{_defaultdocdir}/custodia/examples/custodia.conf
Simo Sorce b50bb18
%license LICENSE
Simo Sorce b50bb18
%{_mandir}/man7/custodia*
Simo Sorce b50bb18
%{_sbindir}/custodia
Simo Sorce 8bea4eb
%{_bindir}/custodia-cli
70e700f
%dir %attr(0700,custodia,custodia) %{_sysconfdir}/custodia
70e700f
%config(noreplace) %attr(600,custodia,custodia) %{_sysconfdir}/custodia/custodia.conf
70e700f
%attr(644,root,root)  %{_unitdir}/custodia@.socket
70e700f
%attr(644,root,root)  %{_unitdir}/custodia@.service
70e700f
%dir %attr(0700,custodia,custodia) %{_localstatedir}/lib/custodia
70e700f
%dir %attr(0700,custodia,custodia) %{_localstatedir}/log/custodia
70e700f
%dir %attr(0755,custodia,custodia) %{_localstatedir}/run/custodia
cfa9dab
%{_tmpfilesdir}/custodia.conf
Simo Sorce 8bea4eb
27ce825
%if 0%{?with_python2}
Simo Sorce 8bea4eb
%files -n python2-custodia
Simo Sorce b50bb18
%license LICENSE
e55b5c5
%{python2_sitelib}/%{name}
e55b5c5
%{python2_sitelib}/%{name}-%{version}-py%{python2_version}.egg-info
e55b5c5
%{python2_sitelib}/%{name}-%{version}-py%{python2_version}-nspkg.pth
6384312
%{_sbindir}/custodia-2
6384312
%{_bindir}/custodia-cli-2
27ce825
%endif
Simo Sorce 8bea4eb
Simo Sorce b50bb18
%if 0%{?with_python3}
e55b5c5
%files -n python%{python3_pkgversion}-custodia
Simo Sorce b50bb18
%license LICENSE
e55b5c5
%{python3_sitelib}/%{name}
e55b5c5
%{python3_sitelib}/%{name}-%{version}-py%{python3_version}.egg-info
e55b5c5
%{python3_sitelib}/%{name}-%{version}-py%{python3_version}-nspkg.pth
6384312
%{_sbindir}/custodia-3
6384312
%{_bindir}/custodia-cli-3
Simo Sorce 8bea4eb
10e487b
%endif  # with_python3
Simo Sorce b50bb18
Simo Sorce b50bb18
Simo Sorce b50bb18
%changelog
b070300
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-4
b070300
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
b070300
bae82e3
* Fri Jun 29 2018 Christian Heimes <cheimes@redhat.com> - 0.6.0-3
bae82e3
- Don't turn deprecation warnings into fatal errors
bae82e3
7806b15
* Thu Jun 28 2018 Christian Heimes <cheimes@redhat.com> - 0.6.0-2
7806b15
- Rebuild for Python 3.7
7806b15
27ce825
* Mon Jun 25 2018 Christian Heimes <cheimes@redhat.com> - 0.6.0-1
27ce825
- New upstream release 0.6.0
27ce825
- Remove etcd support
27ce825
- Remove unnecesary conflict with old FreeIPA
27ce825
- Make Python 2 optional
27ce825
d479f82
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.5.0-13
d479f82
- Rebuilt for Python 3.7
d479f82
049ac89
* Mon May 07 2018 Miro Hrončok <mhroncok@redhat.com> - 0.5.0-12
049ac89
- Fix BuildRequires to require the tox command and not the python2 module
049ac89
481d367
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.5.0-11
481d367
- Escape macros in %%changelog
481d367
4b86709
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.0-10
4b86709
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
4b86709
90a7d5f
* Mon Aug 07 2017 Christian Heimes <cheimes@redhat.com> - 0.5.0-9
90a7d5f
- freeipa 4.4.4-2.fc26 and newer are compatible with custodia 0.5
90a7d5f
- Fix dependency to python2-jwcrypto >= 0.4.2
90a7d5f
d042c28
* Wed Aug 02 2017 Christian Heimes <cheimes@redhat.com> - 0.5.0-8
d042c28
- Add PIP_IGNORE_INSTALLED
d042c28
e55b5c5
* Tue Aug 01 2017 Christian Heimes <cheimes@redhat.com> - 0.5.0-7
e55b5c5
- Modernize spec
e55b5c5
e55b5c5
* Tue Aug 01 2017 Christian Heimes <cheimes@redhat.com> - 0.5.0-6
e55b5c5
- Require latest python-jwcrypto with Python 3 fix
e55b5c5
- Use python2 prefix for all Python 2 dependencies
e55b5c5
d042c28
* Tue Aug 01 2017 Christian Heimes <cheimes@redhat.com> - 0.5.0-5
70e700f
- Add custodia user and named systemd instances
70e700f
f772214
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.0-4
f772214
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
f772214
ff92ce4
* Tue Jun 20 2017 Christian Heimes <cheimes@redhat.com> - 0.5.0-3
ff92ce4
- Add systemd build requirement for tmpfilesdir and unitdir macros
ff92ce4
10e487b
* Mon Jun 19 2017 Christian Heimes <cheimes@redhat.com> - 0.5.0-2
10e487b
- Skip etcd store on PPC64
10e487b
- Add missing pre/post install hooks for systemd service
10e487b
- Custodia 0.5 is compatible with FreeIPA 4.4.5 and newer
10e487b
- Drop custodia user from tmpfiles.d conf
10e487b
Simo Sorce aa0d100
* Tue May 16 2017 Simo Sorce <simo@redhat.com> - 0.5.0-1
Simo Sorce aa0d100
- New Custodia version
Simo Sorce aa0d100
- Drop checks on sha512sum, these checks are already done by dist-git
Simo Sorce aa0d100
05365a8
* Tue Apr 11 2017 Christian Heimes <cheimes@redhat.com> - 0.3.1-3
05365a8
- Run Python 3 tests with correct Python version
05365a8
81f2fa4
* Fri Apr 07 2017 Christian Heimes <cheimes@redhat.com> - 0.3.1-2
81f2fa4
- Add conflict with FreeIPA < 4.5
81f2fa4
aa53157
* Mon Mar 27 2017 Christian Heimes <cheimes@redhat.com> - 0.3.1-1
aa53157
- Upstream release 0.3.1
aa53157
6384312
* Thu Mar 16 2017 Christian Heimes <cheimes@redhat.com> - 0.3.0-3
6384312
- Provide custodia-2 and custodia-3 scripts
6384312
c3551c3
* Thu Mar 02 2017 Christian Heimes <cheimes@redhat.com> - 0.3.0-2
c3551c3
- Run Custodia daemon with Python 3
c3551c3
- Resolves: Bug 1426737 - custodia: Provide a Python 3 subpackage
c3551c3
cfa9dab
* Wed Mar 01 2017 Christian Heimes <cheimes@redhat.com> - 0.3.0-1
cfa9dab
- Update to custodia 0.3.0
cfa9dab
- Run tests with global site packages
cfa9dab
- Add tmpfiles.d config for /run/custodia
cfa9dab
f59292a
* Wed Feb 22 2017 Christian Heimes <cheimes@redhat.com> - 0.2.0-4
f59292a
- Add missing runtime requirement on python[23]-systemd.
481d367
- Drop unnecesary build dependency on python%%{python3_pkgversion}-configparser.
f59292a
- Fix tests, don't try to download dnspython3.
f59292a
4b8ee48
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-3
4b8ee48
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
4b8ee48
98a0ab1
* Thu Dec 22 2016 Miro Hrončok <mhroncok@redhat.com> - 0.2.0-2
98a0ab1
- Rebuild for Python 3.6
98a0ab1