updated ssh configs, moved in network related aliases from base. modified sshfs smount function to allow allow default port of 22

master
David Kebler 2021-01-14 13:26:12 -08:00
parent 7b87c8193d
commit 867875d413
9 changed files with 372 additions and 1 deletions

View File

@ -0,0 +1,135 @@
AddKeysToAgent yes
ForwardX11 no
ForwardX11Trusted yes
# ForwardAgent yes
IdentityFile ~/.ssh/privatekeys/sysadmin.kebler.net
######### 238 McHaley Network ################
## router
Host 238gate
user sysadmin
hostname gateway.238.kebler.net
Host 238gater
user root
hostname gateway.238.kebler.net
Host 238nas
user sysadmin
hostname nas.238.kebler.net
ForwardX11 yes
Host 238nasr
user root
hostname nas.kebler.net
ForwardX11 yes
Host 238water water
user sysadmin
hostname water.238.kebler.net
Host 238waterr waterr
user root
hostname water.238.kebler.net
Host 238hass 238ha
user root
hostname hassio.238.kebler.net
port 22
Host 238hasshost 238hahost
user root
hostname hassio.238.kebler.net
port 22222
Host 238admin trantor
user sysadmin
hostname admin.238.kebler.net
ForwardX11 yes
Host 238adminr trantorr
user root
hostname admin.238.kebler.net
ForwardX11 yes
# Lights Sytem Network
# relays
Host r238lights
user sysadmin
hostname lights.238.kebler.net
port 222
Host r238lightsr
user root
hostname lights.238.kebler.net
port 222
# switches
Host s238lights
user sysadmin
hostname lights.238.kebler.net
port 122
Host s238lightsr
user root
hostname lights.238.kebler.net
port 122
# controller
Host 238lights
user sysadmin
hostname lights.238.kebler.net
port 22
# root connections
Host 238lightsr
user root
hostname lights.238.kebler.net
port 22
## FOR ACCESS WHEN OUTSIDE 238 VIA NAT PORT FORWARDING WHEN VPN IS OFFLINE
Host w238nas
user sysadmin
hostname 238.kebler.net
port 322
ForwardX11 yes
Host w238nasf
user sysadmin
hostname 238.kebler.net
port 322
IdentityFile ~/.ssh/sysadmin.kebler.net
ForwardX11 yes
Host w238nasr
user root
hostname 238.kebler.net
port 322
ForwardX11 yes
## router
Host w238gate
user sysadmin
hostname 238.kebler.net
IdentityFile ~/.ssh/sysadmin.kebler.net
Host w238gater
user root
hostname 238.kebler.net
IdentityFile ~/.ssh/sysadmin.kebler.net
Host wtrantor
user sysadmin
hostname 238.kebler.net
port 222
IdentityFile ~/.ssh/sysadmin.kebler.net
Host wtrantorr
user root
hostname 238.kebler.net
port 222
IdentityFile ~/.ssh/sysadmin.kebler.net

View File

@ -0,0 +1,36 @@
Host 3115gate
user sysadmin
hostname 172.31.0.1
Host 3115nas
user sysadmin
hostname nas.3115.kebler.net
ForwardX11 yes
Host 3115admin frodo
user sysadmin
hostname admin.3115.kebler.net
port 22
ForwardX11 yes
Host 3115hass
user root
hostname hassio.3115.kebler.net
port 22
Host 3115hasshost
user root
hostname hassio.3115.kebler.net
port 22222
# via wan/NAT when vpn is down
Host w3115gate
user sysadmin
hostname i3115.kebler.net
port 22
Host wfrodo
user sysadmin
hostname i3115.kebler.net
port 222

View File

@ -0,0 +1,152 @@
AddKeysToAgent yes
ForwardX11 no
ForwardAgent yes
########### 645 Broadway Network ###################
# direct key access lines
# IdentitiesOnly=yes
# IdentityFile ~/.ssh/privatekeys/645-sysadmin
# private keys only in keepass not in privatekeys subdirectory
## Locally or VPN
#****** open sprinkler ****#
Host os
user pi
hostname sprinklers.645.kebler.net
port 22
# open sprinkler
Host osr
user root
hostname sprinklers.645.kebler.net
port 22
Host wnadal
user sysadmin
# change this to 645.kebler.net when deployed
hostname testvpn.kebler.net
port 222
ForwardX11 yes
Host nadal
user sysadmin
hostname nadal.645.kebler.net
ForwardX11 yes
Host nadalr
user root
hostname nadal.645.kebler.net
ForwardX11 yes
# uses ip in case dns is hosed
Host 645gate
user root
hostname 192.168.0.1
Host 645nas
user sysadmin
hostname nas.645.kebler.net
ForwardX11 yes
Host 645nasr
user root
hostname nas.645.kebler.net
ForwardX11 yes
# Lights Sytem Network
# relays
Host r645lights
user sysadmin
hostname controller.lights.645.kebler.net
port 222
Host r645lightsr
user root
hostname controller.lights.645.kebler.net
port 222
# switches
Host s645lights
user sysadmin
hostname controller.lights.645.kebler.net
port 122
Host s645lightsr
user root
hostname controller.lights.645.kebler.net
port 122
# controller
Host 645lights
user sysadmin
hostname controller.lights.645.kebler.net
port 22
# controller
Host 645lightsbu
user sysadmin
hostname backup.lights.645.kebler.net
port 22
# root connections
Host 645lightsr
user root
hostname controller.lights.645.kebler.net
port 22
## Via Internet with Port Forward
Host w645gate
user sysadmin
hostname i645.kebler.net
#root login for
Host w645gater
user root
hostname i645.kebler.net
Host w645nas
user sysadmin
hostname i645.kebler.net
port 322
Host w645nasr
user root
hostname i645.kebler.net
port 322
Host wnadal
user sysadmin
hostname i645.kebler.net
port 222
Host wnadalr
user root
hostname i645.kebler.net
port 222
Host 645ha 645hass
user root
hostname hassio.645.kebler.net
port 22
Host 645hahost 645hasshost
user root
hostname hassio.645.kebler.net
port 22222

4
all/alias/mint-utils Normal file
View File

@ -0,0 +1,4 @@
# run this on remote machine via ssh x11 forwarding
alias rmintupdate='XAUTHORITY=$HOME/.Xauthority sudo -E mintupdate'
alias rsources='XAUTHORITY=$HOME/.Xauthority sudo -E software-sources'
alias rsynaptic='XAUTHORITY=$HOME/.Xauthority sudo -E synaptic'

4
all/alias/nas Normal file
View File

@ -0,0 +1,4 @@
# nas
alias naslist="echo nasfm nasdisk nasgparted nasdata, caddyr, caddye"
alias nasha="ssh -t nas 'cd /usr/share/hassio/homeassistant ; bash'"
alias nascaddy="ssh -t nas 'cd /opt/caddy ; bash'"

2
all/alias/network Normal file
View File

@ -0,0 +1,2 @@
alias ports="netstat -tulpn"
alias flushdns="systemctl restart systemd-resolved"

15
all/alias/networkd Normal file
View File

@ -0,0 +1,15 @@
alias nws="sudo systemctl start systemd-networkd"
alias nwe="sudo systemctl enable systemd-networkd"
alias nwd="sudo systemctl disable systemd-networkd"
alias nwstp="sudo systemctl stop systemd-networkd"
alias nwr="sudo systemctl restart systemd-networkd"
alias nwdst="systemctl status systemd-networkd"
alias nwj="journalctl -u systemd-networkd"
alias nw="networkctl"
alias nwst="networkctl status"
alias nwl="networkctl lldp"
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"

20
all/function/nas Normal file
View File

@ -0,0 +1,20 @@
# nas
## rrem already loaded in 00-basic
function nasfm(){
rrem sysadmin@nas.kebler.net "nemo "$1""
}
function nasdisk(){
rrem sysadmin@nas.kebler.net "sudo gnome-disks"
}
function nasgparted(){
rrem sysadmin@nas.kebler.net "sudo gparted"
}
function nasdata(){
rrem sysadmin@nas.kebler.net "nemo /mnt/data"
}

View File

@ -5,8 +5,11 @@ module_load net-utils # host_reachable
function smount(){
local HOST
local PORT
HOST=$(sed 's/.*@\(.*\):.*/\1/' <<< "$1")
[[ ! $(host_reachable $HOST 22) ]] && echo host $HOST not reachable, aborting mount && return 1
# TODO search for -p and extract port, this assumes 3 and 4 position
PORT=$([[ $3 = "-p" ]] && echo $4 || echo 22)
[[ ! $(host_reachable $HOST $PORT) ]] && echo host $HOST not reachable, aborting mount && return 1
if [[ $(mounted $2) ]]; then
echo "remote $1 already mounted at $2, aborting mount"
else