Skip to content

Commit

Permalink
Expose SMB port in Docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
sjanusz-r7 committed Apr 8, 2024
1 parent 2f604a8 commit 1286b29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/smb_acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions test/smb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ FROM ubuntu:22.04 AS build
MAINTAINER metasploit-framework <https://github.com/rapid7/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"]
Expand Down

0 comments on commit 1286b29

Please sign in to comment.