@@ -159,22 +159,29 @@ def connect(opts={})
159159
160160 http_logger_subscriber = Rex ::Proto ::Http ::HttpLoggerSubscriber . new ( logger : self )
161161
162- kerberos_authenticator = Msf ::Exploit ::Remote ::Kerberos ::ServiceAuthenticator ::HTTP . new (
163- host : datastore [ 'DomainControllerRhost' ] ,
164- hostname : datastore [ 'HTTP::Rhostname' ] ,
165- proxies : datastore [ 'Proxies' ] ,
166- realm : datastore [ 'DOMAIN' ] ,
167- username : datastore [ 'HttpUsername' ] ,
168- password : datastore [ 'HttpPassword' ] ,
169- timeout : 20 , # datastore['timeout']
170- framework : framework ,
171- framework_module : self ,
172- cache_file : datastore [ 'HTTP::Krb5Ccname' ] . blank? ? nil : datastore [ 'HTTP::Krb5Ccname' ] ,
173- mutual_auth : true ,
174- use_gss_checksum : true ,
175- ticket_storage : kerberos_ticket_storage ,
176- offered_etypes : Msf ::Exploit ::Remote ::AuthOption . as_default_offered_etypes ( datastore [ 'HTTP::KrbOfferedEncryptionTypes' ] )
177- )
162+ kerberos_authenticator = nil
163+ if datastore [ 'HTTP::Auth' ] == Msf ::Exploit ::Remote ::AuthOption ::KERBEROS
164+ fail_with ( Msf ::Exploit ::Failure ::BadConfig , 'The HTTP::Rhostname option is required when using Kerberos authentication.' ) if datastore [ 'HTTP::Rhostname' ] . blank?
165+ fail_with ( Msf ::Exploit ::Failure ::BadConfig , 'The DOMAIN option is required when using Kerberos authentication.' ) if datastore [ 'DOMAIN' ] . blank?
166+ offered_etypes = Msf ::Exploit ::Remote ::AuthOption . as_default_offered_etypes ( datastore [ 'HTTP::KrbOfferedEncryptionTypes' ] )
167+ fail_with ( Msf ::Exploit ::Failure ::BadConfig , 'At least one encryption type is required when using Kerberos authentication.' ) if offered_etypes . empty?
168+
169+ kerberos_authenticator = Msf ::Exploit ::Remote ::Kerberos ::ServiceAuthenticator ::HTTP . new (
170+ host : datastore [ 'DomainControllerRhost' ] ,
171+ hostname : datastore [ 'HTTP::Rhostname' ] ,
172+ proxies : datastore [ 'Proxies' ] ,
173+ realm : datastore [ 'DOMAIN' ] ,
174+ username : datastore [ 'HttpUsername' ] ,
175+ password : datastore [ 'HttpPassword' ] ,
176+ framework : framework ,
177+ framework_module : self ,
178+ cache_file : datastore [ 'HTTP::Krb5Ccname' ] . blank? ? nil : datastore [ 'HTTP::Krb5Ccname' ] ,
179+ mutual_auth : true ,
180+ use_gss_checksum : true ,
181+ ticket_storage : kerberos_ticket_storage ,
182+ offered_etypes : offered_etypes
183+ )
184+ end
178185
179186 nclient = Rex ::Proto ::Http ::Client . new (
180187 opts [ 'rhost' ] || rhost ,
0 commit comments