af3cbb
%global custodiaipa_version 0.1.0
0c3034
0c3034
Name:           custodia
af3cbb
Version:        0.3.1
0c3034
Release:        4%{?dist}
af3cbb
Summary:        A service to manage, retrieve and store secrets for other processes
0c3034
0c3034
License:        GPLv3+
0c3034
URL:            https://github.com/latchset/%{name}
af3cbb
Source0:        https://github.com/latchset/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz
af3cbb
Source1:        https://github.com/latchset/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz.sha512sum.txt
af3cbb
Source2:        custodia.conf
af3cbb
Source5:        custodia.tmpfiles.conf
af3cbb
Patch1:         0001-Vendor-configparser-3.5.0.patch
af3cbb
Patch2:         0002-Patch-and-integrate-vendored-configparser.patch
af3cbb
Patch3:         0003-Remove-etcd-store.patch
af3cbb
Patch4:         0004-Vendor-custodia.ipa.patch
af3cbb
Patch5:         0005-Add-workaround-for-missing-kra_server_server.patch
af3cbb
0c3034
0c3034
BuildArch:      noarch
0c3034
0c3034
BuildRequires:      python-devel
0c3034
BuildRequires:      python-jwcrypto
af3cbb
BuildRequires:      python-requests
af3cbb
BuildRequires:      python-setuptools
0c3034
BuildRequires:      python-coverage
0c3034
BuildRequires:      pytest
af3cbb
BuildRequires:      python-docutils
af3cbb
BuildRequires:      systemd-python
af3cbb
BuildRequires:      python-ipalib
af3cbb
Requires:           python-custodia = %{version}-%{release}
af3cbb
af3cbb
Requires(preun):    systemd-units
af3cbb
Requires(postun):   systemd-units
af3cbb
Requires(post):     systemd-units
af3cbb
af3cbb
%global overview                                                           \
af3cbb
Custodia is a Secrets Service Provider, it stores or proxies access to     \
af3cbb
keys, password, and secret material in general. Custodia is built to       \
af3cbb
use the HTTP protocol and a RESTful API as an IPC mechanism over a local   \
af3cbb
Unix Socket. It can also be exposed to a network via a Reverse Proxy       \
af3cbb
service assuming proper authentication and header validation is            \
af3cbb
implemented in the Proxy.                                                  \
af3cbb
                                                                           \
af3cbb
Custodia is modular, the configuration file controls how authentication,   \
af3cbb
authorization, storage and API plugins are combined and exposed.
af3cbb
0c3034
0c3034
%description
af3cbb
A service to manage, retrieve and store secrets for other processes
af3cbb
af3cbb
%{overview}
0c3034
0c3034
%package -n python-custodia
af3cbb
Summary:    Sub-package with python2 custodia modules
af3cbb
Provides:   python2-custodia = %{version}-%{release}
0c3034
Requires:   python-jwcrypto
af3cbb
Requires:   python-requests
af3cbb
Requires:   python-setuptools
af3cbb
Requires:   systemd-python
0c3034
0c3034
%description -n python-custodia
af3cbb
Sub-package with python2 custodia modules
0c3034
af3cbb
%{overview}
0c3034
af3cbb
%package -n python-custodia-ipa
af3cbb
Summary:    Sub-package with python2 custodia.ipa vault module
af3cbb
Requires:   python-custodia = %{version}-%{release}
af3cbb
Requires:   python-ipalib
af3cbb
Requires:   ipa-client
af3cbb
af3cbb
%description -n python-custodia-ipa
af3cbb
Sub-package with python2 custodia.ipa vault module
af3cbb
af3cbb
%{overview}
0c3034
0c3034
%prep
0c3034
grep `sha512sum %{SOURCE0}` %{SOURCE1} || (echo "Checksum invalid!" && exit 1)
0c3034
%setup
af3cbb
%patch1 -p1
af3cbb
%patch2 -p1
af3cbb
%patch3 -p1
af3cbb
%patch4 -p1
af3cbb
%patch5 -p1
af3cbb
0c3034
0c3034
%build
af3cbb
%{__python2} setup.py egg_info build
af3cbb
af3cbb
af3cbb
%check
af3cbb
export PYTHONPATH="%{buildroot}/%{python2_sitelib}"
af3cbb
py.test --skip-servertest --ignore=tests/test_ipa.py --ignore=tests/test_cli.py
0c3034
0c3034
0c3034
%install
0c3034
mkdir -p %{buildroot}/%{_sbindir}
af3cbb
mkdir -p %{buildroot}/%{_mandir}/man7
af3cbb
mkdir -p %{buildroot}/%{_defaultdocdir}/custodia
af3cbb
mkdir -p %{buildroot}/%{_defaultdocdir}/custodia/examples
af3cbb
mkdir -p %{buildroot}/%{_sysconfdir}/custodia
af3cbb
mkdir -p %{buildroot}/%{_unitdir}
af3cbb
mkdir -p %{buildroot}/%{_tmpfilesdir}
af3cbb
mkdir -p %{buildroot}/%{_localstatedir}/lib/custodia
af3cbb
mkdir -p %{buildroot}/%{_localstatedir}/log/custodia
af3cbb
af3cbb
%{__python2} setup.py install --skip-build --root %{buildroot}
0c3034
mv %{buildroot}/%{_bindir}/custodia %{buildroot}/%{_sbindir}/custodia
af3cbb
install -m 644 -t "%{buildroot}/%{_mandir}/man7" man/custodia.7
af3cbb
install -m 644 -t "%{buildroot}/%{_defaultdocdir}/custodia" README README.custodia.ipa API.md
af3cbb
install -m 644 -t "%{buildroot}/%{_defaultdocdir}/custodia/examples" custodia.conf
af3cbb
install -m 600 %{SOURCE2} %{buildroot}%{_sysconfdir}/custodia
af3cbb
install -m 644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/custodia.conf
af3cbb
# Recently setuptools stopped installing namespace __init__.py
af3cbb
install -m 644 -t "%{buildroot}/%{python2_sitelib}/custodia" custodia/__init__.py
0c3034
0c3034
af3cbb
%post
af3cbb
%systemd_post custodia.socket
af3cbb
%systemd_post custodia.service
af3cbb
af3cbb
%preun
af3cbb
%systemd_preun custodia.socket
af3cbb
%systemd_preun custodia.service
af3cbb
af3cbb
%postun
af3cbb
%systemd_postun custodia.socket
af3cbb
%systemd_postun custodia.service
0c3034
0c3034
0c3034
%files
af3cbb
%doc %{_defaultdocdir}/custodia/README
af3cbb
%doc %{_defaultdocdir}/custodia/API.md
af3cbb
%doc %{_defaultdocdir}/custodia/examples/custodia.conf
0c3034
%license LICENSE
0c3034
%{_mandir}/man7/custodia*
0c3034
%{_sbindir}/custodia
af3cbb
%{_bindir}/custodia-cli
af3cbb
%dir %attr(0700,root,root) %{_sysconfdir}/custodia
af3cbb
%config(noreplace) %attr(600,root,root) %{_sysconfdir}/custodia/custodia.conf
af3cbb
%dir %attr(0700,root,root) %{_localstatedir}/lib/custodia
af3cbb
%dir %attr(0700,root,root) %{_localstatedir}/log/custodia
af3cbb
%{_tmpfilesdir}/custodia.conf
0c3034
0c3034
%files -n python-custodia
0c3034
%license LICENSE
af3cbb
%exclude %{python2_sitelib}/custodia/ipa
af3cbb
%{python2_sitelib}/*
0c3034
af3cbb
%files -n python-custodia-ipa
af3cbb
%doc %{_defaultdocdir}/custodia/README.custodia.ipa
af3cbb
%{python2_sitelib}/custodia/ipa/*
0c3034
0c3034
0c3034
%changelog
af3cbb
* Tue Jun 20 2017 Christian Heimes <cheimes@redhat.com> - 0.3.1-4
af3cbb
- Add workaround for missing kra_server_server key, resolves #1462403
af3cbb
af3cbb
* Mon Jun 12 2017 Christian Heimes <cheimes@redhat.com> - 0.3.1-3
af3cbb
- Remove custodia user from tmpfiles.d, resolves #1460735
af3cbb
- Add missing systemd hooks for service and socket files
af3cbb
- Drop dependency on python-mock and skip mock tests in check block,
af3cbb
  resolves #1447426
af3cbb
af3cbb
* Fri Mar 31 2017 Christian Heimes <cheimes@redhat.com> - 0.3.1-2
af3cbb
- Exclude empty directory custodia/ipa from python-custodia
af3cbb
af3cbb
* Fri Mar 31 2017 Christian Heimes <cheimes@redhat.com> - 0.3.1-1
af3cbb
- Rebase to Custodia 0.3.1
af3cbb
- Vendor custodia.ipa 0.1.0
af3cbb
- Vendor backports.configparser 3.5.0 final
af3cbb
- related: #1403214
af3cbb
af3cbb
* Tue Mar 28 2017 Christian Heimes <cheimes@redhat.com> - 0.3.0-4
af3cbb
- Fix whitespace handling in URLs
af3cbb
- Use upstream patches to replace patches for setuptools and configparser
af3cbb
- resolves: #1436763
af3cbb
af3cbb
* Fri Mar 17 2017 Christian Heimes <cheimes@redhat.com> - 0.3.0-3
af3cbb
- custodia depends on python-custodia
af3cbb
af3cbb
* Fri Mar 17 2017 Christian Heimes <cheimes@redhat.com> - 0.3.0-2
af3cbb
- Fix package dependencies and package names to use python prefix
af3cbb
af3cbb
* Wed Mar 15 2017 Christian Heimes <cheimes@redhat.com> - 0.3.0-1
af3cbb
- Update to custodia 0.3.0
af3cbb
- Vendor backports.configparser 3.5.0b2
af3cbb
- Fix compatibility issues with old setuptools
af3cbb
- Add tmpfiles.d config for /run/custodia
af3cbb
0c3034
* Wed Sep 07 2016 Christian Heimes <cheimes@redhat.com> - 0.1.0-4
0c3034
- Disable tests (broken on build machines)
0c3034
- related: #1371902
0c3034
0c3034
* Wed Sep 07 2016 Simo Sorce <simo@redhat.com> - 0.1.0-3
0c3034
- Change default to use RSA OAEP padding
0c3034
- resolves: #1371902
0c3034
0c3034
* Mon Apr 04 2016 Christian Heimes <cheimes@redhat.com> - 0.2.1-2
0c3034
- Correct download link
0c3034
0c3034
* Thu Mar 31 2016 Christian Heimes <cheimes@redhat.com> - 0.1.0-1
0c3034
- Initial packaging