Compare commits
No commits in common. "2548ad883ae8b093221cdb8dbe92b1d37742f61c" and "10dcbf25e58a6617782d2970ab23153f2e935d71" have entirely different histories.
2548ad883a
...
10dcbf25e5
5 changed files with 6 additions and 57 deletions
|
@ -8,8 +8,6 @@ RUN echo "https://alpine.sutty.nl/alpine/v3.13/sutty" >> "/etc/apk/repositories"
|
|||
COPY packages /root/packages
|
||||
|
||||
RUN apk add --no-cache $(cat "/root/packages" | tr "\n" " ")
|
||||
RUN sed -re "s/#(@platforms = )/\1/" -i "/usr/lib/ruby/2.7.0/rubygems.rb" && \
|
||||
mkdir -m 700 -p "~/.ssh"
|
||||
RUN sed -re "s/#(@platforms = )/\1/" -i "/usr/lib/ruby/2.7.0/rubygems.rb"
|
||||
|
||||
COPY ssh/known_hosts /root/.ssh/known_hosts
|
||||
COPY .gemrc /root/.gemrc
|
||||
|
|
|
@ -7,8 +7,7 @@ RUN mkdir -p /home && \
|
|||
--home /home/suttier \
|
||||
suttier && \
|
||||
cp /root/.gemrc /home/suttier/.gemrc && \
|
||||
cp -r /root/.ssh /home/suttier/.ssh && \
|
||||
chown -R suttier:suttier /home/suttier/ && \
|
||||
chown suttier:suttier /home/suttier/.gemrc && \
|
||||
echo "suttier ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
USER suttier
|
||||
|
||||
|
|
52
haini.sh
52
haini.sh
|
@ -8,7 +8,6 @@ uname -m | grep -q x86_64 || exit 1
|
|||
DIR="$(dirname "$(realpath "$0")")"
|
||||
ROOT="$(dirname "$DIR")"
|
||||
SELF="$(basename "$0")"
|
||||
SSH_ADHOC=false
|
||||
|
||||
# Sólo se puede correr desde el directorio de Sutty
|
||||
if test "$ROOT" != "$(dirname "$PWD")" && test "$ROOT" != "$PWD"; then
|
||||
|
@ -41,35 +40,26 @@ ENTORNO=${ENTORNO:-${ROOT}/hain}
|
|||
correr() {
|
||||
echo "> $1" >&2
|
||||
|
||||
if test "$AS_ROOT"; then
|
||||
SET_UID=0
|
||||
SET_GID=0
|
||||
else
|
||||
SET_UID="$(id -u)"
|
||||
SET_GID="$(id -g)"
|
||||
fi
|
||||
|
||||
env -i \
|
||||
TERM="$TERM" \
|
||||
USER="suttier" \
|
||||
USER="$USER" \
|
||||
HOME="/home/suttier" \
|
||||
HAIN_ENV=true \
|
||||
RAILS_ENV="${RAILS_ENV:-development}" \
|
||||
JEKYLL_ENV="${JEKYLL_ENV:-development}" \
|
||||
EDITOR="nano" \
|
||||
PAGER="less -niSFX" \
|
||||
SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" \
|
||||
bwrap \
|
||||
--die-with-parent \
|
||||
--unshare-user \
|
||||
--uid "$SET_UID" \
|
||||
--gid "$SET_GID" \
|
||||
--unshare-user-try \
|
||||
--unshare-ipc \
|
||||
--unshare-uts \
|
||||
--unshare-cgroup-try \
|
||||
--bind "$ENTORNO" / \
|
||||
--bind "$ROOT" /Sutty \
|
||||
--ro-bind /etc/hosts /etc/hosts \
|
||||
--ro-bind /etc/passwd /etc/passwd \
|
||||
--ro-bind /etc/group /etc/group \
|
||||
--ro-bind /etc/resolv.conf /etc/resolv.conf \
|
||||
--ro-bind /etc/localtime /etc/localtime \
|
||||
--dev-bind /dev /dev \
|
||||
|
@ -179,22 +169,6 @@ crear_entorno() {
|
|||
&& mv "$ENTORNO$HOME" "$ENTORNO/home/suttier"
|
||||
mkdir -p "$ENTORNO/home/suttier"
|
||||
|
||||
if ! grep ^suttier: "$ENTORNO/etc/group" >/dev/null 2>&1 ; then
|
||||
AS_ROOT=true correr "addgroup \
|
||||
-g $(id -g) \
|
||||
suttier"
|
||||
fi
|
||||
if ! correr "id suttier" >/dev/null 2>&1 ; then
|
||||
AS_ROOT=true correr "adduser \
|
||||
--disabled-password \
|
||||
--gecos '' \
|
||||
--home /home/suttier \
|
||||
--no-create-home \
|
||||
--uid $(id -u) \
|
||||
--ingroup suttier \
|
||||
suttier"
|
||||
fi
|
||||
|
||||
# Configurar rubygems para que descargue las gemas desde Sutty
|
||||
install -m 640 "$DIR/.gemrc" "$ENTORNO/home/suttier/.gemrc"
|
||||
|
||||
|
@ -206,10 +180,6 @@ crear_entorno() {
|
|||
install -m 755 "$script" "$ENTORNO/usr/local/bin/${script##*/}"
|
||||
done
|
||||
|
||||
# Configurar SSH
|
||||
install -m 700 -d "$ENTORNO/home/suttier/.ssh"
|
||||
install -m 644 "$DIR/ssh/known_hosts" "$ENTORNO/home/suttier/.ssh/known_hosts"
|
||||
|
||||
test -f "$ENTORNO/etc/ssl/certs/sutty.local.crt" || generar_certificado
|
||||
test -f "$ENTORNO/usr/local/share/ca-certificates/ca-sutty.crt" || mv "$ENTORNO/etc/ssl/certs/ca-sutty.crt" "$ENTORNO/usr/local/share/ca-certificates/ca-sutty.crt"
|
||||
}
|
||||
|
@ -233,20 +203,6 @@ esac
|
|||
if test "$HAIN_ENV"; then
|
||||
${*:-$DEFAULT}
|
||||
else
|
||||
if test -z "${SSH_AUTH_SOCK}"; then
|
||||
if ! type ssh-agent >/dev/null 2>&1 ; then
|
||||
echo "Instala ssh-agent para poder trabajar con git remoto dentro de haini.sh" >&2
|
||||
else
|
||||
SSH_ADHOC=true
|
||||
|
||||
echo "Iniciando un ssh-agent temporal." >&2
|
||||
eval "$(ssh-agent)"
|
||||
ssh-add
|
||||
fi
|
||||
fi
|
||||
|
||||
crear_entorno
|
||||
stdin=/dev/stdin correr "${*:-$DEFAULT}"
|
||||
|
||||
${SSH_ADHOC} && ssh-agent -k
|
||||
fi
|
||||
|
|
1
packages
1
packages
|
@ -14,7 +14,6 @@ nano-syntax
|
|||
ncurses-terminfo
|
||||
nginx
|
||||
nodejs
|
||||
openssh-client
|
||||
openssl
|
||||
postgresql
|
||||
postgresql-contrib
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
0xacab.org,198.252.153.239 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKdh69MJNIA4hZNdplalK1BOD4QZEKn8msMwsEzA7nrr
|
||||
athshe.sutty.nl,172.96.172.58 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIDqJl9IW6WXAxrtZXMzvMnIpTjIZB+Tp+dDUpSaOrqdjqdMVjHVQSFnVh0MLHbvdjKKtxaKDAuT3JXGrSp8wyA=
|
||||
anarres.sutty.nl,54.39.161.205 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGw9aXovdiR44WzGfaitjlGiAO7I5OP/XgxFEc+t6HWeS0oqIVaEo17y7j29hLZbTRpN8vWoGSMa+UtquQZ6JG8=
|
Loading…
Reference in a new issue