rootfs/home/andre/.bashrc aktualisiert

This commit is contained in:
2026-01-10 13:14:43 +01:00
parent 33fed6afac
commit 24609df730

View File

@@ -82,6 +82,85 @@ shopt -s interactive_comments
shopt -s expand_aliases
shopt -s extglob
cark-ssh() {
set -euo pipefail
if [ $# -lt 1 ]; then
echo "Usage: $0 <host> [ssh-options...]"
exit 1
fi
HOST="$1"
shift || true
# Defaults
SSH_USER=""
SSH_HOSTNAME="$HOST"
SSH_PROXY=""
SSH_AUTH_OPTS=""
###############################################################################
# Gemeinsame CyberArk-Auth-Optionen
###############################################################################
CYBERARK_USER="ageissler@ageissler@${HOST}"
CYBERARK_AUTH_OPTS="-o PreferredAuthentications=publickey,keyboard-interactive,password"
SSH_USER="$CYBERARK_USER"
SSH_AUTH_OPTS="$CYBERARK_AUTH_OPTS"
###############################################################################
# Host switch-admin-*
###############################################################################
if [[ "$HOST" == switch-admin-* ]]; then
SSH_HOSTNAME="admin"
fi
###############################################################################
# Host router-swx-*
###############################################################################
if [[ "$HOST" == router-swx-* ]]; then
SSH_HOSTNAME="admin"
fi
###############################################################################
# Host switch-catalyst-* switch-nexus-* switch-fibre-* router-*
###############################################################################
if [[ "$HOST" == switch-catalyst-* \
|| "$HOST" == switch-nexus-* \
|| "$HOST" == switch-fibre-* \
|| "$HOST" == router-* ]]; then
SSH_HOSTNAME="finance"
fi
###############################################################################
# SSH-Command bauen
###############################################################################
CMD=(ssh)
if [ -n "$SSH_USER" ]; then
CMD+=(-l "$SSH_USER")
fi
CMD+=(-o HostName="$SSH_HOSTNAME")
if [ -n "$SSH_PROXY" ]; then
CMD+=(-o ProxyCommand="$SSH_PROXY")
fi
if [ -n "$SSH_AUTH_OPTS" ]; then
CMD+=($SSH_AUTH_OPTS)
fi
CMD+=("$HOST" "$@")
###############################################################################
# Optional Debug
###############################################################################
# echo "DEBUG: ${CMD[*]}" >&2
exec "${CMD[@]}"
}
__RDP() {
if [ "$1" == "" ]
then