Compare commits

..

5 commits

Author SHA1 Message Date
Jakobus Schürz
3ddb80e623 change logerror to logerr 2022-09-28 01:28:12 +02:00
Jakobus Schürz
232668bafb update submodules 2022-09-24 22:31:48 +02:00
Jakobus Schürz
a41d84d492 add functionality to open more connections
to the same server in split tmux pane with sshs
2022-09-21 15:51:44 +02:00
Jakobus Schürz
d1288439f6 update submodules 2022-09-17 12:26:33 +02:00
Jakobus Schürz
df6d276961 add P11-Module and set default variable 2022-09-17 12:26:33 +02:00
10 changed files with 28 additions and 18 deletions

View file

@ -1,3 +1,3 @@
[ -e /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
[ -e /usr/share/bash-completion/completions/ssh ] && . /usr/share/bash-completion/completions/ssh
shopt -u hostcomplete && complete -F _ssh sshs
shopt -u hostcomplete && complete -F _ssh sshs setserver

View file

@ -4,13 +4,14 @@
usage() {
cat << EOF
Usage: $(dirname $0) [-n|--principals] <principal>[,<principal>[,<principal>[,...]]] [-V|--valid-time] <TIME> [-s|--serialnumber] <INT> [-S|-serialnumber-file] <filename> [-I|--identity] [--dry-run] <identity> publickey
Usage: $(dirname $0) [-t|--hsm] [-U|-H] [-n|--principals] <principal>[,<principal>[,<principal>[,...]]] [-V|--valid-time] <TIME> [-s|--serialnumber] <INT> [-S|-serialnumber-file] <filename> [-I|--identity] <identity> [--dry-run] <publickey>
EOF
}
default_serialnumberfile="${HOME}/ssh-ca/serialnumbers/serialnumber"
host_or_user=user
set -- $(getopt -u -o hHn:V:s:S:I:tU --long help,host,user,principals:,valid-time:,serialnumber:,serialnumber-file:,identity:,hms,dry-run -- "$@"|| exit $?)
@ -18,6 +19,7 @@ while : ;do
case $1 in
-h|--help)
usage
exit 0
break
;;
-H|host)
@ -91,7 +93,7 @@ case $host_or_user in
esac
if ${hms:-false};then
echo ssh-keygen -s $CABASE/${host_or_user^^}_CA/${host_or_user}_ca.pub -n "${principals}" -V "${validtime}" -z $serialnumber -I "${identity}" "$1"
echo ssh-keygen -s $CABASE/${host_or_user^^}_CA/${host_or_user}_ca.pub -D $P11M -n "${principals}" -V "${validtime}" -z $serialnumber -I "${identity}" "$1"
[ $DRY ] || ssh-keygen -s $CABASE/${host_or_user^^}_CA/${host_or_user}_ca.pub -D $P11M -n "${principals}" -V "${validtime}" -z $serialnumber -I "${identity}" "$1"
else
echo ssh-keygen -s $CABASE/${host_or_user^^}_CA/${host_or_user}_ca -n "${principals}" -V "${validtime}" -z $serialnumber -I "${identity}" "$1"

View file

@ -197,11 +197,11 @@ mencfs () {
[ -z ${DESTDIR+x} ] && DESTDIR="$(dirname $ENCDIR)/$(basename $ENCDIR| tr '[:lower:]' '[:upper:]'| sed -e 's/^\.//')"
logdebug "DESTDIR: $DESTDIR"
[ -d "$DESTDIR" ] || mkdir -p "$DESTDIR"
$PASS "${PKEY}" 1>/dev/null 2>&1 || { logerror "entry $PKEY does not exist in passwordsotre"; return 5; }
$PASS "${PKEY}" 1>/dev/null 2>&1 || { logerr "entry $PKEY does not exist in passwordsotre"; return 5; }
local ENCFS_PASSWORD=$($PASS show "${PKEY}"|head -n1)
if [ -z ${ENCDIR+x} -a -d ${ENCDIR} ];then
logerror "no encrypted directory found -> exit"
logerr "no encrypted directory found -> exit"
EXIT
return 4
else
@ -396,7 +396,7 @@ EOF
# local SSH_OPTS="-o VisualHostKey=no -o ControlMaster=auto -o ControlPersist=20s -o ControlPath=~/.ssh/master-%C"
# #local SSH_OPTS="-o VisualHostKey=no -o ControlMaster=yes -o ControlPersist=10s -o ControlPath=~/.ssh/ssh-%C"
# # Read /etc/bashrc or /etc/bash.bashrc (depending on distribution) and /etc/profile.d/*.sh first
# #ssh -T ${SSH_OPTS} $@ "pwd" >/dev/null 2>/dev/null || { logerror "Server $@ not reachable -> exit"; return 1; }
# #ssh -T ${SSH_OPTS} $@ "pwd" >/dev/null 2>/dev/null || { logerr "Server $@ not reachable -> exit"; return 1; }
# cat << EOF >> "${TMPBASHCONFIG}"
#[ -e /etc/bashrc ] && BASHRC=/etc/bashrc
#[ -e /etc/bash.bashrc ] && BASHRC=/etc/bash.bashrc
@ -965,9 +965,9 @@ setloglevel () {
if [[ ${loglevels[*]} =~ "${1^^}" ]]; then
export LOGLEVEL=${1^^}
else
logerror "LOGLEVEL must be one of ERROR, WARN, INFO, DEBUG or TRACE"
logerr "LOGLEVEL must be one of ERROR, WARN, INFO, DEBUG or TRACE"
fi
logerror "change LOGLEVEL from $oldloglevel -> $LOGLEVEL"
logerr "change LOGLEVEL from $oldloglevel -> $LOGLEVEL"
EXIT
}
@ -980,9 +980,9 @@ setfileloglevel () {
if [[ ${loglevels[*]} =~ "$1" ]]; then
export FILELOGLEVEL=$1
else
logerror "FILELOGLEVEL must be one of ERROR, WARN, INFO, DEBUG or TRACE"
logerr "FILELOGLEVEL must be one of ERROR, WARN, INFO, DEBUG or TRACE"
fi
logerror "change FILELOGLEVEL from $oldloglevel -> $FILELOGLEVEL"
logerr "change FILELOGLEVEL from $oldloglevel -> $FILELOGLEVEL"
EXIT
}
@ -1259,5 +1259,11 @@ gocnfshome() {
cd "${APP_SHARED_HOME}"
}
setserver() {
export sshcon="$@"
if [ -n "${TMUX}" ]; then
tmux set-environment sshcon "$@"
fi
}
#EOF

6
sshs
View file

@ -1,8 +1,10 @@
#!/bin/sh
sshs() {
ENTRY
[ $# -eq 0 ] && { [ "${sshcon:-x}" == "x" ] || set -- "${sshcon}"; }
if [ -n "${TMUX}" ]; then
tmux set-environment sshcon "$@"
fi
local LOGLEVEL="WARN"
# MKTMPCMD='mktemp $(echo ${XDG_RUNTIME_DIR}/bashrc.XXXXXXXX.conf)'
# VIMMKTMPCMD="mktemp ${XDG_RUNTIME_DIR}/vimrc.XXXXXXXX.conf"

@ -1 +1 @@
Subproject commit 25cb91f42d020f675bb0a2ce3fbd3a5d96119efa
Subproject commit e91b178ff832b7bcbbf4d99d9f467f63fd1b76b5

@ -1 +1 @@
Subproject commit 7c59902f64dcd7ea356e891274b21144d1ea5948
Subproject commit 1b1b8098419daacb92ca401ad6ee0ca6894a40ca

@ -1 +1 @@
Subproject commit 4bef330ce15d3ae80959415c24aba4700f5cbe35
Subproject commit f931e538903a20d7a63162f0f10f58447f1117c8

@ -1 +1 @@
Subproject commit c491d702b76c6b4918abb80be3cfb57d1b618ffa
Subproject commit 9ceac718026fd39498d95ff04fa04d3e40c465d7

@ -1 +1 @@
Subproject commit f5a6597496506da19d8177f4efc569e4971d0b74
Subproject commit a71f9a6417fd3dc9fd4f0a5228528ec3260dc201

@ -1 +1 @@
Subproject commit b411b753f805b969cca856e2ae51fdbab49880df
Subproject commit dd8107cabf5fe85df94d5eedcae52415e543f208