salt icon indicating copy to clipboard operation
salt copied to clipboard

[BUG] lgpo.set no longer working after upgrade to 3005.3

Open evenyougreg opened this issue 3 years ago • 7 comments

Description The following lgpo.set no longer work after upgrading from 3003.4 to 3005.3.

lgpo_allow_telemetry:
  lgpo.set:
    - computer_policy:
        "Allow Telemetry":
          "AllowTelemetry": '0 - Security [Enterprise Only]'
{% set KERBEROS_ENCRYPTION_TYPES = ['AES128_HMAC_SHA1', 'AES256_HMAC_SHA1', 'Future encryption types'] %}

lgpo_config_encryption_kerb:
  lgpo.set:
    - computer_policy:
        "Network security: Configure encryption types allowed for Kerberos": {{ KERBEROS_ENCRYPTION_TYPES|tojson }}
lgpo_named_pipes_anon:
  lgpo.set:
    - computer_policy:
        "Network access: Named Pipes that can be accessed anonymously": ''
lgpo_shares_accessed_anon:
  lgpo.set:
    - computer_policy:
        "Network access: Shares that can be accessed anonymously": ''

Setup (Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

Each lgpo state lives in its own sls file, and is the only thing being run in each file.

Salt Master is on 3005.3 running on a RHEL, and the Minion is a 3005.3 classic, not onedir, running on Windows Server 2019. These 4 states were working for a long time before the upgrade from 3003.4. Debug on the minion gives no information regarding any python errors or anything meaningful.

Please be as specific as possible and give set-up details.

  • [ ] on-prem machine
  • [ ] VM (Virtualbox, KVM, etc. please specify)
  • [ ] VM running on a cloud service, please be explicit and add details
  • [ ] container (Kubernetes, Docker, containerd, etc. please specify)
  • [ ] or a combination, please be explicit
  • [ ] jails if it is FreeBSD
  • [ ] classic packaging
  • [ ] onedir packaging
  • [ ] used bootstrap to install

Steps to Reproduce the behavior (Include debug logs if possible and relevant)

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

image

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

Salt Version: Salt: 3005.3

Dependency Versions: cffi: 1.14.0 cherrypy: unknown dateutil: Not Installed docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 2.11.1 libgit2: 0.28.1 M2Crypto: 0.35.2 Mako: Not Installed msgpack: 0.6.2 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: 2.20 pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: 0.28.0 Python: 3.6.8 (default, May 30 2023, 08:41:09) python-gnupg: Not Installed PyYAML: 3.13 PyZMQ: 20.0.0 smmap: Not Installed timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.1.4

System Versions: dist: rhel 7.9 Maipo locale: UTF-8 machine: x86_64 release: 3.10.0-1160.99.1.el7.x86_64 system: Linux version: Red Hat Enterprise Linux Server 7.9 Maipo

PASTE HERE

Additional context Add any other context about the problem here.

evenyougreg avatar Oct 31 '23 18:10 evenyougreg

Please paste the version output for the minion, not the master.

Do you see the same behavior on 3006.4? I'll see if I can reproduce.

twangboy avatar Oct 31 '23 23:10 twangboy

Bug persisted on both original, and latest version.

Current:

Salt Version: Salt: 3005.3

Dependency Versions: cffi: 1.14.6 cherrypy: 18.6.1 dateutil: 2.8.1 docker-py: Not Installed gitdb: 4.0.7 gitpython: Not Installed Jinja2: 3.1.0 libgit2: Not Installed M2Crypto: Not Installed Mako: 1.1.4 msgpack: 1.0.2 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: 2.21 pycrypto: Not Installed pycryptodome: 3.10.1 pygit2: Not Installed Python: 3.8.18 (tags/v3.8.18:a56dcae, Sep 14 2023, 10:22:13) [MSC v.1929 64 bit (AMD64)] python-gnupg: 0.4.8 PyYAML: 6.0.1 PyZMQ: 22.0.3 smmap: 4.0.0 timelib: 0.2.4 Tornado: 4.5.3 ZMQ: 4.3.4

System Versions: dist: locale: cp1252 machine: AMD64 release: 2019Server system: Windows version: 2019Server 10.0.17763 SP0 Multiprocessor Free

Latest:

Salt Version: Salt: 3006.4

Python Version: Python: 3.10.13 (heads/main:399dd32, Oct 4 2023, 22:01:09) [MSC v.1935 64 bit (AMD64)]

Dependency Versions: cffi: 1.14.6 cherrypy: 18.6.1 dateutil: 2.8.1 docker-py: Not Installed gitdb: 4.0.7 gitpython: Not Installed Jinja2: 3.1.2 libgit2: Not Installed looseversion: 1.0.2 M2Crypto: Not Installed Mako: Not Installed msgpack: 1.0.2 msgpack-pure: Not Installed mysql-python: Not Installed packaging: 22.0 pycparser: 2.21 pycrypto: Not Installed pycryptodome: 3.10.1 pygit2: Not Installed python-gnupg: 0.4.8 PyYAML: 6.0.1 PyZMQ: 25.0.2 relenv: 0.13.12 smmap: 4.0.0 timelib: 0.2.4 Tornado: 4.5.3 ZMQ: 4.3.4

System Versions: dist: locale: cp1252 machine: AMD64 release: 2019Server system: Windows version: 2019Server 10.0.17763 SP0 Multiprocessor Free

evenyougreg avatar Nov 01 '23 17:11 evenyougreg

Also I just noticed that the states work on the first initial run, but then if I run it another time it fails.

Initial run setting it for the first time...

image

Second run:

image

evenyougreg avatar Nov 01 '23 18:11 evenyougreg

The problem is that the policy definition has the last setting as Future Encryption Types. The value as displayed in the Group Policy Editor is Future encryption types, which is what you have in your state file. If you change the last one to Future Encryption Types, then that policy will work.

Windows doesn't care about case when setting things, but python does when comparing things.

Is that the only state that fails? Or do the other 3 fail also?

twangboy avatar Nov 02 '23 23:11 twangboy

It looks like the value you want for Named Pipes is [""] instead of "" Same thing for Shares

twangboy avatar Nov 02 '23 23:11 twangboy

Your fixes fixed them!! Only one left was telemetry, and somehow someway I've been surviving with no space between Allow and Telemetry until I upgraded, never had an issue. I dropped a space in and it works again.

lgpo_allow_telemetry:
  lgpo.set:
    - computer_policy:
        "Allow Telemetry":
          "AllowTelemetry": '0 - Security [Enterprise Only]'

As always, Thank you @twangboy for your help!!

evenyougreg avatar Nov 03 '23 02:11 evenyougreg

No problem. The LGPO stuff is tricky. Glad it's all working now. I will go ahead and close this issue.

twangboy avatar Nov 03 '23 13:11 twangboy