Compare commits
5 commits
2ab88b7780
...
3ddb80e623
Author | SHA1 | Date | |
---|---|---|---|
|
3ddb80e623 | ||
|
232668bafb | ||
|
a41d84d492 | ||
|
d1288439f6 | ||
|
df6d276961 |
10 changed files with 28 additions and 18 deletions
|
@ -1,3 +1,3 @@
|
||||||
[ -e /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
|
[ -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
|
[ -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
|
||||||
|
|
|
@ -4,13 +4,14 @@
|
||||||
usage() {
|
usage() {
|
||||||
cat << EOF
|
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
|
EOF
|
||||||
|
|
||||||
}
|
}
|
||||||
default_serialnumberfile="${HOME}/ssh-ca/serialnumbers/serialnumber"
|
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 $?)
|
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
|
case $1 in
|
||||||
-h|--help)
|
-h|--help)
|
||||||
usage
|
usage
|
||||||
|
exit 0
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
-H|host)
|
-H|host)
|
||||||
|
@ -91,7 +93,7 @@ case $host_or_user in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if ${hms:-false};then
|
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"
|
[ $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
|
else
|
||||||
echo ssh-keygen -s $CABASE/${host_or_user^^}_CA/${host_or_user}_ca -n "${principals}" -V "${validtime}" -z $serialnumber -I "${identity}" "$1"
|
echo ssh-keygen -s $CABASE/${host_or_user^^}_CA/${host_or_user}_ca -n "${principals}" -V "${validtime}" -z $serialnumber -I "${identity}" "$1"
|
||||||
|
|
20
functions.sh
20
functions.sh
|
@ -197,11 +197,11 @@ mencfs () {
|
||||||
[ -z ${DESTDIR+x} ] && DESTDIR="$(dirname $ENCDIR)/$(basename $ENCDIR| tr '[:lower:]' '[:upper:]'| sed -e 's/^\.//')"
|
[ -z ${DESTDIR+x} ] && DESTDIR="$(dirname $ENCDIR)/$(basename $ENCDIR| tr '[:lower:]' '[:upper:]'| sed -e 's/^\.//')"
|
||||||
logdebug "DESTDIR: $DESTDIR"
|
logdebug "DESTDIR: $DESTDIR"
|
||||||
[ -d "$DESTDIR" ] || mkdir -p "$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)
|
local ENCFS_PASSWORD=$($PASS show "${PKEY}"|head -n1)
|
||||||
|
|
||||||
if [ -z ${ENCDIR+x} -a -d ${ENCDIR} ];then
|
if [ -z ${ENCDIR+x} -a -d ${ENCDIR} ];then
|
||||||
logerror "no encrypted directory found -> exit"
|
logerr "no encrypted directory found -> exit"
|
||||||
EXIT
|
EXIT
|
||||||
return 4
|
return 4
|
||||||
else
|
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=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"
|
# #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
|
# # 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}"
|
# cat << EOF >> "${TMPBASHCONFIG}"
|
||||||
#[ -e /etc/bashrc ] && BASHRC=/etc/bashrc
|
#[ -e /etc/bashrc ] && BASHRC=/etc/bashrc
|
||||||
#[ -e /etc/bash.bashrc ] && BASHRC=/etc/bash.bashrc
|
#[ -e /etc/bash.bashrc ] && BASHRC=/etc/bash.bashrc
|
||||||
|
@ -965,9 +965,9 @@ setloglevel () {
|
||||||
if [[ ${loglevels[*]} =~ "${1^^}" ]]; then
|
if [[ ${loglevels[*]} =~ "${1^^}" ]]; then
|
||||||
export LOGLEVEL=${1^^}
|
export LOGLEVEL=${1^^}
|
||||||
else
|
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
|
fi
|
||||||
logerror "change LOGLEVEL from $oldloglevel -> $LOGLEVEL"
|
logerr "change LOGLEVEL from $oldloglevel -> $LOGLEVEL"
|
||||||
EXIT
|
EXIT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -980,9 +980,9 @@ setfileloglevel () {
|
||||||
if [[ ${loglevels[*]} =~ "$1" ]]; then
|
if [[ ${loglevels[*]} =~ "$1" ]]; then
|
||||||
export FILELOGLEVEL=$1
|
export FILELOGLEVEL=$1
|
||||||
else
|
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
|
fi
|
||||||
logerror "change FILELOGLEVEL from $oldloglevel -> $FILELOGLEVEL"
|
logerr "change FILELOGLEVEL from $oldloglevel -> $FILELOGLEVEL"
|
||||||
EXIT
|
EXIT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1259,5 +1259,11 @@ gocnfshome() {
|
||||||
cd "${APP_SHARED_HOME}"
|
cd "${APP_SHARED_HOME}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setserver() {
|
||||||
|
export sshcon="$@"
|
||||||
|
if [ -n "${TMUX}" ]; then
|
||||||
|
tmux set-environment sshcon "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
#EOF
|
#EOF
|
||||||
|
|
||||||
|
|
6
sshs
6
sshs
|
@ -1,8 +1,10 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
sshs() {
|
sshs() {
|
||||||
ENTRY
|
ENTRY
|
||||||
|
[ $# -eq 0 ] && { [ "${sshcon:-x}" == "x" ] || set -- "${sshcon}"; }
|
||||||
|
if [ -n "${TMUX}" ]; then
|
||||||
|
tmux set-environment sshcon "$@"
|
||||||
|
fi
|
||||||
local LOGLEVEL="WARN"
|
local LOGLEVEL="WARN"
|
||||||
# MKTMPCMD='mktemp $(echo ${XDG_RUNTIME_DIR}/bashrc.XXXXXXXX.conf)'
|
# MKTMPCMD='mktemp $(echo ${XDG_RUNTIME_DIR}/bashrc.XXXXXXXX.conf)'
|
||||||
# VIMMKTMPCMD="mktemp ${XDG_RUNTIME_DIR}/vimrc.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
|
Loading…
Reference in a new issue