|
@@ -32,16 +32,16 @@ func TestClient_SuccessfulLogin_Keytab(t *testing.T) {
|
|
|
|
|
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- b, _ := hex.DecodeString(testdata.TESTUSER1_KEYTAB)
|
|
|
|
|
|
|
+ b, _ := hex.DecodeString(testdata.KEYTAB_TESTUSER1_TEST_GOKRB5)
|
|
|
kt := keytab.New()
|
|
kt := keytab.New()
|
|
|
kt.Unmarshal(b)
|
|
kt.Unmarshal(b)
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
var tests = []string{
|
|
var tests = []string{
|
|
|
- testdata.TEST_KDC,
|
|
|
|
|
- testdata.TEST_KDC_OLD,
|
|
|
|
|
- testdata.TEST_KDC_LASTEST,
|
|
|
|
|
|
|
+ testdata.KDC_PORT_TEST_GOKRB5,
|
|
|
|
|
+ testdata.KDC_PORT_TEST_GOKRB5_OLD,
|
|
|
|
|
+ testdata.KDC_PORT_TEST_GOKRB5_LASTEST,
|
|
|
}
|
|
}
|
|
|
for _, tst := range tests {
|
|
for _, tst := range tests {
|
|
|
c.Realms[0].KDC = []string{addr + ":" + tst}
|
|
c.Realms[0].KDC = []string{addr + ":" + tst}
|
|
@@ -59,13 +59,13 @@ func TestClient_SuccessfulLogin_Password(t *testing.T) {
|
|
|
|
|
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
var tests = []string{
|
|
var tests = []string{
|
|
|
- testdata.TEST_KDC,
|
|
|
|
|
- testdata.TEST_KDC_OLD,
|
|
|
|
|
- testdata.TEST_KDC_LASTEST,
|
|
|
|
|
|
|
+ testdata.KDC_PORT_TEST_GOKRB5,
|
|
|
|
|
+ testdata.KDC_PORT_TEST_GOKRB5_OLD,
|
|
|
|
|
+ testdata.KDC_PORT_TEST_GOKRB5_LASTEST,
|
|
|
}
|
|
}
|
|
|
for _, tst := range tests {
|
|
for _, tst := range tests {
|
|
|
c.Realms[0].KDC = []string{addr + ":" + tst}
|
|
c.Realms[0].KDC = []string{addr + ":" + tst}
|
|
@@ -81,15 +81,15 @@ func TestClient_SuccessfulLogin_Password(t *testing.T) {
|
|
|
func TestClient_SuccessfulLogin_TCPOnly(t *testing.T) {
|
|
func TestClient_SuccessfulLogin_TCPOnly(t *testing.T) {
|
|
|
test.Integration(t)
|
|
test.Integration(t)
|
|
|
|
|
|
|
|
- b, _ := hex.DecodeString(testdata.TESTUSER1_KEYTAB)
|
|
|
|
|
|
|
+ b, _ := hex.DecodeString(testdata.KEYTAB_TESTUSER1_TEST_GOKRB5)
|
|
|
kt := keytab.New()
|
|
kt := keytab.New()
|
|
|
kt.Unmarshal(b)
|
|
kt.Unmarshal(b)
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- c.Realms[0].KDC = []string{addr + ":" + testdata.TEST_KDC}
|
|
|
|
|
|
|
+ c.Realms[0].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5}
|
|
|
c.LibDefaults.UDPPreferenceLimit = 1
|
|
c.LibDefaults.UDPPreferenceLimit = 1
|
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
|
|
|
|
|
@@ -102,15 +102,15 @@ func TestClient_SuccessfulLogin_TCPOnly(t *testing.T) {
|
|
|
func TestClient_ASExchange_TGSExchange_EncTypes_Keytab(t *testing.T) {
|
|
func TestClient_ASExchange_TGSExchange_EncTypes_Keytab(t *testing.T) {
|
|
|
test.Integration(t)
|
|
test.Integration(t)
|
|
|
|
|
|
|
|
- b, _ := hex.DecodeString(testdata.TESTUSER1_KEYTAB)
|
|
|
|
|
|
|
+ b, _ := hex.DecodeString(testdata.KEYTAB_TESTUSER1_TEST_GOKRB5)
|
|
|
kt := keytab.New()
|
|
kt := keytab.New()
|
|
|
kt.Unmarshal(b)
|
|
kt.Unmarshal(b)
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- c.Realms[0].KDC = []string{addr + ":" + testdata.TEST_KDC_LASTEST}
|
|
|
|
|
|
|
+ c.Realms[0].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5_LASTEST}
|
|
|
var tests = []string{
|
|
var tests = []string{
|
|
|
"des3-cbc-sha1-kd",
|
|
"des3-cbc-sha1-kd",
|
|
|
"aes128-cts-hmac-sha1-96",
|
|
"aes128-cts-hmac-sha1-96",
|
|
@@ -142,12 +142,12 @@ func TestClient_ASExchange_TGSExchange_EncTypes_Keytab(t *testing.T) {
|
|
|
func TestClient_ASExchange_TGSExchange_EncTypes_Password(t *testing.T) {
|
|
func TestClient_ASExchange_TGSExchange_EncTypes_Password(t *testing.T) {
|
|
|
test.Integration(t)
|
|
test.Integration(t)
|
|
|
|
|
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- c.Realms[0].KDC = []string{addr + ":" + testdata.TEST_KDC_LASTEST}
|
|
|
|
|
|
|
+ c.Realms[0].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5_LASTEST}
|
|
|
var tests = []string{
|
|
var tests = []string{
|
|
|
"des3-cbc-sha1-kd",
|
|
"des3-cbc-sha1-kd",
|
|
|
"aes128-cts-hmac-sha1-96",
|
|
"aes128-cts-hmac-sha1-96",
|
|
@@ -179,15 +179,15 @@ func TestClient_ASExchange_TGSExchange_EncTypes_Password(t *testing.T) {
|
|
|
func TestClient_FailedLogin(t *testing.T) {
|
|
func TestClient_FailedLogin(t *testing.T) {
|
|
|
test.Integration(t)
|
|
test.Integration(t)
|
|
|
|
|
|
|
|
- b, _ := hex.DecodeString(testdata.TESTUSER1_WRONGPASSWD)
|
|
|
|
|
|
|
+ b, _ := hex.DecodeString(testdata.KEYTAB_TESTUSER1_TEST_GOKRB5_WRONGPASSWD)
|
|
|
kt := keytab.New()
|
|
kt := keytab.New()
|
|
|
kt.Unmarshal(b)
|
|
kt.Unmarshal(b)
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- c.Realms[0].KDC = []string{addr + ":" + testdata.TEST_KDC}
|
|
|
|
|
|
|
+ c.Realms[0].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5}
|
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
|
|
|
|
|
|
err := cl.Login()
|
|
err := cl.Login()
|
|
@@ -199,15 +199,15 @@ func TestClient_FailedLogin(t *testing.T) {
|
|
|
func TestClient_SuccessfulLogin_UserRequiringPreAuth(t *testing.T) {
|
|
func TestClient_SuccessfulLogin_UserRequiringPreAuth(t *testing.T) {
|
|
|
test.Integration(t)
|
|
test.Integration(t)
|
|
|
|
|
|
|
|
- b, _ := hex.DecodeString(testdata.TESTUSER2_KEYTAB)
|
|
|
|
|
|
|
+ b, _ := hex.DecodeString(testdata.KEYTAB_TESTUSER2_TEST_GOKRB5)
|
|
|
kt := keytab.New()
|
|
kt := keytab.New()
|
|
|
kt.Unmarshal(b)
|
|
kt.Unmarshal(b)
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- c.Realms[0].KDC = []string{addr + ":" + testdata.TEST_KDC}
|
|
|
|
|
|
|
+ c.Realms[0].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5}
|
|
|
cl := client.NewWithKeytab("testuser2", "TEST.GOKRB5", kt, c)
|
|
cl := client.NewWithKeytab("testuser2", "TEST.GOKRB5", kt, c)
|
|
|
|
|
|
|
|
err := cl.Login()
|
|
err := cl.Login()
|
|
@@ -219,15 +219,15 @@ func TestClient_SuccessfulLogin_UserRequiringPreAuth(t *testing.T) {
|
|
|
func TestClient_SuccessfulLogin_UserRequiringPreAuth_TCPOnly(t *testing.T) {
|
|
func TestClient_SuccessfulLogin_UserRequiringPreAuth_TCPOnly(t *testing.T) {
|
|
|
test.Integration(t)
|
|
test.Integration(t)
|
|
|
|
|
|
|
|
- b, _ := hex.DecodeString(testdata.TESTUSER2_KEYTAB)
|
|
|
|
|
|
|
+ b, _ := hex.DecodeString(testdata.KEYTAB_TESTUSER2_TEST_GOKRB5)
|
|
|
kt := keytab.New()
|
|
kt := keytab.New()
|
|
|
kt.Unmarshal(b)
|
|
kt.Unmarshal(b)
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- c.Realms[0].KDC = []string{addr + ":" + testdata.TEST_KDC}
|
|
|
|
|
|
|
+ c.Realms[0].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5}
|
|
|
c.LibDefaults.UDPPreferenceLimit = 1
|
|
c.LibDefaults.UDPPreferenceLimit = 1
|
|
|
cl := client.NewWithKeytab("testuser2", "TEST.GOKRB5", kt, c)
|
|
cl := client.NewWithKeytab("testuser2", "TEST.GOKRB5", kt, c)
|
|
|
|
|
|
|
@@ -240,11 +240,11 @@ func TestClient_SuccessfulLogin_UserRequiringPreAuth_TCPOnly(t *testing.T) {
|
|
|
func TestClient_NetworkTimeout(t *testing.T) {
|
|
func TestClient_NetworkTimeout(t *testing.T) {
|
|
|
test.Integration(t)
|
|
test.Integration(t)
|
|
|
|
|
|
|
|
- b, _ := hex.DecodeString(testdata.TESTUSER1_KEYTAB)
|
|
|
|
|
|
|
+ b, _ := hex.DecodeString(testdata.KEYTAB_TESTUSER1_TEST_GOKRB5)
|
|
|
kt := keytab.New()
|
|
kt := keytab.New()
|
|
|
kt.Unmarshal(b)
|
|
kt.Unmarshal(b)
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
- c.Realms[0].KDC = []string{testdata.TEST_KDC_BADADDR + ":88"}
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
|
|
+ c.Realms[0].KDC = []string{testdata.KDC_IP_TEST_GOKRB5_BADADDR + ":88"}
|
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
|
|
|
|
|
|
err := cl.Login()
|
|
err := cl.Login()
|
|
@@ -256,15 +256,15 @@ func TestClient_NetworkTimeout(t *testing.T) {
|
|
|
func TestClient_GetServiceTicket(t *testing.T) {
|
|
func TestClient_GetServiceTicket(t *testing.T) {
|
|
|
test.Integration(t)
|
|
test.Integration(t)
|
|
|
|
|
|
|
|
- b, _ := hex.DecodeString(testdata.TESTUSER1_KEYTAB)
|
|
|
|
|
|
|
+ b, _ := hex.DecodeString(testdata.KEYTAB_TESTUSER1_TEST_GOKRB5)
|
|
|
kt := keytab.New()
|
|
kt := keytab.New()
|
|
|
kt.Unmarshal(b)
|
|
kt.Unmarshal(b)
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- c.Realms[0].KDC = []string{addr + ":" + testdata.TEST_KDC}
|
|
|
|
|
|
|
+ c.Realms[0].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5}
|
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
|
|
|
|
|
|
err := cl.Login()
|
|
err := cl.Login()
|
|
@@ -291,15 +291,15 @@ func TestClient_GetServiceTicket(t *testing.T) {
|
|
|
func TestClient_GetServiceTicket_InvalidSPN(t *testing.T) {
|
|
func TestClient_GetServiceTicket_InvalidSPN(t *testing.T) {
|
|
|
test.Integration(t)
|
|
test.Integration(t)
|
|
|
|
|
|
|
|
- b, _ := hex.DecodeString(testdata.TESTUSER1_KEYTAB)
|
|
|
|
|
|
|
+ b, _ := hex.DecodeString(testdata.KEYTAB_TESTUSER1_TEST_GOKRB5)
|
|
|
kt := keytab.New()
|
|
kt := keytab.New()
|
|
|
kt.Unmarshal(b)
|
|
kt.Unmarshal(b)
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- c.Realms[0].KDC = []string{addr + ":" + testdata.TEST_KDC}
|
|
|
|
|
|
|
+ c.Realms[0].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5}
|
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
|
|
|
|
|
|
err := cl.Login()
|
|
err := cl.Login()
|
|
@@ -315,15 +315,15 @@ func TestClient_GetServiceTicket_InvalidSPN(t *testing.T) {
|
|
|
func TestClient_GetServiceTicket_OlderKDC(t *testing.T) {
|
|
func TestClient_GetServiceTicket_OlderKDC(t *testing.T) {
|
|
|
test.Integration(t)
|
|
test.Integration(t)
|
|
|
|
|
|
|
|
- b, _ := hex.DecodeString(testdata.TESTUSER1_KEYTAB)
|
|
|
|
|
|
|
+ b, _ := hex.DecodeString(testdata.KEYTAB_TESTUSER1_TEST_GOKRB5)
|
|
|
kt := keytab.New()
|
|
kt := keytab.New()
|
|
|
kt.Unmarshal(b)
|
|
kt.Unmarshal(b)
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- c.Realms[0].KDC = []string{addr + ":" + testdata.TEST_KDC_OLD}
|
|
|
|
|
|
|
+ c.Realms[0].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5_OLD}
|
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
|
|
|
|
|
|
err := cl.Login()
|
|
err := cl.Login()
|
|
@@ -342,15 +342,15 @@ func TestClient_GetServiceTicket_OlderKDC(t *testing.T) {
|
|
|
func TestMultiThreadedClientUse(t *testing.T) {
|
|
func TestMultiThreadedClientUse(t *testing.T) {
|
|
|
test.Integration(t)
|
|
test.Integration(t)
|
|
|
|
|
|
|
|
- b, _ := hex.DecodeString(testdata.TESTUSER1_KEYTAB)
|
|
|
|
|
|
|
+ b, _ := hex.DecodeString(testdata.KEYTAB_TESTUSER1_TEST_GOKRB5)
|
|
|
kt := keytab.New()
|
|
kt := keytab.New()
|
|
|
kt.Unmarshal(b)
|
|
kt.Unmarshal(b)
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- c.Realms[0].KDC = []string{addr + ":" + testdata.TEST_KDC}
|
|
|
|
|
|
|
+ c.Realms[0].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5}
|
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
|
|
|
|
|
|
var wg sync.WaitGroup
|
|
var wg sync.WaitGroup
|
|
@@ -419,12 +419,12 @@ func TestNewFromCCache(t *testing.T) {
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Fatal("error getting test CCache")
|
|
t.Fatal("error getting test CCache")
|
|
|
}
|
|
}
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- c.Realms[0].KDC = []string{addr + ":" + testdata.TEST_KDC}
|
|
|
|
|
|
|
+ c.Realms[0].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5}
|
|
|
cl, err := client.NewFromCCache(cc, c)
|
|
cl, err := client.NewFromCCache(cc, c)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Fatalf("error creating client from CCache: %v", err)
|
|
t.Fatalf("error creating client from CCache: %v", err)
|
|
@@ -439,21 +439,21 @@ func TestNewFromCCache(t *testing.T) {
|
|
|
func TestClient_GetServiceTicket_Trusted_Resource_Domain(t *testing.T) {
|
|
func TestClient_GetServiceTicket_Trusted_Resource_Domain(t *testing.T) {
|
|
|
test.Integration(t)
|
|
test.Integration(t)
|
|
|
|
|
|
|
|
- b, _ := hex.DecodeString(testdata.TESTUSER1_KEYTAB)
|
|
|
|
|
|
|
+ b, _ := hex.DecodeString(testdata.KEYTAB_TESTUSER1_TEST_GOKRB5)
|
|
|
kt := keytab.New()
|
|
kt := keytab.New()
|
|
|
kt.Unmarshal(b)
|
|
kt.Unmarshal(b)
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
|
|
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
for i, r := range c.Realms {
|
|
for i, r := range c.Realms {
|
|
|
if r.Realm == "TEST.GOKRB5" {
|
|
if r.Realm == "TEST.GOKRB5" {
|
|
|
- c.Realms[i].KDC = []string{addr + ":" + testdata.TEST_KDC}
|
|
|
|
|
|
|
+ c.Realms[i].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5}
|
|
|
}
|
|
}
|
|
|
if r.Realm == "RESDOM.GOKRB5" {
|
|
if r.Realm == "RESDOM.GOKRB5" {
|
|
|
- c.Realms[i].KDC = []string{addr + ":" + testdata.TEST_KDC_RESDOM}
|
|
|
|
|
|
|
+ c.Realms[i].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5_RESDOM}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -477,7 +477,7 @@ func TestClient_GetServiceTicket_Trusted_Resource_Domain(t *testing.T) {
|
|
|
assert.Equal(t, spn, tkt.SName.PrincipalNameString())
|
|
assert.Equal(t, spn, tkt.SName.PrincipalNameString())
|
|
|
assert.Equal(t, etypeID.ETypesByName["aes256-cts-hmac-sha1-96"], key.KeyType)
|
|
assert.Equal(t, etypeID.ETypesByName["aes256-cts-hmac-sha1-96"], key.KeyType)
|
|
|
|
|
|
|
|
- b, _ = hex.DecodeString(testdata.SYSHTTP_RESDOM_KEYTAB)
|
|
|
|
|
|
|
+ b, _ = hex.DecodeString(testdata.KEYTAB_SYSHTTP_RESDOM_GOKRB5)
|
|
|
skt := keytab.New()
|
|
skt := keytab.New()
|
|
|
skt.Unmarshal(b)
|
|
skt.Unmarshal(b)
|
|
|
err = tkt.DecryptEncPart(skt, nil)
|
|
err = tkt.DecryptEncPart(skt, nil)
|
|
@@ -498,7 +498,7 @@ func login() error {
|
|
|
return fmt.Errorf("cannot open krb5.conf: %v", err)
|
|
return fmt.Errorf("cannot open krb5.conf: %v", err)
|
|
|
}
|
|
}
|
|
|
defer file.Close()
|
|
defer file.Close()
|
|
|
- fmt.Fprintf(file, testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ fmt.Fprintf(file, testdata.KRB5_CONF)
|
|
|
|
|
|
|
|
cmd := exec.Command(kinitCmd, "testuser1@TEST.GOKRB5")
|
|
cmd := exec.Command(kinitCmd, "testuser1@TEST.GOKRB5")
|
|
|
|
|
|
|
@@ -559,12 +559,12 @@ func TestGetServiceTicketFromCCacheTGT(t *testing.T) {
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Errorf("error loading CCache: %v", err)
|
|
t.Errorf("error loading CCache: %v", err)
|
|
|
}
|
|
}
|
|
|
- cfg, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ cfg, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- cfg.Realms[0].KDC = []string{addr + ":" + testdata.TEST_KDC}
|
|
|
|
|
|
|
+ cfg.Realms[0].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5}
|
|
|
cl, err := client.NewFromCCache(c, cfg)
|
|
cl, err := client.NewFromCCache(c, cfg)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Fatalf("error generating client from ccache: %v", err)
|
|
t.Fatalf("error generating client from ccache: %v", err)
|
|
@@ -640,15 +640,15 @@ func TestGetServiceTicketFromCCacheWithoutKDC(t *testing.T) {
|
|
|
func TestClient_ChangePasswd(t *testing.T) {
|
|
func TestClient_ChangePasswd(t *testing.T) {
|
|
|
test.Integration(t)
|
|
test.Integration(t)
|
|
|
|
|
|
|
|
- b, _ := hex.DecodeString(testdata.TESTUSER1_KEYTAB)
|
|
|
|
|
|
|
+ b, _ := hex.DecodeString(testdata.KEYTAB_TESTUSER1_TEST_GOKRB5)
|
|
|
kt := keytab.New()
|
|
kt := keytab.New()
|
|
|
kt.Unmarshal(b)
|
|
kt.Unmarshal(b)
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- c.Realms[0].KDC = []string{addr + ":" + testdata.TEST_KDC}
|
|
|
|
|
|
|
+ c.Realms[0].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5}
|
|
|
c.Realms[0].KPasswdServer = []string{addr + ":464"}
|
|
c.Realms[0].KPasswdServer = []string{addr + ":464"}
|
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
|
|
|
|
|
@@ -659,13 +659,13 @@ func TestClient_ChangePasswd(t *testing.T) {
|
|
|
assert.True(t, ok, "password was not changed")
|
|
assert.True(t, ok, "password was not changed")
|
|
|
|
|
|
|
|
cl = client.NewWithPassword("testuser1", "TEST.GOKRB5", "newpassword", c)
|
|
cl = client.NewWithPassword("testuser1", "TEST.GOKRB5", "newpassword", c)
|
|
|
- ok, err = cl.ChangePasswd(testdata.TESTUSER1_PASSWORD)
|
|
|
|
|
|
|
+ ok, err = cl.ChangePasswd(testdata.TESTUSER_PASSWORD)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Fatalf("error changing password: %v", err)
|
|
t.Fatalf("error changing password: %v", err)
|
|
|
}
|
|
}
|
|
|
assert.True(t, ok, "password was not changed back")
|
|
assert.True(t, ok, "password was not changed back")
|
|
|
|
|
|
|
|
- cl = client.NewWithPassword("testuser1", "TEST.GOKRB5", testdata.TESTUSER1_PASSWORD, c)
|
|
|
|
|
|
|
+ cl = client.NewWithPassword("testuser1", "TEST.GOKRB5", testdata.TESTUSER_PASSWORD, c)
|
|
|
err = cl.Login()
|
|
err = cl.Login()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Fatalf("Could not log back in after reverting password: %v", err)
|
|
t.Fatalf("Could not log back in after reverting password: %v", err)
|
|
@@ -677,13 +677,13 @@ func TestClient_Destroy(t *testing.T) {
|
|
|
|
|
|
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
addr := os.Getenv("TEST_KDC_ADDR")
|
|
|
if addr == "" {
|
|
if addr == "" {
|
|
|
- addr = testdata.TEST_KDC_ADDR
|
|
|
|
|
|
|
+ addr = testdata.KDC_IP_TEST_GOKRB5
|
|
|
}
|
|
}
|
|
|
- b, _ := hex.DecodeString(testdata.TESTUSER1_KEYTAB)
|
|
|
|
|
|
|
+ b, _ := hex.DecodeString(testdata.KEYTAB_TESTUSER1_TEST_GOKRB5)
|
|
|
kt := keytab.New()
|
|
kt := keytab.New()
|
|
|
kt.Unmarshal(b)
|
|
kt.Unmarshal(b)
|
|
|
- c, _ := config.NewFromString(testdata.TEST_KRB5CONF)
|
|
|
|
|
- c.Realms[0].KDC = []string{addr + ":" + testdata.TEST_KDC_SHORTTICKETS}
|
|
|
|
|
|
|
+ c, _ := config.NewFromString(testdata.KRB5_CONF)
|
|
|
|
|
+ c.Realms[0].KDC = []string{addr + ":" + testdata.KDC_PORT_TEST_GOKRB5_SHORTTICKETS}
|
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
cl := client.NewWithKeytab("testuser1", "TEST.GOKRB5", kt, c)
|
|
|
|
|
|
|
|
err := cl.Login()
|
|
err := cl.Login()
|