Windows Firewall inbound rules and environment PAT

2019-09-11 04:17发布

问题:

Consider the following scenario:

Jenkins running with a master on machine A and a slave on machine B. Rather than the master's XML config referring to a hard coded Java path it was changed to reference 'java', in the environment PATH variable. This works fine for the master running on machine A, however the slave on machine B is no longer able to connect to the master host PC.

The (Windows) firewall rules for inbound traffic on machine A allow inbound communication on any protocol and port connections to 'C:\Program Files\Java\jre7\bin\java.exe', so the Jenkins service should work but it isn't. The only way I can make the connection work is by disabling the firewall.

回答1:

Despite setting the inbound firewall rule to allow any connections to 'java', hoping it would pick up the environment PATH value, I still couldn't get the connection working.

In the end changing the jenkins.xml file to not use the 'java' PATH variable and instead use 'C:\Program Files\Java\jre7\bin\java.exe' and setting the inbound firewall rule back to match this worked.

Interesting that Windows saw the PATH variable and the literal file path so differently that it didn't satisfy the firewall rule (perhaps it's by design and a security feature?).