[BUG] proxy.managed state do not configure Windows environment properly
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
When applying a proxy configuration on Windows with proxy.managed state module. The proxy configuration and registry keys are properly set, but the computer environment configuration is set with the previous parameter.
It seems the netsh (https://github.com/saltstack/salt/blob/master/salt/modules/proxy.py#L142) command applies before registry keys are set with the new values.
Setup
-
a Windows 2019 server
-
proxy.sls
proxy_win_configuration:
proxy.managed:
- name: 'proxy.domain'
- port: '3128'
- bypass_domains:
- '*.local.domain'
Steps to Reproduce the behavior
Before
PS C:\> netsh winhttp show proxy
Current WinHTTP proxy settings:
Direct access (no proxy server).
Apply the sls. salt-call.bat state.apply proxy
local:
Name: proxy.domain - Function: proxy.managed - Result: Clean Started: - 11:41:57.324156 Duration: 93.751 ms
Summary for local
------------
Succeeded: 1
Failed: 0
------------
Total states run: 1
Total run time: 93.751 ms
After
PS C:\> netsh winhttp show proxy
Current WinHTTP proxy settings:
Direct access (no proxy server).
If you manually change the proxy configuration in "Internet Options" settings with test.

And re-apply the code salt-call.bat state.apply proxy
you will have :
PS C:\> netsh winhttp show proxy
Current WinHTTP proxy settings:
Proxy Server(s) : test:3128
Bypass List : *.local.domain;<local>
which is the previous configuration.
Expected behavior
PS C:\> netsh winhttp show proxy
Current WinHTTP proxy settings:
Proxy Server(s) : proxy.domain:3128
Bypass List : *.local.domain;<local>
Versions Report
Salt Version:
Salt: 3003.4
Dependency Versions:
cffi: 1.14.5
cherrypy: 18.6.0
dateutil: 2.8.1
docker-py: Not Installed
gitdb: 4.0.5
gitpython: Not Installed
Jinja2: 2.11.3
libgit2: Not Installed
M2Crypto: Not Installed
Mako: 1.1.4
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.20
pycrypto: Not Installed
pycryptodome: 3.9.8
pygit2: Not Installed
Python: 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
python-gnupg: 0.4.6
PyYAML: 5.4.1
PyZMQ: 18.0.1
smmap: 3.0.4
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.1
System Versions:
dist:
locale: cp1252
machine: AMD64
release: 2019Server
system: Windows
version: 2019Server 10.0.17763 SP0
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue points to salt/modules/proxy.py at line 142 and the proxy.managed state. Start by reproducing the Windows 2019 case with the provided proxy.sls and compare the registry values with netsh winhttp show proxy before and after applying the state. Done means the command reports proxy.domain:3128 and the expected bypass list on the first apply.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, infrastructure, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100