Skip to content

Commit f1952b7

Browse files
simo5frozencemetery
authored andcommitted
Add test that exercises S4u2Proxy code
This test shows that currently GssapiAcceptor {HOSTNAME} option will break the S4U2Proxy case. Signed-off-by: Simo Sorce <[email protected]> [[email protected]: nits]
1 parent 27ad217 commit f1952b7

File tree

3 files changed

+38
-17
lines changed

3 files changed

+38
-17
lines changed

tests/httpd.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,21 @@ CoreDumpDirectory "{HTTPROOT}"
238238
Require valid-user
239239
</Location>
240240

241+
<Location /hostname_proxy>
242+
AuthType GSSAPI
243+
AuthName "Login"
244+
GssapiSSLonly Off
245+
GssapiCredStore ccache:{HTTPROOT}/httpd_krb5_ccache
246+
GssapiCredStore client_keytab:{HTTPROOT}/http.keytab
247+
GssapiCredStore keytab:{HTTPROOT}/http.keytab
248+
GssapiBasicAuth Off
249+
GssapiAllowedMech krb5
250+
GssapiAcceptorName {{HOSTNAME}}
251+
GssapiUseS4U2Proxy On
252+
GssapiDelegCcacheDir {HTTPROOT}/delegccachedir
253+
Require valid-user
254+
</Location>
255+
241256
<Location /required_name_attr1>
242257
AuthType GSSAPI
243258
AuthName "Required Name Attributes"

tests/magtests.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -691,26 +691,32 @@ def test_no_negotiate(testdir, testenv, logfile):
691691

692692

693693
def test_hostname_acceptor(testdir, testenv, logfile):
694-
hdir = os.path.join(testdir, 'httpd', 'html', 'hostname_acceptor')
694+
plain_test_name = 'hostname_acceptor'
695+
hdir = os.path.join(testdir, 'httpd', 'html', plain_test_name)
695696
os.mkdir(hdir)
696697
shutil.copy('tests/index.html', hdir)
697698

699+
proxy_test_name = 'hostname_proxy'
700+
hdir = os.path.join(testdir, 'httpd', 'html', proxy_test_name)
701+
os.mkdir(hdir)
702+
shutil.copy('tests/index.html', hdir)
703+
ddir = os.path.join(testdir, 'httpd', 'delegccachedir')
704+
os.mkdir(ddir)
705+
698706
failed = False
699-
for (name, fail) in [(WRAP_HOSTNAME, False),
700-
(WRAP_ALIASNAME, False),
701-
(WRAP_FAILNAME, True)]:
702-
res = subprocess.Popen(["tests/t_hostname_acceptor.py", name],
703-
stdout=logfile, stderr=logfile,
704-
env=testenv, preexec_fn=os.setsid)
705-
res.wait()
706-
if fail:
707-
if res.returncode == 0:
708-
failed = True
709-
else:
710-
if res.returncode != 0:
707+
for test_name in [plain_test_name, proxy_test_name]:
708+
for (name, fail) in [(WRAP_HOSTNAME, False),
709+
(WRAP_ALIASNAME, False),
710+
(WRAP_FAILNAME, True)]:
711+
res = subprocess.Popen(["tests/t_hostname_acceptor.py",
712+
name, test_name],
713+
stdout=logfile, stderr=logfile,
714+
env=testenv, preexec_fn=os.setsid)
715+
res.wait()
716+
if (fail and res.returncode == 0) or \
717+
(not fail and res.returncode != 0):
711718
failed = True
712-
if failed:
713-
break
719+
break
714720

715721
if failed:
716722
sys.stderr.write('HOSTNAME ACCEPTOR: FAILED\n')

tests/t_hostname_acceptor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
if __name__ == '__main__':
1111
sess = requests.Session()
12-
url = 'http://%s/hostname_acceptor/' % sys.argv[1]
12+
url = 'http://{}/{}/'.format(sys.argv[1], sys.argv[2])
1313
r = sess.get(url, auth=HTTPKerberosAuth(delegate=True))
1414
if r.status_code != 200:
15-
raise ValueError('Hostname-based acceptor failed')
15+
raise ValueError('Hostname acceptor ({}) failed'.format(sys.argv[2]))

0 commit comments

Comments
 (0)