SystemRage / py-kms

KMS Server Emulator written in Python
The Unlicense
2.04k stars 618 forks source link

Unable to listen on IPv4 address - Address family for hostname not supported. Exiting... #79

Closed victorhooi closed 3 years ago

victorhooi commented 3 years ago

I recently updated py-kms from the Git repo- and it seems to have broken things:

When I try to run it now, I get the following error message:

$ python3 py-kms/pykms_Server.py 0.0.0.0 1688 -s
Connection failed '0.0.0.0:1688': [Errno -9] Address family for hostname not supported. Exiting...

Is this possibly related to the recent IPv6 changes?

Also - I did try substituting in :: - the script runs then - but the Windows client isn't able to connect:

Error: 0xc004F074 The Software Licensing Service reported that the computer could not be activated. No Key Management Service (KMS) could be contacted. Please see the Application Event Log for additional information.

Possibly because we're trying to connect to the IPv4 address?

simonmicro commented 3 years ago

Args. Before opening an issue please take a look into the older ones: See #78, #74 and their fix #76.

If you are using Linux as pykms-host the change should not affect whether you connect by ipv4 or by ipv6. The Linux Kernel translates the ipv4 calls automatically to ipv6 when you are listening to ::. Make sure your firewall does not interfere with it!

Additionally I tested this with my Windows 10 Tablet (using the ipv4) and it worked - even when I was "just" listening to the ipv6 stack with ::. If the problem persists - try using the docker container (after #76 has been approved) and open a new issue containing the logs.

simonmicro commented 3 years ago

Please see the Application Event Log for additional information.

Also maybe that logs could help..,

simonmicro commented 3 years ago

@victorhooi Hey, is this still relevant? Otherwise please close this issue.

nomandera commented 3 years ago

The docker at least appears to be broken testing here. My suspicion is the recent changes assume all hosts have IPv6 and break when they do not.

simonmicro commented 3 years ago

@anoma Which host OS/Kernel do you use? Linux should map the problematic IPs back to IPv6 - so it should work regardless of IPv6 support on the client side. Did you made sure to listen to the :: address instead of the IPv4 wildcard 0.0.0.0?

nomandera commented 3 years ago

... Did you made sure to listen to the :: address instead of the IPv4 wildcard 0.0.0.0?

No I did not and that has fixed the issue. I had read the previous comment about :: but in my head I didn't translate this to a even if you dont run IPv6 make this change.

For ease I tested this on unRAID since it tends to show weird edge cases it being more like an appliance.

Thanks for the clarification.

simonmicro commented 3 years ago

@anoma Yay - I am happy to hear this! I hope everything works now as expected? If yes, please consider closing this issue.

but in my head I didn't translate this to a even if you dont run IPv6 make this change

I'll add a sentence to the README until the new wiki can explain this properly. Thank you for your patience!