From 566249bbe88862270c556756979429ada3f3b784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Lundstr=C3=B6m?= Date: Thu, 11 Apr 2019 11:22:53 +0200 Subject: [PATCH 1/4] Use gssapi instead of the aged kerberos package requests-kerberos is deprecated, switch to the maintained requests-gssapi. --- pepper/libpepper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pepper/libpepper.py b/pepper/libpepper.py index c5cecf6..c9ab461 100644 --- a/pepper/libpepper.py +++ b/pepper/libpepper.py @@ -267,8 +267,8 @@ def req_requests(self, path, data=None): ''' import requests - from requests_kerberos import HTTPKerberosAuth, OPTIONAL - auth = HTTPKerberosAuth(mutual_authentication=OPTIONAL) + from requests_gssapi import HTTPSPNEGOAuth, OPTIONAL + auth = HTTPSPNEGOAuth(mutual_authentication=OPTIONAL) headers = { 'Accept': 'application/json', 'Content-Type': 'application/json', From 6b2f2f2d46a8d741e0ba3e061125282bcb668aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Lundstr=C3=B6m?= Date: Thu, 11 Apr 2019 14:12:35 +0200 Subject: [PATCH 2/4] Avoid password prompt when using eauth=kerberos --- pepper/cli.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pepper/cli.py b/pepper/cli.py index 1446333..68901d9 100644 --- a/pepper/cli.py +++ b/pepper/cli.py @@ -411,7 +411,9 @@ def get_login_details(self): else: if self.options.username is not None: results['SALTAPI_USER'] = self.options.username - if self.options.password is None and results['SALTAPI_PASS'] is None: + if self.options.password is None and \ + results['SALTAPI_PASS'] is None and \ + results['SALTAPI_EAUTH'] != 'kerberos': if self.options.interactive: results['SALTAPI_PASS'] = getpass.getpass(prompt='Password: ') else: From 6ccb0c8ebee475a2dd914a37acb18b2c4da7bb40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Lundstr=C3=B6m?= Date: Tue, 26 Nov 2019 14:58:36 +0100 Subject: [PATCH 3/4] eauth=kerberos is not noopt No idea why it was added in 5a11651baf032fbdf0f1dc334674284e76570b0f --- tests/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 02b9777..81d2662 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -89,7 +89,6 @@ def pepperconfig(salt_api_port): SALTAPI_EAUTH=sharedsecret [noopts] SALTAPI_URL=http://localhost:{0}/ - SALTAPI_EAUTH=kerberos '''.format(salt_api_port)) with open('tests/.pepperrc', 'w') as pepper_file: print(config, file=pepper_file) From 79604c5dcb32e807c5da05eb89fd98e530bc5cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Lundstr=C3=B6m?= Date: Wed, 27 Nov 2019 12:32:46 +0100 Subject: [PATCH 4/4] Add setup.py extras This will install requests-gssapi automatically when installing 'pepper[kerberos]'. --- setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.py b/setup.py index c013a12..c6d645b 100644 --- a/setup.py +++ b/setup.py @@ -38,6 +38,9 @@ 'packages': [ 'pepper', ], + 'extras_require': { + 'kerberos': ["requests-gssapi>=1.1.0"], + }, 'scripts': [ 'scripts/pepper', ]