@@ -66,11 +66,6 @@ func NewKerberosProxyDialContext(dialer *net.Dialer, proxyURL *url.URL,
6666}
6767
6868func dialAndNegotiate (addr string , kerberosConfig KerberosConfig , baseDial func () (net.Conn , error )) (net.Conn , error ) {
69- // Validate required SPN parameter early
70- if kerberosConfig .ProxySPN == "" {
71- log .Printf ("Kerberos SPN is required but not provided" )
72- return nil , errors .New ("Kerberos SPN is required. Use --proxy-kerberos-spn flag or CX_PROXY_KERBEROS_SPN env var" )
73- }
7469
7570 conn , err := baseDial ()
7671 if err != nil {
@@ -80,36 +75,16 @@ func dialAndNegotiate(addr string, kerberosConfig KerberosConfig, baseDial func(
8075
8176 // Use default krb5.conf path if not specified
8277 krb5ConfPath := kerberosConfig .Krb5ConfPath
83- if krb5ConfPath == "" {
84- krb5ConfPath = GetDefaultKrb5ConfPath ()
85- }
86-
87- // Check if krb5.conf exists before trying to load it
88- if _ , err := os .Stat (krb5ConfPath ); os .IsNotExist (err ) {
89- log .Printf ("Kerberos configuration file not found at %s" , krb5ConfPath )
90- return conn , errors .New ("Kerberos configuration file not found. Please ensure krb5.conf is properly configured" )
91- }
9278
9379 // Load krb5.conf
9480 krb5cfg , err := config .Load (krb5ConfPath )
9581 if err != nil {
96- log .Printf ("Failed to load krb5.conf from %s: %s" , krb5ConfPath , err )
97- return conn , errors .New ("failed to load Kerberos configuration. Please check the krb5.conf file" )
82+ log .Printf ("Failed to load krb5 configuration file from %s: %s" , krb5ConfPath , err )
83+ return conn , errors .New ("failed to load Kerberos configuration. Please check the krb5 configuration file" )
9884 }
9985
10086 // Load credential cache
10187 ccPath := kerberosConfig .CcachePath
102- if ccPath == "" {
103- ccPath = getDefaultCCachePath ()
104- }
105-
106- // Check if credential cache exists before trying to load it
107- if ccPath != "" {
108- if _ , err := os .Stat (ccPath ); os .IsNotExist (err ) {
109- log .Printf ("Kerberos credential cache not found at %s" , ccPath )
110- return conn , errors .New ("Kerberos credential cache not found. Please run 'kinit' to obtain Kerberos tickets first" )
111- }
112- }
11388
11489 cc , err := credentials .LoadCCache (ccPath )
11590 if err != nil {
@@ -191,10 +166,6 @@ func dialAndNegotiate(addr string, kerberosConfig KerberosConfig, baseDial func(
191166// This function performs all the same checks as dialAndNegotiate but without actually
192167// making network connections, allowing early detection of configuration problems
193168func ValidateKerberosSetup (krb5ConfPath , ccachePath , proxySPN string ) error {
194- // Validate SPN
195- if proxySPN == "" {
196- return errors .New ("Kerberos SPN is required. Use --proxy-kerberos-spn flag or CX_PROXY_KERBEROS_SPN env var" )
197- }
198169
199170 // Use default krb5.conf path if not specified
200171 if krb5ConfPath == "" {
@@ -203,13 +174,13 @@ func ValidateKerberosSetup(krb5ConfPath, ccachePath, proxySPN string) error {
203174
204175 // Check if krb5.conf exists
205176 if _ , err := os .Stat (krb5ConfPath ); os .IsNotExist (err ) {
206- return errors .New ("Kerberos configuration file not found. Please ensure krb5.conf is properly configured" )
177+ return errors .New ("Kerberos configuration file not found. Please ensure krb5 configuration file is properly configured" )
207178 }
208179
209180 // Load krb5.conf to validate it's readable
210181 _ , err := config .Load (krb5ConfPath )
211182 if err != nil {
212- return errors .New ("failed to load Kerberos configuration. Please check the krb5.conf file" )
183+ return errors .New ("failed to load Kerberos configuration. Please check the krb5 configuration file" )
213184 }
214185
215186 // Get default credential cache path if not specified
0 commit comments