diff --git a/lib/metasploit/framework/credential.rb b/lib/metasploit/framework/credential.rb index 108463fb24..9ec1a428ff 100644 --- a/lib/metasploit/framework/credential.rb +++ b/lib/metasploit/framework/credential.rb @@ -48,7 +48,8 @@ module Metasploit # These values should be #demodularized from subclasses of # `Metasploit::Credential::Private` validates :private_type, - inclusion: { in: [ :password, :ntlm_hash, :ssh_key ] } + inclusion: { in: [ :password, :ntlm_hash, :ssh_key ] }, + if: "private_type.present?" # If we have no private we MUST have a public validates :public,