Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions tfgrid3/btcnode/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
FROM ubuntu:latest
FROM ubuntu:24.04

Check failure

Code scanning / Trivy

Image user should not be 'root' High

Artifact: tfgrid3/btcnode/Dockerfile
Type: dockerfile
Vulnerability DS002
Severity: HIGH
Message: Specify at least 1 USER command in Dockerfile with non-root user as argument
Link: DS002

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y wget software-properties-common curl openssh-server ufw
RUN apt update && apt install -y wget software-properties-common curl ssh ufw

# Download and install latest zinit
RUN curl -s https://api.github.com/repos/threefoldtech/zinit/releases/latest | \
grep "browser_download_url" | \
cut -d '"' -f 4 | \
wget -qi - -O /sbin/zinit
RUN wget --progress=bar:force:noscroll -O /sbin/zinit https://github.com/threefoldtech/zinit/releases/download/v0.2.14/zinit && \
chmod +x /sbin/zinit

RUN chmod +x /sbin/zinit
COPY scripts/ufw.sh /usr/local/bin/
COPY scripts/ssh-init.sh /usr/local/bin/

# Adding zinit config files
ADD zinit /etc/zinit/
Expand All @@ -23,17 +19,13 @@
tar -xzf bitcoin-${latest_release}-x86_64-linux-gnu.tar.gz && \
install -m 0755 -o root -g root -t /usr/local/bin bitcoin-${latest_release}/bin/*

# Install latest myceilum
RUN mycelium_version=$(curl -s https://api.github.com/repos/threefoldtech/mycelium/releases/latest | grep 'tag_name' | cut -d '"' -f 4 ) && \
wget "https://github.com/threefoldtech/mycelium/releases/download/${mycelium_version}/mycelium-x86_64-unknown-linux-musl.tar.gz" && \
tar -xzf mycelium-x86_64-unknown-linux-musl.tar.gz -C /usr/local/bin/
ENV PATH="/usr/local/bin:${PATH}"

# Cleaning up
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* mycelium-x86_64-unknown-linux-musl.tar.gz bitcoin-*
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* bitcoin-*

# Copy the bitcoin.conf file to the container
COPY bitcoin.conf /root/.bitcoin/bitcoin.conf

# Starting Command to run Bitcoind and ssh
RUN chmod +x /sbin/zinit && chmod +x /usr/local/bin/ufw.sh && chmod +x /usr/local/bin/ssh-init.sh
CMD ["/sbin/zinit", "init", "--container"]
#ENTRYPOINT ["zinit", "init"]
7 changes: 7 additions & 0 deletions tfgrid3/btcnode/scripts/ssh-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -x

if [ ! -z "$SSH_KEY" ]; then
mkdir -p /var/run/sshd
fi
12 changes: 2 additions & 10 deletions tfgrid3/btcnode/zinit/ssh_config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
exec: /bin/sh -eux -c "
mkdir -p /var/run/sshd;
mkdir -p /root/.ssh/;
chmod 600 ~/.ssh;
chmod 600 /etc/ssh/*;
touch ~/.ssh/authorized_keys;
chmod 600 ~/.ssh/authorized_keys;
echo $SSH_KEY > /root/.ssh/authorized_keys;
echo 'ssh configred'"
oneshot: true
exec: /usr/local/bin/ssh-init.sh
oneshot: true
8 changes: 3 additions & 5 deletions tfgrid3/btcnode/zinit/sshd.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
exec: /bin/bash -c " set -x ;
/usr/sbin/sshd;"
test: /bin/bash -c "service ssh status"
after:
- ssh_config
exec: /usr/sbin/sshd -D
after:
- ssh_config
7 changes: 3 additions & 4 deletions tfgrid3/btcnode/zinit/ufw_init.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
exec: /bin/sh -eux -c "
chmod +x /usr/local/bin/ufw.sh;
/usr/local/bin/ufw.sh;"
oneshot: true
exec: /usr/local/bin/ufw.sh
log: stdout
oneshot: true
Loading