Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Windows: ps.psaux requires a "ps" command to work #65252

Open
2 of 9 tasks
dafyddj opened this issue Sep 21, 2023 · 1 comment
Open
2 of 9 tasks

[BUG] Windows: ps.psaux requires a "ps" command to work #65252

dafyddj opened this issue Sep 21, 2023 · 1 comment
Assignees
Labels
Bug broken, incorrect, or confusing behavior Execution-Module Windows
Milestone

Comments

@dafyddj
Copy link
Contributor

dafyddj commented Sep 21, 2023

Description
The execution function ps.psaux requires the ps command to work which is non-standard on Windows

Setup

Standard Windows install using .exe installer

  • 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

PS C:\Users\User> salt-call ps.psaux Python
Error running 'ps.psaux': Unable to run command 'ps aux'
with the context '{'cwd': 'C:\\Users\\User', 'shell': False,
'env': {'ALLUSERSPROFILE': 'C:\\ProgramData', 'APPDATA':
'C:\\Users\\User\\AppData\\Roaming', 'CommonProgramFiles':
'C:\\Program Files\\Common Files',
'CommonProgramFiles(Arm)': 'C:\\Program Files (Arm)\\Common
Files', 'CommonProgramFiles(x86)': 'C:\\Program Files
(x86)\\Common Files', 'CommonProgramW6432': 'C:\\Program
Files\\Common Files', 'COMPUTERNAME': 'WINDOWS-K3E3JQ8',
'ComSpec': 'C:\\Windows\\system32\\cmd.exe', 'DriverData':
'C:\\Windows\\System32\\Drivers\\DriverData', 'EFC_5008':
'0', 'FPS_BROWSER_APP_PROFILE_STRING': 'Internet Explorer',
'FPS_BROWSER_USER_PROFILE_STRING': 'Default', 'HOMEDRIVE':
'C:', 'HOMEPATH': '\\Users\\User', 'LOCALAPPDATA':
'C:\\Users\\User\\AppData\\Local', 'LOGONSERVER':
'\\\\WINDOWS-K3E3JQ8', 'NUMBER_OF_PROCESSORS': '2',
'OneDrive': 'C:\\Users\\User\\OneDrive', 'OS': 'Windows_NT',
'Path':
'C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program
Files\\Salt
Project\\Salt;C:\\Users\\User\\AppData\\Local\\Microsoft\\WindowsApps;',
'PATHEXT':
'.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL',
'PROCESSOR_ARCHITECTURE': 'AMD64', 'PROCESSOR_IDENTIFIER':
'ARMv8 (64-bit) Family 8 Model 0 Revision   0, QEMU',
'PROCESSOR_LEVEL': '0', 'PROCESSOR_REVISION': '0000',
'ProgramData': 'C:\\ProgramData', 'ProgramFiles':
'C:\\Program Files', 'ProgramFiles(Arm)': 'C:\\Program Files
(Arm)', 'ProgramFiles(x86)': 'C:\\Program Files (x86)',
'ProgramW6432': 'C:\\Program Files', 'PSModulePath':
'C:\\Users\\User\\Documents\\WindowsPowerShell\\Modules;C:\\Program
Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules',
'PUBLIC': 'C:\\Users\\Public', 'SESSIONNAME': 'Console',
'SystemDrive': 'C:', 'SystemRoot': 'C:\\Windows', 'TEMP':
'C:\\Users\\User\\AppData\\Local\\Temp', 'TMP':
'C:\\Users\\User\\AppData\\Local\\Temp', 'USERDOMAIN':
'WINDOWS-K3E3JQ8', 'USERDOMAIN_ROAMINGPROFILE':
'WINDOWS-K3E3JQ8', 'USERNAME': 'User', 'USERPROFILE':
'C:\\Users\\User', 'windir': 'C:\\Windows'}, 'stdin': None,
'stdout': -1, 'stderr': -2, 'with_communicate': True,
'timeout': None, 'bg': False}', reason: [WinError 2] The
system cannot find the file specified

Expected behavior

Either for the function to work as expected, or the documentation to make clear that it doesn't work on Windows.

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

Versions Report

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

Python Version:
        Python: 3.10.13 (heads/main:7ee24e6, Sep  6 2023, 02:19:49) [MSC v.1936 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.10
         smmap: 4.0.0
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist:
        locale: cp1252
       machine: AMD64
       release: 10
        system: Windows
       version: 10 10.0.22621 SP0 Multiprocessor Free

Additional context
Add any other context about the problem here.

@dafyddj dafyddj added Bug broken, incorrect, or confusing behavior needs-triage labels Sep 21, 2023
@twangboy twangboy self-assigned this Sep 21, 2023
@twangboy twangboy added this to the Argon v3008 milestone Sep 21, 2023
@twangboy
Copy link
Contributor

twangboy commented Sep 21, 2023

We need to look at using psutil to emulate ps aux behavior so that it is platform agnostic. If that's not possible, then use the Get-Process commandlet in PowerShell

@OrangeDog OrangeDog removed v3000.8 vulnerable version needs-triage labels Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Execution-Module Windows
Projects
None yet
Development

No branches or pull requests

3 participants