[PUP-6483] "puppet resource user", when run in Windows creates a login attempt. Created: 2016/07/08  Updated: 2016/09/20  Due: 2016/08/03  Resolved: 2016/08/05

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: None
Fix Version/s: PUP 4.6.0

Type: Bug Priority: Normal
Reporter: Erik Hansen Assignee: Rob Reynolds
Resolution: Fixed Votes: 0
Labels: customer-escalation
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File puppet_apply_2-security_log-x64.png     PNG File puppet_apply_2-x64.png     PNG File puppet_apply-security_log-x64.png     PNG File puppet_apply-x64.png     PNG File puppet_resource_user-security-log-x64.png     PNG File puppet_resource_user-x64.png    
Issue Links:
Relates
relates to PUP-5271 Windows user resource should not mana... Closed
relates to PUP-6569 Improve error messaging for Windows u... Resolved
relates to PUP-5271 Windows user resource should not mana... Closed
relates to PUP-6586 User resource always reports password... Closed
Template:
Acceptance Criteria:

Verify that there are no audit log entries after running puppet resource user

Story Points: 2
Sprint: Windows 2016-08-10

 Description   

When running "puppet resource user" in Windows, the action results in a log entry in the Windows security log:

Log Name: Security
Source: Microsoft-Windows-Security-Auditing
Date: 7/8/2016 10:26:11 PM
Event ID: 4625
Task Category: Logon
Level: Information
Keywords: Audit Failure
User: N/A
Computer: pe-201612-agent-win2008
Description:
An account failed to log on.

Subject:
Security ID: PE-201612-AGENT\vagrant
Account Name: vagrant
Account Domain: PE-201612-AGENT
Logon ID: 0xf07a

Logon Type: 3

Account For Which Logon Failed:
Security ID: NULL SID
Account Name: vagrant
Account Domain: PE-201612-AGENT

Failure Information:
Failure Reason: Unknown user name or bad password.
Status: 0xc000006d
Sub Status: 0xc000006a

Process Information:
Caller Process ID: 0x538
Caller Process Name: C:\Program Files\Puppet Labs\Puppet\sys\ruby\bin\ruby.exe

Network Information:
Workstation Name: PE-201612-AGENT
Source Network Address: -
Source Port: -

Detailed Authentication Information:
Logon Process: Advapi
Authentication Package: Negotiate
Transited Services: -
Package Name (NTLM only): -
Key Length: 0

This event is generated when a logon request fails. It is generated on the computer where access was attempted.

The Subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.

The Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network).

The Process Information fields indicate which account and process on the system requested the logon.

The Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.

The authentication information fields provide detailed information about this specific logon request.

  • Transited services indicate which intermediate services have participated in this logon request.
  • Package name indicates which sub-protocol was used among the NTLM protocols.
  • Key length indicates the length of the generated session key. This will be 0 if no session key was requested.
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
    <Provider Name="Microsoft-Windows-Security-Auditing" Guid=" {54849625-5478-4994-A5BA-3E3B0328C30D}

    " />
    <EventID>4625</EventID>
    <Version>0</Version>
    <Level>0</Level>
    <Task>12544</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8010000000000000</Keywords>
    <TimeCreated SystemTime="2016-07-08T22:26:11.765645000Z" />
    <EventRecordID>1682</EventRecordID>
    <Correlation />
    <Execution ProcessID="468" ThreadID="532" />
    <Channel>Security</Channel>
    <Computer>pe-201612-agent-win2008</Computer>
    <Security />
    </System>
    <EventData>
    <Data Name="SubjectUserSid">S-1-5-21-1860036329-3057280495-287023118-500</Data>
    <Data Name="SubjectUserName">vagrant</Data>
    <Data Name="SubjectDomainName">PE-201612-AGENT</Data>
    <Data Name="SubjectLogonId">0xf07a</Data>
    <Data Name="TargetUserSid">S-1-0-0</Data>
    <Data Name="TargetUserName">vagrant</Data>
    <Data Name="TargetDomainName">PE-201612-AGENT</Data>
    <Data Name="Status">0xc000006d</Data>
    <Data Name="FailureReason">%%2313</Data>
    <Data Name="SubStatus">0xc000006a</Data>
    <Data Name="LogonType">3</Data>
    <Data Name="LogonProcessName">Advapi </Data>
    <Data Name="AuthenticationPackageName">Negotiate</Data>
    <Data Name="WorkstationName">PE-201612-AGENT</Data>
    <Data Name="TransmittedServices">-</Data>
    <Data Name="LmPackageName">-</Data>
    <Data Name="KeyLength">0</Data>
    <Data Name="ProcessId">0x538</Data>
    <Data Name="ProcessName">C:\Program Files\Puppet Labs\Puppet\sys\ruby\bin\ruby.exe</Data>
    <Data Name="IpAddress">-</Data>
    <Data Name="IpPort">-</Data>
    </EventData>
    </Event>

This can result in inadvertent user lockouts.



 Comments   
Comment by Moses Mendoza [ 2016/07/29 ]

I pushed up a branch that continues the work Ethan Brown was doing: https://github.com/MosesMendoza/puppet/tree/PUP-6843/stable/fix_logon_with_empty_passwd

Comment by Rob Reynolds [ 2016/08/01 ]

A few error codes we could explore handling some of the errors and providing better messages around how to correct. Possibly as a separate ticket though.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms681385(v=vs.85).aspx

* ERROR_LAST_ADMIN  - 1322 (0x52A) - This operation is disallowed as it could result in an administration account being disabled, deleted or unable to log on.
* ERROR_WRONG_PASSWORD - 1323 (0x52B) - Unable to update the password. The value provided as the current password is incorrect.
* ERROR_ILL_FORMED_PASSWORD - 1324 (0x52C) - Unable to update the password. The value provided for the new password contains values that are not allowed in passwords.
* ERROR_PASSWORD_RESTRICTION - 1325 (0x52D) - Unable to update the password. The value provided for the new password does not meet the length, complexity, or history requirements of the domain.
* ERROR_LOGON_FAILURE - 1326 (0x52E) - The user name or password is incorrect.
* ERROR_ACCOUNT_RESTRICTION - 1327 (0x52F) - Account restrictions are preventing this user from signing in. For example: blank passwords aren't allowed, sign-in times are limited, or a policy restriction has been enforced.
* ERROR_INVALID_LOGON_HOURS - 1328 (0x530) - Your account has time restrictions that keep you from signing in right now.
* ERROR_INVALID_WORKSTATION - 1329 (0x531) - This user isn't allowed to sign in to this computer.
* ERROR_PASSWORD_EXPIRED - 1330 (0x532) - The password for this account has expired.
* ERROR_ACCOUNT_DISABLED - 1331 (0x533) - This user can't sign in because this account is currently disabled.

Comment by Moses Mendoza [ 2016/08/01 ]

Rob Reynolds - agreed on improving the error handling to check for those codes and surface this info to the user. Per conversation, filed as https://tickets.puppetlabs.com/browse/PUP-6569

Comment by Moses Mendoza [ 2016/08/01 ]

PR opened against Ethan Brown's branch: https://github.com/Iristyle/puppet/pull/4/files

Comment by Moses Mendoza [ 2016/08/03 ]

hi Kenn Hussey - yes, that is the current plan

Comment by Rob Reynolds [ 2016/08/03 ]

Merged into stable at https://github.com/puppetlabs/puppet/commit/70426ea1effce8aaa545db911c3f340c09c25f56

Comment by Rob Reynolds [ 2016/08/03 ]

Builds kicked off for puppet at https://jenkins.puppetlabs.com/view/puppet-agent/view/stable/view/puppet/job/platform_puppet_init-van-component_stable/224/

Comment by Rob Reynolds [ 2016/08/05 ]

Verification

1. Installed the 64-bit version.
2. Cleared the contents of the security event log.
3. Created a manifest called user_nopassword.pp:

user {'bob':
  ensure => present,
}
 
user {'bill':
  ensure     => present,
  password = '123abcD',
}

4. Ran puppet apply c:\code\temp\user_nopassword.pp and observed the output:


5. Cleared the security event log.
6. Ran the manifest a second time.


7. Cleared the security event log.
8. Ran puppet resource user


9. Repeated same steps with x86 version. Output was the same.

Comment by Rob Reynolds [ 2016/08/05 ]

Verified as fixed based on the acceptance criteria.

Generated at Sun Sep 22 06:59:08 PDT 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.