Jira (PUP-10999) Unable to update UserRightAssignment - Log on as service rights

39 views
Skip to first unread message

Jordi Garcia (Jira)

unread,
Mar 29, 2021, 10:59:02 AM3/29/21
to puppe...@googlegroups.com
Jordi Garcia created an issue
 
Puppet / Bug PUP-10999
Unable to update UserRightAssignment - Log on as service rights
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2021/03/29 7:58 AM
Priority: Normal Normal
Reporter: Jordi Garcia

Puppet Version: 2019.8.4
Puppet Server Version:
OS Name/Version:

We are trying to add an account to the "UserRightAssignment - Log on as service rights" of a Windows agent using the DSC Modules:
dsc-securitypolicydsc
puppetlabs-pwshlib
and, at the same time, set a service with the account that just got the "log on as service rights". The manifest code used is:
class windows_towers {
dsc_userrightsassignment

{ "add-jordi-to-logon-as-service": dsc_ensure => 'present', dsc_policy => 'Log_on_as_a_service', dsc_identity => ['NT SERVICE\\ALL SERVICES','cloudbase-init','jordi'], }


service

{ 'PlexUpdateService': ensure => 'stopped', logonaccount => 'PE-201984-WIN2K\\jordi', logonpassword => 'puppetpuppet', enable => 'false', require => Dsc_userrightsassignment['add-jordi-to-logon-as-service'], }

}
 

Desired Behavior:

Update the windows service with the new credentials that just got ** "log on as service rights" - Basically, the code above should work first time round.

Actual Behavior:

 
PS C:\Users\Administrator\tester> puppet agent -t
[DEPRECATION] Struct layout is already defined for class Windows::ServiceStructs::SERVICE_STATUS_PROCESS. Redefinition as in C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/win32-service-0.8.8/lib/win32/windows/structs.rb:67:in `<class:SERVICE_STATUS_PROCESS>' will be disallowed in ffi-2.0.
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Error: Failed to apply catalog: Parameter logonaccount failed on Service[PlexUpdateService]: "PE-201984-WIN2K\jordi" is missing the 'Log On As A Service' right. (file: /etc/puppetlabs/code/environments/production/site/windows_towers/manifests/init.pp, line: 16)
The error is indicating that the account selected doesn't have "log on as service rights" but, in fact, the account has not been added to the "log on as service rights" User Rights assignment and it is failing at compilation.
Alternatively, if you comment out the service part of the code, the user gets added to the "log on as service rights" and, at this stage, the code will work as expected.
class windows_towers {
dsc_userrightsassignment

{ "add-jordi-to-logon-as-service": dsc_ensure => 'present', dsc_policy => 'Log_on_as_a_service', dsc_identity => ['NT SERVICE\\ALL SERVICES','cloudbase-init','jordi'], }

  1. service { 'PlexUpdateService': # ensure => 'stopped', # logonaccount => 'PE-201984-WIN2K\\jordi', #logonpassword => 'puppetpuppet', # enable => 'false', # require => Dsc_userrightsassignment['add-jordi-to-logon-as-service'], #}

    }
    PS C:\Users\Administrator\tester> puppet agent -t
    [DEPRECATION] Struct layout is already defined for class Windows::ServiceStructs::SERVICE_STATUS_PROCESS. Redefinition as in C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/win32-service-0.8.8/lib/win32/windows/structs.rb:67:in `<class:SERVICE_STATUS_PROCESS>' will be disallowed in ffi-2.0.
    Info: Using configured environment 'production'
    Info: Retrieving pluginfacts
    Info: Retrieving plugin
    Info: Retrieving locales
    Info: Loading facts
    Info: Caching catalog for pe-201984-win2k.platform9.puppet.net
    Info: Applying configuration version '1617025583'
    Notice: /Stage[main]/Windows_towers/Dsc_userrightsassignment[add-jordi-to-logon-as-service]/dsc_identity: dsc_identity changed ['PE-201984-WIN2K\cloudbase-init', 'NT SERVICE\ALL SERVICES'] to ['NT SERVICE\ALL SERVICES', 'cloudbase-init', 'jordi']
    Notice: dsc_userrightsassignment[\{:name=>"add-jordi-to-logon-as-service", :dsc_policy=>"Log_on_as_a_service"}]: Updating: Finished in 2.36 seconds
    Notice: Applied catalog in 3.77 seconds
    I have worked with Michael Lombardi on https://tickets.puppetlabs.com/browse/MODULES-10969 created on the back of https://puppetlabs.zendesk.com/agent/tickets/43304 that has determined that the error experienced is generated by https://github.com/puppetlabs/puppet/blob/main/lib/puppet/type/service.rb#L152 and stops catalog compilation

Michael has also suggested that the current validation be turned into a warning or placed in the provider and called during set method

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Jordi Garcia (Jira)

unread,
Mar 29, 2021, 11:04:02 AM3/29/21
to puppe...@googlegroups.com
Jordi Garcia updated an issue
Change By: Jordi Garcia
*Puppet Version: 2019.8.4*
*Puppet Server Version:*
*OS Name/Version:*


We are trying to add an account to the "UserRightAssignment - Log on as service rights" of a Windows agent using the DSC Modules:

dsc-securitypolicydsc
puppetlabs-pwshlib

and, at the same time, set a service with the account that just got the "log on as service rights". The manifest code used is:

 

class windows_towers {   
dsc_userrightsassignment

    dsc_userrightsassignmen
{ "add-jordi-to-logon-as-service":

         
    dsc_ensure     => 'present',

         
    dsc_policy => 'Log_on_as_a_service',

         
    dsc_identity   => ['NT SERVICE\\ALL SERVICES','cloudbase-init','jordi'],

   
  }



   
service { 'PlexUpdateService':

         
    ensure        => 'stopped',

         
    logonaccount  => 'PE-201984-WIN2K\\jordi',

         
    logonpassword => 'puppetpuppet',

         
    enable        => 'false',

         
    require       => Dsc_userrightsassignment['add-jordi-to-logon-as-service'],
  }

}
 

*Desired Behavior:*


Update the windows service with the new credentials that just got ** "log on as service rights" - Basically, the code above should work first time round.

*Actual Behavior:*


 
PS C:\Users\Administrator\tester> puppet agent -t
[DEPRECATION] Struct layout is already defined for class Windows::ServiceStructs::SERVICE_STATUS_PROCESS. Redefinition as in C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/win32-service-0.8.8/lib/win32/windows/structs.rb:67:in `<class:SERVICE_STATUS_PROCESS>' will be disallowed in ffi-2.0.
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Error: Failed to apply catalog: Parameter logonaccount failed on Service[PlexUpdateService]: "PE-201984-WIN2K\jordi" is missing the 'Log On As A Service' right. (file: /etc/puppetlabs/code/environments/production/site/windows_towers/manifests/init.pp, line: 16)

The error is indicating that the account selected doesn't have "log on as service rights" but, in fact, the account has not been added to the "log on as service rights" User Rights assignment and it is failing at compilation.

Alternatively, if you comment out the service part of the code, the user gets added to the "log on as service rights" and, at this stage, the code will work as expected.
class windows_towers {
  

   
dsc_userrightsassignment { "add-jordi-to-logon-as-service":

       
    dsc_ensure     => 'present',

       
    dsc_policy => 'Log_on_as_a_service',

       
    dsc_identity   => ['NT SERVICE\\ALL SERVICES','cloudbase-init','jordi'],

   
  }


   
# service { 'PlexUpdateService':

       
  #  ensure        => 'stopped',

       
   # logonaccount  => 'PE-201984-WIN2K\\jordi',

       
    #logonpassword => 'puppetpuppet',

       
#   enable        => 'false',

       
#   require => Dsc_userrightsassignment['add-jordi-to-logon-as-service'],

   
  #}

}
PS C:\Users\Administrator\tester> puppet agent -t
[DEPRECATION] Struct layout is already defined for class Windows::ServiceStructs::SERVICE_STATUS_PROCESS. Redefinition as in C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/win32-service-0.8.8/lib/win32/windows/structs.rb:67:in `<class:SERVICE_STATUS_PROCESS>' will be disallowed in ffi-2.0.
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for pe-201984-win2k.platform9.puppet.net
Info: Applying configuration version '1617025583'
Notice: /Stage[main]/Windows_towers/Dsc_userrightsassignment[add-jordi-to-logon-as-service]/dsc_identity: dsc_identity changed ['PE-201984-WIN2K\cloudbase-init', 'NT SERVICE\ALL SERVICES'] to ['NT SERVICE\ALL SERVICES', 'cloudbase-init', 'jordi']
Notice: dsc_userrightsassignment[\
\ {:name=>"add-jordi-to-logon-as-service", :dsc_policy=>"Log_on_as_a_service"}]: Updating: Finished in 2.36 seconds
Notice: Applied catalog in 3.77 seconds

I have worked with Michael Lombardi on https://tickets.puppetlabs.com/browse/MODULES-10969 created on the back of [https://puppetlabs.zendesk.com/agent/tickets/43304] that has determined that the error experienced is generated by [https://github.com/puppetlabs/puppet/blob/main/lib/puppet/type/service.rb#L152] and stops catalog compilation

Michael has also suggested that the current validation be turned into a warning or placed in the provider and called during {{set method}}

 

Jordi Garcia (Jira)

unread,
Mar 29, 2021, 11:06:02 AM3/29/21
to puppe...@googlegroups.com
Jordi Garcia updated an issue
*Puppet Version: 2019.8.4*
*Puppet Server Version:*
*OS Name/Version:*

We are trying to add an account to the "UserRightAssignment - Log on as service rights" of a Windows agent using the DSC Modules:

```

dsc-securitypolicydsc
puppetlabs-pwshlib

```

and, at the same time, set a service with the account that just got the "log on as service rights". The manifest code used is:

 

class windows_towers {
    dsc_userrightsassignmen

Notice: dsc_userrightsassignment[\\ \ {:name=>"add-jordi-to-logon-as-service", :dsc_policy=>"Log_on_as_a_service"} |file://%7B:name%3D%3E%22add-jordi-to-logon-as-service%22%2C%20:dsc_policy%3D%3E%22log_on_as_a_service%22%7D/ ]: Updating: Finished in 2.36 seconds

Notice: Applied catalog in 3.77 seconds

I have worked with Michael Lombardi on https://tickets.puppetlabs.com/browse/MODULES-10969 created on the back of [https://puppetlabs.zendesk.com/agent/tickets/43304] that has determined that the error experienced is generated by [https://github.com/puppetlabs/puppet/blob/main/lib/puppet/type/service.rb#L152] and stops catalog compilation

Michael has also suggested that the current validation be turned into a warning or placed in the provider and called during {{set method}}

 

Jordi Garcia (Jira)

unread,
Mar 29, 2021, 11:06:04 AM3/29/21
to puppe...@googlegroups.com

zendesk.jira (Jira)

unread,
Mar 29, 2021, 11:08:02 AM3/29/21
to puppe...@googlegroups.com

zendesk.jira (Jira)

unread,
Mar 29, 2021, 11:08:03 AM3/29/21
to puppe...@googlegroups.com
zendesk.jira updated an issue
Change By: zendesk.jira
Zendesk Ticket Count: 1
Zendesk Ticket IDs: 43304

Mihai Buzgau (Jira)

unread,
Mar 31, 2021, 4:47:03 AM3/31/21
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Mar 31, 2021, 4:47:04 AM3/31/21
to puppe...@googlegroups.com

Gabriel Nagy (Jira)

unread,
Mar 31, 2021, 10:33:03 AM3/31/21
to puppe...@googlegroups.com

Luchian Nemes (Jira)

unread,
Apr 12, 2021, 5:56:02 AM4/12/21
to puppe...@googlegroups.com
Luchian Nemes assigned an issue to Luchian Nemes
Change By: Luchian Nemes
Assignee: Luchian Nemes
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Mihai Buzgau (Jira)

unread,
Apr 14, 2021, 6:22:01 AM4/14/21
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: NW - 2021-04-14 , NW-2021-04-28

Mihai Buzgau (Jira)

unread,
Apr 28, 2021, 5:51:04 AM4/28/21
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: NW - 2021-04-14, NW-2021-04-28 , NW-2021-05-19

Luchian Nemes (Jira)

unread,
May 10, 2021, 4:32:03 AM5/10/21
to puppe...@googlegroups.com
Luchian Nemes updated an issue
Change By: Luchian Nemes
Release Notes: Bug Fix
Release Notes Summary: Validation and munging of `logonaccount` and `logonpassword` parameters, for the `service` resource on Windows, were previously failing too early. This fix moves them at a later time in the catalog compilation order list to avoid premature errors and to respect resource dependencies in manifests.

Gabriel Nagy (Jira)

unread,
May 19, 2021, 7:38:03 AM5/19/21
to puppe...@googlegroups.com
Gabriel Nagy updated an issue
Change By: Gabriel Nagy
Fix Version/s: PUP 7.7.0
Fix Version/s: PUP 6.23.0

Gabriel Nagy (Jira)

unread,
May 19, 2021, 7:38:04 AM5/19/21
to puppe...@googlegroups.com

Claire Cadman (Jira)

unread,
May 19, 2021, 8:54:03 AM5/19/21
to puppe...@googlegroups.com
Claire Cadman updated an issue
 
Change By: Claire Cadman
Labels: doc-reviewed jira_escalated
Reply all
Reply to author
Forward
0 new messages