Sign inSign up

cdaller/beef

By cdaller

•Updated almost 5 years ago

Beef docker image from https://github.com/beefproject/beef

Image
0

135

cdaller/beef repository overview

To use this image, you need to overwrite the beef password either by overwriting the config.yaml (with the non default password) copied to /beef/config.yaml or using customized entrypoint to set the password.

Dockerfile:

FROM cdaller/beef:v0.5.4.0

COPY config.yaml /beef/config.yaml

EXPOSE 3000 6789 61985 61986

COPY entrypoint.sh /tmp/entrypoint.sh
ENTRYPOINT ["/tmp/entrypoint.sh"]

entrypoint.sh

#!/bin/sh

RANDOM_BEEF_PASSWORD=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c 32)
DEFAULT_BEEF_USER="beef"

CHOSEN_BEEF_PASSWORD=$RANDOM_BEEF_PASSWORD
CHOSEN_BEEF_USER=$DEFAULT_BEEF_USER

CURRENT_PWD=$(grep -oEi 'passwd\: \"(.*?)\"' config.yaml | cut -d'"' -f2)

if [ $BEEF_PASSWORD ]; then
    # explicit password was given, use it instead of random
    CHOSEN_BEEF_PASSWORD=$BEEF_PASSWORD
else
    if [ "$CURRENT_PWD" = "beef" ]; then
        # config still contains the default password so change it for a random one
        CHOSEN_BEEF_PASSWORD=$RANDOM_BEEF_PASSWORD
    else
        # config was already changed with a random password, so don't change it!
        CHOSEN_BEEF_PASSWORD=$CURRENT_PWD
    fi;
fi
# replace anything already set, by chosen or random password
sed -i "s/passwd: .*/passwd: \"$CHOSEN_BEEF_PASSWORD\"/" config.yaml

if [ $BEEF_USER ]; then
    # explicit user was given, replace anything currently set
    sed -i "s/user: .*/user: \"$BEEF_USER\"/" config.yaml
    CHOSEN_BEEF_USER=$BEEF_USER
fi

echo "Beef credentials: $CHOSEN_BEEF_USER:$CHOSEN_BEEF_PASSWORD"
CHOSEN_BEEF_PASSWORD=""

exec ./beef "$@"

Tag summary

Content type

Image

Digest

Size

205.9 MB

Last updated

almost 5 years ago

docker pull cdaller/beef:v0.5.4.0