diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-krbticket.spec | 280 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 282 insertions, 0 deletions
@@ -0,0 +1 @@ +/krbticket-1.0.6.tar.gz diff --git a/python-krbticket.spec b/python-krbticket.spec new file mode 100644 index 0000000..90b3471 --- /dev/null +++ b/python-krbticket.spec @@ -0,0 +1,280 @@ +%global _empty_manifest_terminate_build 0 +Name: python-krbticket +Version: 1.0.6 +Release: 1 +Summary: Kerberos Ticket Manager +License: MIT License +URL: https://github.com/ksauzz/krbticket +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/b2/de/d00159986d398da6da07253a392f324e880e758b21bf1478e0e6c6371cf2/krbticket-1.0.6.tar.gz +BuildArch: noarch + +Requires: python3-retrying +Requires: python3-fasteners +Requires: python3-pytest +Requires: python3-pytest-cov +Requires: python3-pytest-mock +Requires: python3-flake8 +Requires: python3-freezegun + +%description +# Kerberos Ticket Manager + + + +Simple kinit wrapper to update Kerberos ticket periodically for long running application. + +## Getting Started + +Periodical kerberos ticket update + +``` +from krbticket import KrbTicket + +ticket = KrbTicket.init("<principal>", "<keytab path>") +ticket.updater_start() +``` + +If `keytab path` is not specifyed, kinit uses `KRB5_KTNAME` env, or `/etc/krb5.keytab` to find a keytab file. see: kerberos(1) and kinit(1). + +### Ticket Updater Strategies + +To avoid a credential cache (ccache) corruption by concurrent updates from multiple processes, KrbTicketUpdater has a few update strategies: + +- SimpleKrbTicketUpdater: for single updater process, or multiple updaters w/ per process ccache. (default) +- MultiProcessKrbTicketUpdater: for multiple updater processes w/ exclusive file lock +- SingleProcessKrbTicketUpdater: for multiple updater processes w/ exclusive file lock to restrict the number of updater processes to one against the ccache + +``` +from krbticket import KrbTicket, SingleProcessKrbTicketUpdater + +ticket = KrbTicket.init("<principal>", "<keytab path>", updater_class=SingleProcessKrbTicketUpdater) +ticket.updater_start() +``` + +### Retry + +krbticket supports retry feature utilizing [retrying](https://github.com/rholder/retrying) which provides various retry strategy. To change the behavior, pass the options using `retry_options` of KrbConfig. The dafault values are: + +- wait_exponential_multiplier = 1000 +- wait_exponential_max = 30000 +- stop_max_attempt_number = 10 + +``` +from krbticket import KrbTicket + +retry_options = { + 'wait_exponential_multiplier': 1000, + 'wait_exponential_max': 10000, + 'stop_max_attempt_number': 5 +} +ticket = KrbTicket.init("<principal>", "<keytab path>", retry_options=retry_options) +ticket.updater_start() +``` + +### Update Interval + +TBD + +## Test + +``` +docker run --rm -p 88:88 ksauzz/docker-krb5:0.0.1 +pip install -r requirements-test.txt -r requirements.txt +KRB5_CONFIG=tests/conf/krb5.conf.local pytest +``` + + + + +%package -n python3-krbticket +Summary: Kerberos Ticket Manager +Provides: python-krbticket +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-krbticket +# Kerberos Ticket Manager + + + +Simple kinit wrapper to update Kerberos ticket periodically for long running application. + +## Getting Started + +Periodical kerberos ticket update + +``` +from krbticket import KrbTicket + +ticket = KrbTicket.init("<principal>", "<keytab path>") +ticket.updater_start() +``` + +If `keytab path` is not specifyed, kinit uses `KRB5_KTNAME` env, or `/etc/krb5.keytab` to find a keytab file. see: kerberos(1) and kinit(1). + +### Ticket Updater Strategies + +To avoid a credential cache (ccache) corruption by concurrent updates from multiple processes, KrbTicketUpdater has a few update strategies: + +- SimpleKrbTicketUpdater: for single updater process, or multiple updaters w/ per process ccache. (default) +- MultiProcessKrbTicketUpdater: for multiple updater processes w/ exclusive file lock +- SingleProcessKrbTicketUpdater: for multiple updater processes w/ exclusive file lock to restrict the number of updater processes to one against the ccache + +``` +from krbticket import KrbTicket, SingleProcessKrbTicketUpdater + +ticket = KrbTicket.init("<principal>", "<keytab path>", updater_class=SingleProcessKrbTicketUpdater) +ticket.updater_start() +``` + +### Retry + +krbticket supports retry feature utilizing [retrying](https://github.com/rholder/retrying) which provides various retry strategy. To change the behavior, pass the options using `retry_options` of KrbConfig. The dafault values are: + +- wait_exponential_multiplier = 1000 +- wait_exponential_max = 30000 +- stop_max_attempt_number = 10 + +``` +from krbticket import KrbTicket + +retry_options = { + 'wait_exponential_multiplier': 1000, + 'wait_exponential_max': 10000, + 'stop_max_attempt_number': 5 +} +ticket = KrbTicket.init("<principal>", "<keytab path>", retry_options=retry_options) +ticket.updater_start() +``` + +### Update Interval + +TBD + +## Test + +``` +docker run --rm -p 88:88 ksauzz/docker-krb5:0.0.1 +pip install -r requirements-test.txt -r requirements.txt +KRB5_CONFIG=tests/conf/krb5.conf.local pytest +``` + + + + +%package help +Summary: Development documents and examples for krbticket +Provides: python3-krbticket-doc +%description help +# Kerberos Ticket Manager + + + +Simple kinit wrapper to update Kerberos ticket periodically for long running application. + +## Getting Started + +Periodical kerberos ticket update + +``` +from krbticket import KrbTicket + +ticket = KrbTicket.init("<principal>", "<keytab path>") +ticket.updater_start() +``` + +If `keytab path` is not specifyed, kinit uses `KRB5_KTNAME` env, or `/etc/krb5.keytab` to find a keytab file. see: kerberos(1) and kinit(1). + +### Ticket Updater Strategies + +To avoid a credential cache (ccache) corruption by concurrent updates from multiple processes, KrbTicketUpdater has a few update strategies: + +- SimpleKrbTicketUpdater: for single updater process, or multiple updaters w/ per process ccache. (default) +- MultiProcessKrbTicketUpdater: for multiple updater processes w/ exclusive file lock +- SingleProcessKrbTicketUpdater: for multiple updater processes w/ exclusive file lock to restrict the number of updater processes to one against the ccache + +``` +from krbticket import KrbTicket, SingleProcessKrbTicketUpdater + +ticket = KrbTicket.init("<principal>", "<keytab path>", updater_class=SingleProcessKrbTicketUpdater) +ticket.updater_start() +``` + +### Retry + +krbticket supports retry feature utilizing [retrying](https://github.com/rholder/retrying) which provides various retry strategy. To change the behavior, pass the options using `retry_options` of KrbConfig. The dafault values are: + +- wait_exponential_multiplier = 1000 +- wait_exponential_max = 30000 +- stop_max_attempt_number = 10 + +``` +from krbticket import KrbTicket + +retry_options = { + 'wait_exponential_multiplier': 1000, + 'wait_exponential_max': 10000, + 'stop_max_attempt_number': 5 +} +ticket = KrbTicket.init("<principal>", "<keytab path>", retry_options=retry_options) +ticket.updater_start() +``` + +### Update Interval + +TBD + +## Test + +``` +docker run --rm -p 88:88 ksauzz/docker-krb5:0.0.1 +pip install -r requirements-test.txt -r requirements.txt +KRB5_CONFIG=tests/conf/krb5.conf.local pytest +``` + + + + +%prep +%autosetup -n krbticket-1.0.6 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-krbticket -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.6-1 +- Package Spec generated @@ -0,0 +1 @@ +005467d3c0a30badaa36714835d465bd krbticket-1.0.6.tar.gz |