Skip to content

Commit

Permalink
Fix: Docker: aarch64: missing libz.so and libpcap.so.0.8
Browse files Browse the repository at this point in the history
Using patchelf to patch the binary for debian stable from libpcap.so.1
to libpcap.so.0.8.

Add zlib1g-dev to apt install in prod.Dockerfile so that the libz.so is
available on the aarch64 platform.

Lastly, I wanted to mention how much I appreciate NixOS for patchelf.
  • Loading branch information
nichtsfrei committed May 5, 2023
1 parent 388de3a commit cd1b40a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
1 change: 1 addition & 0 deletions .docker/prod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ RUN apt-get update && apt-get install --no-install-recommends --no-install-sugge
libroken18-heimdal \
libhdb9-heimdal \
libpopt0 \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
COPY .docker/openvas.conf /etc/openvas/
# must be pre built within the rust dir and moved to the bin dir
Expand Down
13 changes: 3 additions & 10 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,15 @@ jobs:
steps:
# install rustup
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
rust/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: sudo apt update && sudo apt-get install -y libpcap-dev libssl-dev
- run: rustup update stable && rustup default stable
# This command will attempt to install 'cross', but if it's already
# installed due to caching, it will do nothing and proceed without error.
- run: cargo install cross || true
- run: CROSS_CONFIG=Cross.toml cross -v build --release --target aarch64-unknown-linux-gnu
- run: CROSS_CONFIG=Cross.toml cross build --release --target x86_64-unknown-linux-gnu
- name: "patch for debian stable"
run: |
patchelf --replace-needed libpcap.so.1 libpcap.so.0.8 target/aarch64-unknown-linux-gnu/release/nasl-cli
- name: archive nasl-cli aarch64-unknown-linux-gnu
uses: actions/upload-artifact@v3
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ jobs:
working-directory: rust
- run: CROSS_CONFIG=Cross.toml cross build --release --target x86_64-unknown-linux-gnu
working-directory: rust
- name: "patch for debian stable"
run: |
patchelf --replace-needed libpcap.so.1 libpcap.so.0.8 target/aarch64-unknown-linux-gnu/release/nasl-cli
- run: mkdir assets/
- run: mv rust/target/aarch64-unknown-linux-gnu/release/nasl-cli assets/nasl-cli-aarch64-unknown-linux-gnu
- run: mv rust/target/x86_64-unknown-linux-gnu/release/nasl-cli assets/nasl-cli-x86_64-unknown-linux-gnu
Expand Down

0 comments on commit cd1b40a

Please sign in to comment.