minor cleanup
parent
49e3312319
commit
2b426a1225
|
@ -1,7 +0,0 @@
|
||||||
alias ports="netstat -tulpn"
|
|
||||||
alias flushdns="systemctl restart systemd-resolved"
|
|
||||||
|
|
||||||
alias nid="sudo ip link set down"
|
|
||||||
alias niu="sudo ip link set up"
|
|
||||||
alias nir1="nid eth1 && niu eth1 && nwr"
|
|
||||||
alias nir1="nid eth1 && niu eth1 && nwr"
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
if [[ $(which systemctl) ]]; then
|
||||||
alias nws="sudo systemctl start systemd-networkd"
|
alias nws="sudo systemctl start systemd-networkd"
|
||||||
alias nwe="sudo systemctl enable systemd-networkd"
|
alias nwe="sudo systemctl enable systemd-networkd"
|
||||||
alias nwd="sudo systemctl disable systemd-networkd"
|
alias nwd="sudo systemctl disable systemd-networkd"
|
||||||
|
@ -8,5 +9,5 @@ alias nwj="journalctl -u systemd-networkd"
|
||||||
alias nw="networkctl"
|
alias nw="networkctl"
|
||||||
alias nwst="networkctl status"
|
alias nwst="networkctl status"
|
||||||
alias nwl="networkctl lldp"
|
alias nwl="networkctl lldp"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
alias homenet="module_load networks && load_home_network"
|
alias homenet="module_load networks && networks_load -h"
|
||||||
alias allnets="module_load networks && load_all_networks"
|
alias allnets="module_load networks && networks_load"
|
||||||
alias clrnets="module_load networks && clear_networks"
|
alias usernet="module_load networks && loadssh"
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# to be sourced (below) not run in subshell!
|
|
||||||
|
|
||||||
function network_path () {
|
|
||||||
|
|
||||||
[[ ! $1 ]] && return 1
|
|
||||||
local network;
|
|
||||||
network=$1
|
|
||||||
[[ $2 ]] && network=$2/$network
|
|
||||||
if [[ $(isAbsPath $network) ]]; then
|
|
||||||
[[ ! -d $network ]] && continue
|
|
||||||
else
|
|
||||||
if [[ -d ${HOME}/${BASH_SHELL_USER}/${network} ]];then
|
|
||||||
network=${HOME}/${BASH_SHELL_USER}/${network}
|
|
||||||
else
|
|
||||||
if [[ -d ${BASH_NETWORKS_DIR}/${network} ]];then
|
|
||||||
network=${BASH_NETWORKS_DIR}/${network}
|
|
||||||
else
|
|
||||||
return 2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
echo $network
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function network_dirs () {
|
|
||||||
|
|
||||||
(return 0 2>/dev/null) || (echo network_dirs must be sourced; return 1)
|
|
||||||
|
|
||||||
module_load path
|
|
||||||
[[ $? -ne 0 ]] && echo unable to access the file module, aboarting load && return 1
|
|
||||||
|
|
||||||
[[ ! $1 ]] && return 1
|
|
||||||
local networks;
|
|
||||||
networks=$1
|
|
||||||
[[ ! $1 ]] && return 2
|
|
||||||
[[ -f $1 ]] && networks=$(cat $1 | tr -s "\n" " ")
|
|
||||||
echo networks to add $networks
|
|
||||||
for network in $networks;
|
|
||||||
do
|
|
||||||
if [[ ${network} = *!* ]]; then
|
|
||||||
network=${network/!/}
|
|
||||||
BASH_NETWORK_HOME=$network
|
|
||||||
fi
|
|
||||||
network=$(network_path $network $2)
|
|
||||||
if [[ $network ]]; then
|
|
||||||
[[ $network =~ $BASH_NETWORK_HOME ]] && BASH_NETWORK_HOME_DIR=${network}
|
|
||||||
# echo adding $network to list of networks
|
|
||||||
BASH_SHELL_NETWORK_PATHS+="${network} "
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
export BASH_NETWORK_HOME
|
|
||||||
export BASH_NETWORK_HOME_DIR
|
|
||||||
export BASH_SHELL_NETWORK_PATHS
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -15,15 +15,15 @@
|
||||||
function network_path () {
|
function network_path () {
|
||||||
|
|
||||||
module_load path
|
module_load path
|
||||||
[[ $? -ne 0 ]] && echo unable to access the file module && return 1
|
[[ $? -ne 0 ]] && echo unable to access the path module && return 1
|
||||||
|
|
||||||
[[ ! $1 ]] && return 1
|
[[ ! $1 ]] && return 1
|
||||||
local network;
|
local network;
|
||||||
network=$1
|
network=$1
|
||||||
[[ $2 ]] && network=$2/$network
|
[[ $2 ]] && network=$2/$network
|
||||||
if [[ $(isAbsPath $network) ]]; then
|
if [[ $(isAbsPath $network) ]]; then
|
||||||
[[ ! -d $network ]] && continue
|
[[ ! -d $network ]] && return 2
|
||||||
else
|
else
|
||||||
if [[ -d ${HOME}/${BASH_SHELL_USER}/${network} ]];then
|
if [[ -d ${HOME}/${BASH_SHELL_USER}/${network} ]];then
|
||||||
network=${HOME}/${BASH_SHELL_USER}/${network}
|
network=${HOME}/${BASH_SHELL_USER}/${network}
|
||||||
else
|
else
|
||||||
|
@ -49,7 +49,7 @@ for dir in $lookin; do
|
||||||
local _networks=$(cat $dir/.networks | tr -s "\n" " ")
|
local _networks=$(cat $dir/.networks | tr -s "\n" " ")
|
||||||
for network in $_networks; do
|
for network in $_networks; do
|
||||||
[[ ! "$networks" == *" $network"* ]] && networks+=" $network" || echo $network already in list
|
[[ ! "$networks" == *" $network"* ]] && networks+=" $network" || echo $network already in list
|
||||||
# echo $networks
|
# echo $networks
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -80,6 +80,7 @@ for network in $networks; do
|
||||||
}
|
}
|
||||||
|
|
||||||
loadssh () {
|
loadssh () {
|
||||||
|
# echo loading ssh modules
|
||||||
module_load ssh
|
module_load ssh
|
||||||
module_load ssh-config
|
module_load ssh-config
|
||||||
ssh_config
|
ssh_config
|
||||||
|
@ -97,7 +98,8 @@ load_home_network() {
|
||||||
home=$(get_network_paths -h)
|
home=$(get_network_paths -h)
|
||||||
# echo returned $home
|
# echo returned $home
|
||||||
if [[ $home ]]; then
|
if [[ $home ]]; then
|
||||||
# echo loading home $BASH_NETWORK_HOME_PATH
|
# echo loading home @ $home
|
||||||
|
shell_process_directory $home
|
||||||
[[ ! "$BASH_SHELL_NETWORKS_LOADED" == *"$home"* ]] && BASH_SHELL_NETWORKS_LOADED+="$home "
|
[[ ! "$BASH_SHELL_NETWORKS_LOADED" == *"$home"* ]] && BASH_SHELL_NETWORKS_LOADED+="$home "
|
||||||
export BASH_SHELL_NETWORKS_LOADED
|
export BASH_SHELL_NETWORKS_LOADED
|
||||||
fi
|
fi
|
||||||
|
@ -108,11 +110,12 @@ loaded_networks () {
|
||||||
}
|
}
|
||||||
|
|
||||||
load_networks () {
|
load_networks () {
|
||||||
# echo load networks $1
|
|
||||||
local network; local networks; local path
|
local network; local networks; local path
|
||||||
if [[ $1 ]]; then
|
if [[ $1 ]]; then
|
||||||
for network in "$@"; do
|
for network in "$@"; do
|
||||||
|
# echo finding path of $network
|
||||||
networks+="$(network_path $network) "
|
networks+="$(network_path $network) "
|
||||||
|
# echo list of networks $networks
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
unset BASH_SHELL_NETWORK_PATHS
|
unset BASH_SHELL_NETWORK_PATHS
|
||||||
|
@ -141,7 +144,11 @@ networks_load () {
|
||||||
# echo networks_load called $@
|
# echo networks_load called $@
|
||||||
|
|
||||||
[[ $1 == "-h" ]] && { shift 1; load_home_network || return $?; } || load_networks "$@"
|
[[ $1 == "-h" ]] && { shift 1; load_home_network || return $?; } || load_networks "$@"
|
||||||
if [[ $BASH_SHELL_SSH_LOADED ]]; then enable_mounts; ssh_config; else loadssh; fi
|
if [[ $BASH_SHELL_SSH_LOADED ]]; then
|
||||||
|
module_load sshfs ssh-config
|
||||||
|
enable_mounts; ssh_config;
|
||||||
|
else loadssh;
|
||||||
|
fi
|
||||||
[[ $BASH_SHELL_LOADED ]] && load_shell_host_user_dev
|
[[ $BASH_SHELL_LOADED ]] && load_shell_host_user_dev
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,176 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
module_load confirm
|
|
||||||
module_load net-utils
|
|
||||||
module_load ssh
|
|
||||||
module_load ssh-pubkey
|
|
||||||
module_load minimize
|
|
||||||
module_load_path
|
|
||||||
|
|
||||||
# echo sourcing functions
|
|
||||||
|
|
||||||
|
|
||||||
_v_ () {
|
|
||||||
# used internally to module for getting value from environment variable
|
|
||||||
var=${REMOTE_HOST_PREFIX:-"_"}_$1
|
|
||||||
echo ${!var}
|
|
||||||
}
|
|
||||||
|
|
||||||
remote_host_env () {
|
|
||||||
[[ $1 = "--set" || $1 = "-s" ]] && { local set; set=true; shift; }
|
|
||||||
local prefix=${REMOTE_HOST_PREFIX:-"_"} # double __ is default prefix
|
|
||||||
[[ $1 = "--prefix" || $1 = "-p" ]] && { local prefix; prefix=$2; export REMOTE_HOST_PREFIX=$prefix; shift 2; }
|
|
||||||
local envfile
|
|
||||||
envfile=${1:-$REMOTE_HOST_ENV_FILE}
|
|
||||||
# echo passed $1
|
|
||||||
# echo set $set
|
|
||||||
# echo REMOTE_HOST_ENV_FILE $REMOTE_HOST_ENV_FILE
|
|
||||||
# echo envfile $envfile
|
|
||||||
[[ ! $envfile ]] && { echo "must pass remote host environment file or set REMOTE_HOST_ENV"; return 1; }
|
|
||||||
[[ ! -f $envfile ]] && { echo ERROR environment file, $1, does not exist; return 2; }
|
|
||||||
|
|
||||||
if [[ $set || ! $REMOTE_HOST_ENV_FILE ]]; then
|
|
||||||
|
|
||||||
# curr="$(env | grep ^${prefix}_)"
|
|
||||||
# curr= $(sed 's/=.*//' <<<"$curr")
|
|
||||||
curr=$(sed 's/=.*//' <<< "$(env | grep ^${prefix}_)")
|
|
||||||
if [[ $curr ]]; then
|
|
||||||
echo "****** removing current values ************"
|
|
||||||
echo "$curr"
|
|
||||||
echo "--------------------"
|
|
||||||
while IFS= read -r var; do
|
|
||||||
# echo adding prefix: $prefix
|
|
||||||
# echo removing environment variable: $var
|
|
||||||
unset "$var"
|
|
||||||
done <<< "$curr"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $1 ]]; then
|
|
||||||
echo exporting $1.env to REMOTE_HOST_ENV_FILE
|
|
||||||
export REMOTE_HOST_ENV_FILE=$(abs_path $1)
|
|
||||||
fi
|
|
||||||
|
|
||||||
while IFS= read -r var; do
|
|
||||||
# echo adding prefix: $prefix
|
|
||||||
# echo environment variable: ${prefix}_$var
|
|
||||||
export ${prefix}_$var
|
|
||||||
done <<< "$(minimize "$envfile")"
|
|
||||||
echo "****** Now Using Remote Host Environment ************"
|
|
||||||
env | grep ^${prefix}_
|
|
||||||
env | grep REMOTE
|
|
||||||
echo "************************************"
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ ! $(env | grep ^${prefix}_) ]] && { echo ERROR: no remote host environment has been set; return 4; }
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
remote_host_sshoptions () {
|
|
||||||
local key; local pw; local user;
|
|
||||||
|
|
||||||
[[ $1 = "-k" ]] && { shift; [[ $(_v_ KEY) ]] && key="-k $(_v_ KEY)"; }
|
|
||||||
[[ $1 = "-p" ]] && { shift; [[ $(_v_ USER_PW) ]] && pw="-p $(_v_ USER_PW)"; }
|
|
||||||
# echo key: $key
|
|
||||||
# echo pw: $pw
|
|
||||||
# echo envfile: $1
|
|
||||||
if ! remote_host_env; then
|
|
||||||
return $?
|
|
||||||
fi
|
|
||||||
[[ (! $pw) && $(_v_ KEY) ]] && key="-k $(_v_ KEY)"
|
|
||||||
[[ (! $key) && $(_v_ USER_PW) ]] && pw="-p $(_v_ USER_PW)"
|
|
||||||
|
|
||||||
echo $pw $(_v_ MP) $key "$@"
|
|
||||||
# ssh $pw $(_v_ MP) $key $user$(_v_ HOST_NAME)
|
|
||||||
}
|
|
||||||
|
|
||||||
remote_host_user () {
|
|
||||||
local host=$(_v_ HOST_NAME)
|
|
||||||
[[ ! $host ]] && { echo ERROR: environment file MUST include a HOST_NAME value; return 1; }
|
|
||||||
if ! remote_host_env; then
|
|
||||||
return $?
|
|
||||||
fi
|
|
||||||
[[ $(_v_ USER) ]] && user=$(_v_ USER)@
|
|
||||||
[[ $(_v_ USE_ROOT) ]] && user=root@
|
|
||||||
echo $user$host
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
remote_host_login () {
|
|
||||||
local sopts; local cmd
|
|
||||||
if [[ ! $* =~ "--" ]]; then
|
|
||||||
sopts=$*
|
|
||||||
else
|
|
||||||
sopts=$(sed 's/\(.*\)--.*/\1/' <<< "$*")
|
|
||||||
cmd=$(sed 's/.*--\(.*\)/\1/' <<< "$*")
|
|
||||||
fi
|
|
||||||
local options=$(remote_host_sshoptions "$sopts")
|
|
||||||
[[ $? -gt 0 ]] && return $?
|
|
||||||
local userhost=$(remote_host_user)
|
|
||||||
[[ $? -gt 0 ]] && return $?
|
|
||||||
echo ssh $options $userhost
|
|
||||||
ssh $options $userhost $cmd
|
|
||||||
}
|
|
||||||
|
|
||||||
remote_host_pubkey () {
|
|
||||||
# usage pubkey options -- ssh options,
|
|
||||||
local add=$(_v_ ADD_KEY)
|
|
||||||
local sudo=$(_v_ USER_PW)
|
|
||||||
[[ ! $add ]] && { echo no value given for ADD_KEY, aborting; return 2; }
|
|
||||||
local kopts; local sopts
|
|
||||||
if [[ ! $* =~ "--" ]]; then
|
|
||||||
kopts=$*
|
|
||||||
else
|
|
||||||
kopts=$(sed 's/\(.*\)--.*/\1/' <<< "$*")
|
|
||||||
sopts=$(sed 's/.*--\(.*\)/\1/' <<< "$*")
|
|
||||||
fi
|
|
||||||
echo adding public key: $add
|
|
||||||
kopts="$kopts -k $add"
|
|
||||||
module_load ssh-pubkey
|
|
||||||
echo sshpubkey $kopts $(remote_host_user) $(remote_host_sshoptions $sopts)
|
|
||||||
sshpubkey $kopts $(remote_host_user) $(remote_host_sshoptions $sopts)
|
|
||||||
echo sudo pw $sudo
|
|
||||||
sshpubkey -a root -s $sudo $kopts $(remote_host_user) $(remote_host_sshoptions $sopts)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# remote_host_shell () {
|
|
||||||
|
|
||||||
|
|
||||||
# }
|
|
||||||
|
|
||||||
remote_host_mount () {
|
|
||||||
module_load sshfs
|
|
||||||
local base=$(_v_ BASE_MOUNT_POINT)
|
|
||||||
if [[ $1 = "-u" ]]; then
|
|
||||||
umount $base/home
|
|
||||||
umount $base/root
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
local mopts; local sopts
|
|
||||||
if [[ ! $* =~ "--" ]]; then
|
|
||||||
mopts=$*
|
|
||||||
else
|
|
||||||
mopts=$(sed 's/\(.*\)--.*/\1/' <<< "$*")
|
|
||||||
sopts=$(sed 's/.*--\(.*\)/\1/' <<< "$*")
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
mkdir -p $base > /dev/null
|
|
||||||
base=${base:-"/mnt/_temp_"}
|
|
||||||
local user=$(_v_ USER)
|
|
||||||
# echo smount $mopts $(remote_host_user):/home/${user:-ubuntu} $base/home $(remote_host_sshoptions $sopts)
|
|
||||||
smount $mopts $user@$(_v_ HOST_NAME):/home/${user:-ubuntu} $base/$user $(remote_host_sshoptions $sopts)
|
|
||||||
smount $mopts root@$(_v_ HOST_NAME):/ $base/fs $(remote_host_sshoptions $sopts)
|
|
||||||
}
|
|
||||||
|
|
||||||
# below is run at module load
|
|
||||||
echo done loading module,functions available are
|
|
||||||
flist | grep remote_host
|
|
||||||
|
|
||||||
|
|
||||||
alias rhl="remote_host_login"
|
|
||||||
alias rhe="remote_host_env"
|
|
||||||
alias rhm="remote_host_mount"
|
|
|
@ -12,11 +12,12 @@ function ssh_config() {
|
||||||
local PDIRS
|
local PDIRS
|
||||||
local RESET
|
local RESET
|
||||||
local FILE
|
local FILE
|
||||||
|
local USEENV
|
||||||
|
|
||||||
declare OPTION
|
declare OPTION
|
||||||
declare OPTARG
|
declare OPTARG
|
||||||
declare OPTIND
|
declare OPTIND
|
||||||
while getopts 'd:glrf:' OPTION; do
|
while getopts 'd:glrf:e' OPTION; do
|
||||||
# echo $OPTION $OPTARG
|
# echo $OPTION $OPTARG
|
||||||
case "$OPTION" in
|
case "$OPTION" in
|
||||||
d)
|
d)
|
||||||
|
@ -33,6 +34,10 @@ function ssh_config() {
|
||||||
rm -f $SSH_CONFIG > /dev/null
|
rm -f $SSH_CONFIG > /dev/null
|
||||||
unset SSH_CONFIG
|
unset SSH_CONFIG
|
||||||
;;
|
;;
|
||||||
|
# use environment when sustituting
|
||||||
|
e)
|
||||||
|
USEENV=-e
|
||||||
|
;;
|
||||||
g)
|
g)
|
||||||
shift 1
|
shift 1
|
||||||
ssh_config_get $@
|
ssh_config_get $@
|
||||||
|
@ -56,7 +61,7 @@ function ssh_config() {
|
||||||
|
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
# if more arguments passsed then just get the entry otherwise build the file
|
# if more arguments passsed then just get the entry otherwise build the file
|
||||||
[[ $1 ]] && ssh_config_get $@ && return $?
|
[[ $1 ]] && ssh_config_get $@ && return $?
|
||||||
|
|
||||||
if [[ (! $SSH_CONFIG || $RESET ) ]]; then
|
if [[ (! $SSH_CONFIG || $RESET ) ]]; then
|
||||||
|
@ -97,6 +102,7 @@ if [[ (! $SSH_CONFIG || $RESET ) ]]; then
|
||||||
|
|
||||||
module_load debug
|
module_load debug
|
||||||
module_load file
|
module_load file
|
||||||
|
module_load env
|
||||||
|
|
||||||
echo -e "$HEADER" >$SSH_CONFIG
|
echo -e "$HEADER" >$SSH_CONFIG
|
||||||
# build_file appends the given file to output file cleanly with checks
|
# build_file appends the given file to output file cleanly with checks
|
||||||
|
@ -105,8 +111,9 @@ if [[ (! $SSH_CONFIG || $RESET ) ]]; then
|
||||||
# echo existing dirs ${CDIRS[@]}
|
# echo existing dirs ${CDIRS[@]}
|
||||||
# will append any .cfg file found in ssh/config subdir of any BASH_SHELL_DIRS, including home shell
|
# will append any .cfg file found in ssh/config subdir of any BASH_SHELL_DIRS, including home shell
|
||||||
|
|
||||||
# echo "set -a" > /tmp/config.env
|
# empty temp file
|
||||||
> /tmp/config.env
|
|
||||||
|
> /tmp/${USER}-config.env
|
||||||
|
|
||||||
for CDIR in "${CDIRS[@]}"; do
|
for CDIR in "${CDIRS[@]}"; do
|
||||||
# FILES=$(find -n '*.cfg' -d 0 $CDIR)
|
# FILES=$(find -n '*.cfg' -d 0 $CDIR)
|
||||||
|
@ -114,22 +121,22 @@ if [[ (! $SSH_CONFIG || $RESET ) ]]; then
|
||||||
# echo "adding ssh config file $f";
|
# echo "adding ssh config file $f";
|
||||||
[[ $f ]] && build_file "$f" $SSH_CONFIG
|
[[ $f ]] && build_file "$f" $SSH_CONFIG
|
||||||
done
|
done
|
||||||
[[ -f $CDIR/config.env ]] && build_file $CDIR/config.env /tmp/config.env
|
[[ -f $CDIR/config.env ]] && build_file $CDIR/config.env /tmp/${USER}-config.env
|
||||||
done
|
done
|
||||||
|
|
||||||
# append any tradtional home config
|
# append any tradtional home config
|
||||||
[[ -f "$HOME/.ssh/config" ]] && build_file "$HOME/.ssh/config" $SSH_CONFIG
|
[[ -f "$HOME/.ssh/config" ]] && build_file "$HOME/.ssh/config" $SSH_CONFIG
|
||||||
[[ -f "$HOME/.ssh/config.env" ]] && build_file "$HOME/.ssh/config.env" "/tmp/config.env"
|
[[ -f "$HOME/.ssh/config.env" ]] && build_file "$HOME/.ssh/config.env" "/tmp/${USER}-config.env"
|
||||||
|
|
||||||
|
# echo $SSH_CONFIG
|
||||||
|
# cat $SSH_CONFIG
|
||||||
|
|
||||||
# now replace any variables in file
|
# now replace any variables in file
|
||||||
# echo -e "\nset +a" >> /tmp/config.env
|
# echo sub env
|
||||||
# cat /tmp/config.env
|
# cat /tmp/${USER}-config.env
|
||||||
# return
|
env_subs_file $USEENV -o $SSH_CONFIG "/tmp/${USER}-config.env"
|
||||||
# (. /tmp/config.env; envsubst < $SSH_CONFIG) > /tmp/cfg
|
rm -f /tmp/${USER}-config.env
|
||||||
# if [[ $(ssh_config_get x 1> /dev/null) ]]; then
|
|
||||||
# echo error
|
|
||||||
# awk 'NR==193' /tmp/cfg
|
|
||||||
# fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,19 +200,18 @@ ssh_config_get () {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh_config_env () {
|
# ssh_config_env () {
|
||||||
|
|
||||||
SSH_CONFIG_ENV={$SSH_CONFIG_ENV:-$HOME/.ssh/config.env}
|
# SSH_CONFIG_ENV={$SSH_CONFIG_ENV:-$HOME/.ssh/config.env}
|
||||||
SSH_CONFIG_TEMP={$SSH_CONFIG_TEMP:-$HOME/.ssh/.config}
|
# SSH_CONFIG_TEMP={$SSH_CONFIG_TEMP:-$HOME/.ssh/.config}
|
||||||
|
|
||||||
|
# [[ ! -f "$SSH_CONFIG" ]] && ssh_config "$SSH_CONFIG"
|
||||||
|
# if [[ -f $SSH_CONFIG ]]; then
|
||||||
|
# env=[[ -f $SSH_CONFIG_ENV ]] && echo $SSH_CONFIG_ENV || echo ""
|
||||||
|
# env_merge_file $SSH_CONFIG $SSH_CONFIG_ENV > $SSH_CONFIG_TEMP
|
||||||
|
# cfg="-F $SSH_CONFIG_TEMP"
|
||||||
|
# cat $SSH_CONFIG_TEMP | grep -a6 newbox
|
||||||
|
# fi
|
||||||
|
|
||||||
[[ ! -f "$SSH_CONFIG" ]] && ssh_config "$SSH_CONFIG"
|
# return
|
||||||
if [[ -f $SSH_CONFIG ]]; then
|
# }
|
||||||
env=[[ -f $SSH_CONFIG_ENV ]] && echo $SSH_CONFIG_ENV || echo ""
|
|
||||||
env_merge_file $SSH_CONFIG $SSH_CONFIG_ENV > $SSH_CONFIG_TEMP
|
|
||||||
cfg="-F $SSH_CONFIG_TEMP"
|
|
||||||
cat $SSH_CONFIG_TEMP | grep -a6 newbox
|
|
||||||
fi
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -50,8 +50,8 @@ sshkeygen () {
|
||||||
|
|
||||||
[[ ! $1 ]] && echo must supply a private key name && return 1
|
[[ ! $1 ]] && echo must supply a private key name && return 1
|
||||||
[[ $2 ]] && pass="-P $2" || echo warning, you are creating an unencrypted key without a passphrase
|
[[ $2 ]] && pass="-P $2" || echo warning, you are creating an unencrypted key without a passphrase
|
||||||
# defualt is rsa 1024
|
|
||||||
ssh-keygen -f $1 $encode -C $1 $pass $pem
|
ssh-keygen -f $1 $encode -C $1 $pass $pem
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
if [[ $- == *i* ]]; then
|
# if [[ $- == *i* ]]; then
|
||||||
# anything here will be executed, changing to a directory
|
# anything here will be executed, changing to a directory
|
||||||
# note anything to stdout here may make rsync and other network commands fail
|
# note anything to stdout here may make rsync and other network commands fail
|
||||||
#cd /opt
|
#cd /opt
|
||||||
fi
|
# fi
|
|
@ -1,2 +0,0 @@
|
||||||
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
|
|
||||||
llog "ssh socket set to: $(env | grep SSH_AUTH_SOCK)"
|
|
Loading…
Reference in New Issue