/
githubmirror
/
metasploit-framework
Обзор
Документация
Войти
/
githubmirror
/
metasploit-framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
docker/entrypoint.sh
31 строка
830 B
Patryk Krawaczyński
Replace grep with getent in entrypoint.sh
18 окт 2023, 16:38
Не верифицирован
18 окт 2023, 16:38
ce10038
Код
Авторство
О чём код?
#!/bin/bash MSF_USER=msf MSF_GROUP=msf TMP=${MSF_UID:=1000} TMP=${MSF_GID:=1000} # if the user starts the container as root or another system user, # don't use a low privileged user as we mount the home directory if [ "$MSF_UID" -eq "0" ]; then "$@" else # if the users group already exists, create a random GID, otherwise # reuse it if ! getent group $MSF_GID > /dev/null; then addgroup -g $MSF_GID $MSF_GROUP else addgroup $MSF_GROUP fi # check if user id already exists if ! getent passwd $MSF_UID > /dev/null; then adduser -u $MSF_UID -D $MSF_USER -g $MSF_USER -G $MSF_GROUP $MSF_USER # add user to metasploit group so it can read the source addgroup $MSF_USER $METASPLOIT_GROUP su-exec $MSF_USER "$@" # fall back to root exec if the user id already exists else "$@" fi fi