vmware / powerclicore

PowerCLI Core Dockerfile
Apache License 2.0
100 stars 47 forks source link

Test-Connection times out as non-root user #68

Closed JesseDarr closed 1 year ago

JesseDarr commented 1 year ago

Describe the bug

Test-Connection works as expected as the root user.

If you install the required packages, create a new user, and add that user to sudoers Test-Connection will timeout. This happens using both DNS and IP addresses.

I can confirm sudoers is setup and working correctly b/c I can use native executables like ping and whoami from powershell as the new user.

Reproduction steps

  1. tdnf -y install shadow
  2. tdnf -y install sudo
  3. tdnf -y install vim
  4. useradd -m -G sudo concord
  5. usermod -a -G sudo concord
  6. visudo a. %sudo ALL=(ALL) NOPASSWD: ALL

Expected behavior:

PS /root> whoami root PS /root> Test-Connection google.com

Destination: google.com

Ping Source Address Latency BufferSize Status (ms) (B)

---- ------ ------- ------- ---------- ------

1 f3489e2090ef 142.251.40.78 30 32 Success 2 f3489e2090ef 142.251.40.78 37 32 Success 3 f3489e2090ef 142.251.40.78 31 32 Success 4 f3489e2090ef 142.251.40.78 35 32 Success

Observed Behavior:

PS /usr/bin> whoami concord PS /usr/bin> Test-Connection google.com

Destination: google.com

Ping Source Address Latency BufferSize Status (ms) (B)

---- ------ ------- ------- ---------- ------

1 f3489e2090ef TimedOut 2 f3489e2090ef TimedOut 3 f3489e2090ef TimedOut 4 f3489e2090ef TimedOut

Additional context

All other commands from the powershell module Microsoft.Powershell.Management work without issue as the non-root user.

Building a new container from CentOS or Ubuntu base images, installing powershell and powercli, result in the non-root user being able to use Test-Connection as expected.

tenthirtyam commented 1 year ago

It's because the base image is missing iputils.

Likely addressed in https://github.com/vmware/powerclicore/pull/67 with the switch tomcr.microsoft.com/powershell.

cc @nklinkachevAtVMware

Ryan

JesseDarr commented 1 year ago

Sorry it took me so long to respond. I can confirm Test-Connection works as expected with this build. Can't wait for it to get approved.

Thank you!

tenthirtyam commented 1 year ago

Good to hear. I know @nklinkachevAtVMware was reviewing my PR last week.