Browse Source

test against mod_auth_gssapi

Jonathan Turner 7 years ago
parent
commit
cfa6e89a3b

+ 1 - 1
.travis.yml

@@ -31,7 +31,7 @@ before_script:
   - sudo sed -i 's/nameserver .*/nameserver 127.0.0.1/g' /etc/resolv.conf
 
 env:
-  - TEST_KDC_ADDR=127.0.0.1 TEST_HTTP_URL="http://host.test.gokrb5/index.html" DNSUTILS_OVERRIDE_NS="127.0.0.1:53" DEBIAN_FRONTEND=noninteractive
+  - TEST_KDC_ADDR=127.0.0.1 TEST_HTTP_URL="http://host.test.gokrb5" DNSUTILS_OVERRIDE_NS="127.0.0.1:53" DEBIAN_FRONTEND=noninteractive
 
 script:
   - test -z $(gofmt -s -d -l -e $GO_FILES | tee /dev/fd/2 | xargs | sed 's/\s//g') # Fail if a .go file hasn't been formatted with gofmt

+ 19 - 13
client/client_integration_test.go

@@ -338,21 +338,27 @@ func TestClient_SetSPNEGOHeader(t *testing.T) {
 	if url == "" {
 		url = testdata.TEST_HTTP_URL
 	}
-	r, _ := http.NewRequest("GET", url, nil)
-	httpResp, err := http.DefaultClient.Do(r)
-	if err != nil {
-		t.Fatalf("request error: %v\n", err)
+	paths := []string{
+		"/modkerb/index.html",
+		"/modgssapi/index.html",
 	}
-	assert.Equal(t, http.StatusUnauthorized, httpResp.StatusCode, "Status code in response to client with no SPNEGO not as expected")
-	err = cl.SetSPNEGOHeader(r, "HTTP/host.test.gokrb5")
-	if err != nil {
-		t.Fatalf("error setting client SPNEGO header: %v", err)
-	}
-	httpResp, err = http.DefaultClient.Do(r)
-	if err != nil {
-		t.Fatalf("request error: %v\n", err)
+	for _, p := range paths {
+		r, _ := http.NewRequest("GET", url+p, nil)
+		httpResp, err := http.DefaultClient.Do(r)
+		if err != nil {
+			t.Fatalf("%s request error: %v\n", url+p, err)
+		}
+		assert.Equal(t, http.StatusUnauthorized, httpResp.StatusCode, "Status code in response to client with no SPNEGO not as expected")
+		err = cl.SetSPNEGOHeader(r, "HTTP/host.test.gokrb5")
+		if err != nil {
+			t.Fatalf("error setting client SPNEGO header: %v", err)
+		}
+		httpResp, err = http.DefaultClient.Do(r)
+		if err != nil {
+			t.Fatalf("%s request error: %v\n", url+p, err)
+		}
+		assert.Equal(t, http.StatusOK, httpResp.StatusCode, "Status code in response to client SPNEGO request not as expected")
 	}
-	assert.Equal(t, http.StatusOK, httpResp.StatusCode, "Status code in response to client SPNEGO request not as expected")
 }
 
 func TestMultiThreadedClientUse(t *testing.T) {

File diff suppressed because it is too large
+ 0 - 0
testdata/test_vectors.go


+ 4 - 1
testenv/docker/krbhttp/Dockerfile

@@ -8,12 +8,15 @@ ENTRYPOINT ["/usr/sbin/httpd", "-DFOREGROUND"]
 RUN yum install -y \
   httpd \
   mod_auth_kerb \
+  mod_auth_gssapi \
   mod_ssl \
   tcpdump krb5-workstation vim \
   && yum update -y && yum clean all
 
+RUN mkdir /var/www/html/modkerb && mkdir /var/www/html/modgssapi
 ADD httpd-krb5.conf /etc/httpd/conf.d/
-ADD index.html /var/www/html/index.html
+ADD index.html /var/www/html/modkerb/index.html
+ADD index.html /var/www/html/modgssapi/index.html
 ADD krb5.conf /etc/krb5.conf
 ADD http.testtab /etc/httpd/
 #RUN ln -sf /dev/stdout /var/log/httpd/access_log && \

+ 8 - 2
testenv/docker/krbhttp/httpd-krb5.conf

@@ -1,6 +1,12 @@
 LimitRequestFieldSize 65536
 ProxyIOBufferSize 65536
-<LocationMatch />
+<LocationMatch /modgssapi>
+    AuthType GSSAPI
+    AuthName "GoKrb5 Test SPNEGO"
+    GssapiCredStore keytab:/etc/httpd/http.testtab
+    Require valid-user
+</LocationMatch>
+<LocationMatch /modkerb>
         AuthType Kerberos
         AuthName "TEST"
         KrbServiceName HTTP
@@ -11,4 +17,4 @@ ProxyIOBufferSize 65536
         Krb5KeyTab /etc/httpd/http.testtab
         #KrbSaveCredentials On
         require valid-user
-</LocationMatch>
+</LocationMatch>

+ 5 - 1
testenv/krbhttp-vagrant/bootstrap.sh

@@ -9,6 +9,7 @@ yum update -y
 yum install -y \
    httpd \
    mod_auth_kerb \
+   mod_auth_gssapi \
    mod_ssl \
    ntp \
    krb5-workstation
@@ -32,7 +33,10 @@ mv /vagrant/httpd-krb5.conf /etc/httpd/conf.d/
 chcon system_u:object_r:httpd_config_t:s0 /etc/httpd/conf.d/*
 chcon system_u:object_r:httpd_config_t:s0 /vagrant/http.testtab
 chmod 644 /vagrant/http.testtab
-echo "<html>TEST.GOKRB5</html>" > /var/www/html/index.html
+mkdir /var/www/html/modkerb
+mkdir /var/www/html/modgssapi
+echo "<html>TEST.GOKRB5</html>" > /var/www/html/modkerb/index.html
+echo "<html>TEST.GOKRB5</html>" > /var/www/html/modgssapi/index.html
 
 systemctl restart httpd
 systemctl enable httpd

+ 8 - 1
testenv/krbhttp-vagrant/httpd-krb5.conf

@@ -1,6 +1,12 @@
 LimitRequestFieldSize 65536
 ProxyIOBufferSize 65536
-<LocationMatch />
+<LocationMatch /modgssapi>
+    AuthType GSSAPI
+    AuthName "GoKrb5 Test SPNEGO"
+    GssapiCredStore keytab:/vagrant/http.testtab
+    Require valid-user
+</LocationMatch>
+<LocationMatch /modkerb>
         AuthType Kerberos
         AuthName "TEST"
         KrbServiceName HTTP
@@ -12,3 +18,4 @@ ProxyIOBufferSize 65536
         #KrbSaveCredentials On
         require valid-user
 </LocationMatch>
+

Some files were not shown because too many files changed in this diff