Skip to content

Commit 9fc6f14

Browse files
authored
Explicitly listen only on localhost / 127.0.0.1 when launching the server (#880)
- In `direct` launch mode, listen only on `localhost` - In `docker_compose` launch mode, limit connections to coming from `127.0.0.1` by limiting the source IP in the `ports` mapping
1 parent 95c0bea commit 9fc6f14

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

docker-compose/docker-compose-benchmark.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ services:
1414
environment:
1515
- ANSYSLMD_LICENSE_FILE=${ANSYSLMD_LICENSE_FILE}
1616
ports:
17-
- "${PORT_ACP:-50555}:50051"
17+
- "127.0.0.1:${PORT_ACP:-50555}:50051"
1818
working_dir: /home/container/workdir
1919
volumes:
2020
- "acp_data:/home/container/workdir/"
@@ -25,7 +25,7 @@ services:
2525
restart: unless-stopped
2626
image: ${IMAGE_NAME_FILETRANSFER:-ghcr.io/ansys/tools-filetransfer:latest}
2727
ports:
28-
- "${PORT_FILETRANSFER:-50556}:50000"
28+
- "127.0.0.1:${PORT_FILETRANSFER:-50556}:50000"
2929
working_dir: /home/container/workdir
3030
volumes:
3131
- "acp_data:/home/container/workdir/"

docker-compose/docker-compose-extras.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ services:
88
command: ${MAPDL_CMD:--smp -np 1}
99
shm_size: '4gb'
1010
ports:
11-
- "${PYMAPDL_PORT:-50557}:50052"
11+
- "127.0.0.1:${PYMAPDL_PORT:-50557}:50052"
1212
environment:
1313
- ANSYSLMD_LICENSE_FILE=${ANSYSLMD_LICENSE_FILE}
1414
- ANSYS_LOCK="OFF"
1515
pydpf-composites-server:
1616
restart: unless-stopped
1717
image: ${IMAGE_NAME_DPF_COMPOSITES:-ghcr.io/ansys/pydpf-composites:latest}
1818
ports:
19-
- "${PYDPF_COMPOSITES_DOCKER_CONTAINER_PORT:-50558}:50052"
19+
- "127.0.0.1:${PYDPF_COMPOSITES_DOCKER_CONTAINER_PORT:-50558}:50052"
2020
environment:
2121
- ANSYSLMD_LICENSE_FILE=${ANSYSLMD_LICENSE_FILE}
2222
- ANSYS_DPF_ACCEPT_LA=${ANSYS_DPF_ACCEPT_LA}

src/ansys/acp/core/_server/direct.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def start(self) -> None:
9898
self._process = subprocess.Popen( # nosec B603: documented in 'security_considerations.rst'
9999
[
100100
self._config.binary_path,
101-
f"--server-address=0.0.0.0:{port}",
101+
f"--server-address=localhost:{port}",
102102
],
103103
stdout=self._stdout,
104104
stderr=self._stderr,

src/ansys/acp/core/_server/docker-compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
environment:
66
- ANSYSLMD_LICENSE_FILE=${ANSYSLMD_LICENSE_FILE}
77
ports:
8-
- "${PORT_ACP:-50555}:50051"
8+
- "127.0.0.1:${PORT_ACP:-50555}:50051"
99
working_dir: /home/container/workdir
1010
volumes:
1111
- "acp_data:/home/container/workdir/"
@@ -14,7 +14,7 @@ services:
1414
restart: unless-stopped
1515
image: ${IMAGE_NAME_FILETRANSFER:-ghcr.io/ansys/tools-filetransfer:latest}
1616
ports:
17-
- "${PORT_FILETRANSFER:-50556}:50000"
17+
- "127.0.0.1:${PORT_FILETRANSFER:-50556}:50000"
1818
working_dir: /home/container/workdir
1919
volumes:
2020
- "acp_data:/home/container/workdir/"

0 commit comments

Comments
 (0)