saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.23k stars 5.49k forks source link

[BUG] Protocol wrong type for socket on Windows 2008 Storage #58504

Open Nemergal opened 4 years ago

Nemergal commented 4 years ago

Hi,

I am trying to connect a minion to the master, from a Windows Server 2008 Storage, i known it's a EOL product but...

Without success, with salt-minion-debug.bat I get an error:

[DEBUG   ] Reading configuration from c:\salt\conf\minion
[DEBUG   ] Multiprocessing queue logging configured for the process running unde
r PID: 13880 at log level 10
[DEBUG   ] Marking 'is_ip' as a jinja filter
[DEBUG   ] Marking 'is_ipv4' as a jinja filter
[DEBUG   ] Marking 'is_ipv6' as a jinja filter
[DEBUG   ] Marking 'ipv4' as a jinja filter
[DEBUG   ] Marking 'ipv6' as a jinja filter
[DEBUG   ] Marking 'ipaddr' as a jinja filter
[DEBUG   ] Marking 'ip_host' as a jinja filter
[DEBUG   ] Marking 'network_hosts' as a jinja filter
[DEBUG   ] Marking 'network_size' as a jinja filter
[DEBUG   ] Marking 'gen_mac' as a jinja filter
[DEBUG   ] Marking 'mac_str_to_bytes' as a jinja filter
[DEBUG   ] Marking 'dns_check' as a jinja filter
[DEBUG   ] Marking 'filter_by_networks' as a jinja filter
[DEBUG   ] Multiprocessing queue logging configured for the process running unde
r PID: 13880 at log level 10
[DEBUG   ] Configuration file path: c:\salt\conf\minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged
.
[INFO    ] Setting up the Salt Minion "salt-minion-hostname"
[DEBUG   ] Marking 'base64_encode' as a jinja filter
[DEBUG   ] Marking 'base64_decode' as a jinja filter
[DEBUG   ] Marking 'md5' as a jinja filter
[DEBUG   ] Marking 'sha1' as a jinja filter
[DEBUG   ] Marking 'sha256' as a jinja filter
[DEBUG   ] Marking 'sha512' as a jinja filter
[DEBUG   ] Marking 'hmac' as a jinja filter
[DEBUG   ] Marking 'hmac_compute' as a jinja filter
[DEBUG   ] Marking 'random_hash' as a jinja filter
[DEBUG   ] Marking 'rand_str' as a jinja filter
[DEBUG   ] Marking 'file_hashsum' as a jinja filter
[DEBUG   ] Marking 'http_query' as a jinja filter
[DEBUG   ] Marking 'strftime' as a jinja filter
[DEBUG   ] Marking 'date_format' as a jinja filter
[DEBUG   ] Marking 'raise' as a jinja global
[DEBUG   ] Marking 'match' as a jinja test
[DEBUG   ] Marking 'equalto' as a jinja test
[DEBUG   ] Marking 'skip' as a jinja filter
[DEBUG   ] Marking 'sequence' as a jinja filter
[DEBUG   ] Marking 'to_bool' as a jinja filter
[DEBUG   ] Marking 'indent' as a jinja filter
[DEBUG   ] Marking 'tojson' as a jinja filter
[DEBUG   ] Marking 'quote' as a jinja filter
[DEBUG   ] Marking 'regex_escape' as a jinja filter
[DEBUG   ] Marking 'regex_search' as a jinja filter
[DEBUG   ] Marking 'regex_match' as a jinja filter
[DEBUG   ] Marking 'regex_replace' as a jinja filter
[DEBUG   ] Marking 'uuid' as a jinja filter
[DEBUG   ] Marking 'unique' as a jinja filter
[DEBUG   ] Marking 'min' as a jinja filter
[DEBUG   ] Marking 'max' as a jinja filter
[DEBUG   ] Marking 'avg' as a jinja filter
[DEBUG   ] Marking 'union' as a jinja filter
[DEBUG   ] Marking 'intersect' as a jinja filter
[DEBUG   ] Marking 'difference' as a jinja filter
[DEBUG   ] Marking 'symmetric_difference' as a jinja filter
[DEBUG   ] Marking 'method_call' as a jinja filter
[DEBUG   ] Marking 'yaml_dquote' as a jinja filter
[DEBUG   ] Marking 'yaml_squote' as a jinja filter
[DEBUG   ] Marking 'yaml_encode' as a jinja filter
[DEBUG   ] Created pidfile: c:\salt\var\run\salt-minion.pid
[INFO    ] Starting up the Salt Minion
[DEBUG   ] AsyncEventPublisher PUB socket URI: 4510
[DEBUG   ] AsyncEventPublisher PULL socket URI: 4511
[INFO    ] Starting pull socket on 4511
[DEBUG   ] SaltEvent PUB socket URI: 4510
[DEBUG   ] SaltEvent PULL socket URI: 4511
[DEBUG   ] Grains refresh requested. Refreshing grains.
[DEBUG   ] Reading configuration from c:\salt\conf\minion
[DEBUG   ] Failed to read /proc/cmdline: [Errno 2] No such file or directory: '/
proc/cmdline'
[INFO    ] Creating minion process manager
[DEBUG   ] Process Manager starting!
[DEBUG   ] Process Manager starting!
[DEBUG   ] Connecting to master. Attempt 1 (infinite attempts)
[DEBUG   ] "master-hostname" Not an IP address? Assuming it is a ho
stname.
[DEBUG   ] Master URI: tcp://master-ip:4506
[DEBUG   ] Popen(['git', 'version'], cwd=C:\salt, universal_newlines=False, shel
l=None)
[DEBUG   ] Initializing new AsyncAuth for ('c:\\salt\\conf\\pki\\minion', 'host
name', 'tcp://ip:4506')
Assertion failed: Protocol wrong type for socket [10041] (bundled\zeromq\src\ip.
cpp:417)

Setup My config is simple, no changes on salt-master (only listening interface) and only master and hostname on the minion side.

Steps to Reproduce the behavior Run salt-minion on a Windows 2008 storage.

Expected behavior Minion connecting to master like WS 2008 R2 and earlier

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) MINION: ``` C:\salt>salt-minion.bat --versions-report Salt Version: Salt: 3001.1 Dependency Versions: cffi: 1.12.2 cherrypy: 17.4.1 dateutil: 2.8.0 docker-py: Not Installed gitdb: 2.0.5 gitpython: Not Installed Jinja2: 2.10.1 libgit2: Not Installed M2Crypto: Not Installed Mako: 1.0.7 msgpack-pure: Not Installed msgpack-python: 1.0.0 mysql-python: Not Installed pycparser: 2.19 pycrypto: Not Installed pycryptodome: 3.9.7 pygit2: Not Installed Python: 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.19 16 64 bit (AMD64)] python-gnupg: 0.4.4 PyYAML: 5.3.1 PyZMQ: 18.0.1 smmap: 2.0.5 timelib: 0.2.4 Tornado: 4.5.3 ZMQ: 4.3.1 System Versions: dist: locale: cp1252 machine: AMD64 release: 2008Server system: Windows version: 2008Server 6.0.6003 SP2 ``` MASTER: ``` [root@salt]# salt --versions-report Salt Version: Salt: 3001.1 Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: 2.6.1 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 2.10.1 libgit2: Not Installed M2Crypto: 0.35.2 Mako: Not Installed msgpack-pure: Not Installed msgpack-python: 0.6.2 mysql-python: Not Installed pycparser: Not Installed pycrypto: Not Installed pycryptodome: Not Installed pygit2: Not Installed Python: 3.6.8 (default, Apr 16 2020, 01:36:27) python-gnupg: Not Installed PyYAML: 3.12 PyZMQ: 19.0.0 smmap: Not Installed timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.3.2 System Versions: dist: centos 8 Core locale: UTF-8 machine: x86_64 release: 4.18.0-193.el8.x86_64 system: Linux version: CentOS Linux 8 Core ```
welcome[bot] commented 4 years ago

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at core@saltstack.com or reach out directly to the Community Manager, Cassandra Faris via Slack. We’re glad you’ve joined our community and look forward to doing awesome things with you!

twangboy commented 4 years ago

Could it be a firewall or antivirus issue?

Nemergal commented 4 years ago

Could it be a firewall or antivirus issue?

Think not: test with disabled, same with firewall, ni changes. It seems the minion can't initialize connection process. Maybe because cipher?

xeacott commented 4 years ago

Are you able to ping the IPs themselves or tried netstat on them?

Nemergal commented 4 years ago

Are you able to ping the IPs themselves or tried netstat on them?

Yes, ping are fine, DNS resolution too. It append only on WS 2008 (non-R2) and WS 2003.

After few searches, error 10041 append in ip.cpp at line 417 from ZMQ Python Library:

//  Create listening socket.
SOCKET listener;
listener = zmq::open_socket (AF_INET, SOCK_STREAM, 0);
wsa_assert (listener != INVALID_SOCKET);
//  Set SO_REUSEADDR and TCP_NODELAY on listening socket.
BOOL so_reuseaddr = 1;
int rc = setsockopt (listener, SOL_SOCKET, SO_REUSEADDR,
                     reinterpret_cast<char *> (&so_reuseaddr),
                     sizeof so_reuseaddr);
wsa_assert (rc != SOCKET_ERROR);

And error 10041 are from Windows Error Socket Code:

WSAEPROTOTYPE10041 | Protocol wrong type for socket.A protocol was specified in the socket function call that does not support the semantics of the socket type requested. For example, the ARPA Internet UDP protocol cannot be specified with a socket type of SOCK_STREAM.

Maybe an update on WS 2008? But OS are up-to-date...

xeacott commented 4 years ago

That's difficult here, because we don't support WS 2008 or 2003 officially nor do we have any tests that would otherwise indicate we do have socket support for older machines that are expecting protocols like that. I personally don't know the internals of the socket implementation as I'm not ZMQ expert, and unfortunately googling brought me no where.

Unless there are other settings inside WS2008/WS2003 that you change settings. I booted up a 2008 and was seeing very similar results...

Nemergal commented 4 years ago

Hi! Yes I understand for WS 2008 and 2003 support (I hope myself this servers will be removed soon but for now...).

For info I've found a solution : salt minion Py2 x64 3000.3. No problem here. There is a risk? Because my server is 3001.1.

xeacott commented 4 years ago

Interesting, will understand those differences between Py2/Py3 for your current issue however I still believe it shouldn't matter. I will ask because we have migrated to Py3 officially, so maybe there is a small change that still needs to go in. 3000.3 is latest neon release, and 3001.1 is latest sodium so should be good. 👍

https://docs.saltstack.com/en/latest/topics/releases/index.html