Skip to content

windows server 2019 and cmd.script + runas AD user = RPC error.  #55080

Closed

Description

@whytewolf

Description of Issue

running a cmd.script with runas set to be an AD user while on windows 2019 causes the system to throw an RPC Server Unavailable error and not run the script.

If the user is a local user it works fine. if it is on an earlier version of windows server it works fine.

Maybe related at least in part to #54809 However I can not find in the cmdmod code anywhere where it connects to that function.

Setup

have windows connected to a domain and try to run any cmd.script state with runas set as a domain user.

Steps to Reproduce Issue

including some debug logs.

debug.txt

Versions Report

koba-test12:
Salt Version:
Salt: 2019.2.0

Dependency Versions:
cffi: 1.11.5
cherrypy: 17.4.1
dateutil: 2.7.5
docker-py: Not Installed
gitdb: 2.0.5
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.10
libgit2: Not Installed
libnacl: 1.6.1
M2Crypto: Not Installed
Mako: 1.0.7
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: 0.9.3
pycparser: 2.19
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
python-gnupg: 0.4.3
PyYAML: 3.13
PyZMQ: 17.1.2
RAET: Not Installed
smmap: 2.0.5
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.2.5

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

Activity

  1. added
    ZD
    on Oct 21, 2019
  2. whytewolf commented on Oct 21, 2019

    @whytewolf
    CollaboratorAuthor

    ZD-4066

  3. added this to the Approved milestone on Oct 23, 2019
  4. added
    Confirmed
    P4
    severity-medium
    on Oct 23, 2019
  5. xeacott commented on Oct 23, 2019

    @xeacott
    Contributor

    Thanks for reporting this. I skimmed the related issue and I think that is a good place to start. There may of been another recently reported Win Server 2019 issue that is also related.

  6. whytewolf commented on Dec 11, 2019

    @whytewolf
    CollaboratorAuthor

    ZD-4399

  7. whytewolf commented on Dec 11, 2019

    @whytewolf
    CollaboratorAuthor

    As we get more Windows 2019 users this is going to become a big problem.

  8. xeacott commented on Dec 20, 2019

    @xeacott
    Contributor

    While I wasn't able to reproduce the exact error message, I was unable to get a basic Powershell script to execute following the same state setup. However, what did work was the following, and I'll explain why.

    no_work:
      cmd.script:
        - name: salt:\\echo.PS1
        - shell: Powershell
        - runas: 'DOMAIN\\saltstack'
        - runas_password: ''
    
    yes_work:
      cmd.script:
        - name: salt:\\echo.PS1
        - shell: Powershell
        - runas: '[email protected]'
        - runas_password: ''
    

    Two likely reasons why the 1st state doesn't work.. 1. misconfigured netBIOS 2. misconfigured DNS
    For example, upon setting up a 2019 Server I installed AD and promoted that machine to become a DC. I setup a forest and configure the Root domain name to be 'mydomain.local'. This acts as the domain information and the default NetBIOS name of the domain becomes 'mydomain'. Now when you add a user to active directory AND under this domain, you would traditionally log in as mydomain\user. However, this style of [Domain name][User name] is pre-windows 2000 and, while it still works at the logon screen, the DNS may not resolve this as a valid name.

    In the DNS settings, under the machine name, I have a Forward Lookup Zone with a Host record of mydomain.local, which is exactly the Root domain name. The Shorthand style is called down-level logon name, or mydomain\user and the new style is called User Principle Name, or [email protected]. In the event when mydomain\user is lookup by active directory, it will search a domain for the user object while [email protected] will search the forest for the user object.

    This is where the 2 likely reasons arise. If the domain isn't resolving, it won't reach active directory. If the netBIOS isn't configured properly, it won't reach active directory. Either case will cause Powershell to exit with some error that we are returning to the user.

    This is all based on my understanding of the issue at play here and potentially what's really going on, as I followed Microsoft's procedure for setting up a 2019 sever with all the bells and whistles, ran the 2nd state, and received this back.

    local:
    ----------
              ID: test
        Function: cmd.script
            Name: salt://echo.ps1
          Result: True
         Comment: Command 'salt://echo.ps1' run
         Started: 06:33:58.829000
        Duration: 1459.0 ms
         Changes:
                  ----------
                  pid:
                      1320L
                  retcode:
                      0
                  stderr:
                  stdout:
                      Hello, World!
    Summary for local
    ------------
    Succeeded: 1 (changed=1)
    Failed:    0
    ------------
    
  9. xeacott commented on Dec 20, 2019

    @xeacott
    Contributor

    I also wanted to follow up as the specific reason for why this is occurring on Window's Server 2019 and not Window's Server 2016 I haven't yet fully understood - this could be because of different configurations by the user on the 2016/2019 boxes, or Microsoft actually did change something between these releases. In any case, I'll continue to investigate this.

  10. cburdge commented on Dec 20, 2019

    @cburdge
  11. xeacott commented on Jan 7, 2020

    @xeacott
    Contributor

    Hi @cburdge
    I thought about this some more, investigated, etc. but without knowing the complexities of your custom environment and system it may be difficult to pinpoint.

    I added documentation to Salt and while I'll close this issue, we can always reference it or re-open it in the future. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ConfirmedP4ZDseverity-medium

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions