From 1286b29105366176231e0d21be154a3126411d81 Mon Sep 17 00:00:00 2001 From: sjanusz-r7 Date: Mon, 8 Apr 2024 13:21:00 +0100 Subject: [PATCH] Expose SMB port in Docker container --- .github/workflows/smb_acceptance.yml | 10 ++++++---- test/smb/Dockerfile | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/smb_acceptance.yml b/.github/workflows/smb_acceptance.yml index 6f7765d1aecb..ea43e79884a0 100644 --- a/.github/workflows/smb_acceptance.yml +++ b/.github/workflows/smb_acceptance.yml @@ -48,12 +48,14 @@ jobs: services: smb: image: ${{ matrix.docker_image }} - ports: ["445:445"] + ports: + - 445:445 + - 139:139 env: SMB_USERNAME: acceptance_tests_user SMB_PASSWORD: acceptance_tests_password options: >- - --health-cmd smbclient -U 'acceptance_tests_user%acceptance_tests_password' -L 127.0.0.1 -p 2048 + --health-cmd smbclient -U 'acceptance_tests_user%acceptance_tests_password' -L 127.0.0.1 --health-interval 10s --health-timeout 5s --health-retries 5 @@ -117,8 +119,8 @@ jobs: # Note: rspec retry is intentionally not used, as it can cause issues with allure's reporting # Additionally - flakey tests should be fixed or marked as flakey instead of silently retried run: | - docker run -d --rm --publish 127.0.0.1:2048:445 --publish 127.0.0.1:2024:139 smb-samba:v1 --name smb-acceptance - smbclient -U 'acceptance_tests_user%acceptance_tests_password' -L 127.0.0.1 -p 2048 + docker run -d --rm --publish 445:445 --publish 139:139 smb-samba:v1 --name smb-acceptance + smbclient -U 'acceptance_tests_user%acceptance_tests_password' -L smb-acceptance bundle exec rspec spec/acceptance/smb_spec.rb - name: Kill Docker Container diff --git a/test/smb/Dockerfile b/test/smb/Dockerfile index ceb513de6b09..6645b21abec5 100644 --- a/test/smb/Dockerfile +++ b/test/smb/Dockerfile @@ -3,6 +3,8 @@ FROM ubuntu:22.04 AS build MAINTAINER metasploit-framework WORKDIR /opt +EXPOSE 445 139 + # Switch shells to support ANSI-C quoting: # https://stackoverflow.com/questions/33439230/how-to-write-commands-with-multiple-lines-in-dockerfile-while-preserving-the-new SHELL ["/bin/bash", "-c"]