Merge branch 'ssh' into 'antifascista'

Soportar las llaves SSH de le usuarie

See merge request sutty/haini.sh!24
This commit is contained in:
Nulo 2021-09-28 18:29:46 +00:00
commit 25d1977b37
3 changed files with 24 additions and 0 deletions

View file

@ -8,6 +8,7 @@ uname -m | grep -q x86_64 || exit 1
DIR="$(dirname "$(realpath "$0")")" DIR="$(dirname "$(realpath "$0")")"
ROOT="$(dirname "$DIR")" ROOT="$(dirname "$DIR")"
SELF="$(basename "$0")" SELF="$(basename "$0")"
SSH_ADHOC=false
# Sólo se puede correr desde el directorio de Sutty # Sólo se puede correr desde el directorio de Sutty
if test "$ROOT" != "$(dirname "$PWD")" && test "$ROOT" != "$PWD"; then if test "$ROOT" != "$(dirname "$PWD")" && test "$ROOT" != "$PWD"; then
@ -57,6 +58,7 @@ correr() {
JEKYLL_ENV="${JEKYLL_ENV:-development}" \ JEKYLL_ENV="${JEKYLL_ENV:-development}" \
EDITOR="nano" \ EDITOR="nano" \
PAGER="less -niSFX" \ PAGER="less -niSFX" \
SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" \
bwrap \ bwrap \
--die-with-parent \ --die-with-parent \
--unshare-user \ --unshare-user \
@ -204,6 +206,10 @@ crear_entorno() {
install -m 755 "$script" "$ENTORNO/usr/local/bin/${script##*/}" install -m 755 "$script" "$ENTORNO/usr/local/bin/${script##*/}"
done 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/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" 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"
} }
@ -227,6 +233,20 @@ esac
if test "$HAIN_ENV"; then if test "$HAIN_ENV"; then
${*:-$DEFAULT} ${*:-$DEFAULT}
else 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 crear_entorno
stdin=/dev/stdin correr "${*:-$DEFAULT}" stdin=/dev/stdin correr "${*:-$DEFAULT}"
${SSH_ADHOC} && ssh-agent -k
fi fi

View file

@ -14,6 +14,7 @@ nano-syntax
ncurses-terminfo ncurses-terminfo
nginx nginx
nodejs nodejs
openssh-client
openssl openssl
postgresql postgresql
postgresql-contrib postgresql-contrib

3
ssh/known_hosts Normal file
View file

@ -0,0 +1,3 @@
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=