Skip to content

Commit

Permalink
only accept connections from localhost (#98)
Browse files Browse the repository at this point in the history
(cherry picked from commit 79e9d97)
  • Loading branch information
mariofusco committed Jan 15, 2024
1 parent 79d9107 commit fd189a8
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package org.drools.ansible.rulebook.integration.api.io;

import org.drools.ansible.rulebook.integration.api.rulesengine.AsyncExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.StandardSocketOptions;
import java.nio.charset.StandardCharsets;

import org.drools.ansible.rulebook.integration.api.rulesengine.AsyncExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.drools.ansible.rulebook.integration.api.io.JsonMapper.toJson;

public class RuleExecutorChannel {
Expand All @@ -25,7 +26,8 @@ public class RuleExecutorChannel {

public RuleExecutorChannel() {
try {
socketChannel = new ServerSocket(0); // 0 means kernel will choose a free port
InetAddress bindAddr = InetAddress.getByName("127.0.0.1");
socketChannel = new ServerSocket(0, 50, bindAddr); // 0 means kernel will choose a free port
socketChannel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
} catch (IOException e) {
throw new RuntimeException(e);
Expand Down

0 comments on commit fd189a8

Please sign in to comment.