Compare commits

..

5 Commits

Author SHA1 Message Date
accel
6833e7ed85 fix log 2022-10-25 16:56:38 +03:00
accel
6e0ae9d350 small config alias 2022-10-25 16:49:52 +03:00
accel
8834230cb3 safe config names 2022-02-09 23:01:14 +03:00
accel
f00c3bcc22 fix config generation 2022-01-31 18:01:32 +03:00
accel
b0c39bbeb3 zssh imporvement 2022-01-31 17:32:17 +03:00
2 changed files with 14 additions and 4 deletions

View File

@ -1 +1,2 @@
plugins+=(portage-edit) plugins+=(portage-edit)
alias rs='sudo rc-service'

View File

@ -20,6 +20,10 @@ function zssh_configure ()
zshlibs_ensure -d $zssh_private_configs zshlibs_ensure -d $zssh_private_configs
zshlibs_ensure -d ${zssh_global_configs} zshlibs_ensure -d ${zssh_global_configs}
zshlibs_ensure -d ${zssh_global_pubkeys} zshlibs_ensure -d ${zssh_global_pubkeys}
if ! [[ -d "${zssh_private_configs}" ]]
then
echo 'Include config.d/*.sshconf' > "${zssh_ssh_dotdir}/config_d"
fi
zssh_enumeratenodes zssh_enumeratenodes
if [[ ${#zssh_host_config_accesses} -gt 0 ]] if [[ ${#zssh_host_config_accesses} -gt 0 ]]
then then
@ -89,7 +93,10 @@ function zssh_process()
if [[ ${#zssh_host_config_accesses} -gt 0 ]] if [[ ${#zssh_host_config_accesses} -gt 0 ]]
then then
zshlibs_log zssh_server "processing ssh server setup" zshlibs_log zssh_server "processing ssh server setup"
if [[ "${HOME}/.config/zsh/local.config.zsh" -nt $(zssh_host_info -c) ]] # - if there is no generated ssh config,
# - if local config not older than (means newer than) generated config
# then generate ssh config
if ! [[ "${HOME}/.config/zsh/local.config.zsh" -ot $(zssh_host_info -c) ]]
then then
zshlibs_log zssh_server "publishing our configs …" zshlibs_log zssh_server "publishing our configs …"
zssh_publish_configs zssh_publish_configs
@ -143,7 +150,7 @@ function zssh_mail_pubkey2()
zshlibs_log zssh_client "sending '$(zssh_node_info ${ssh_node} -k) to '$(zssh_node_info ${ssh_node} -M ${zssh_host})'" zshlibs_log zssh_client "sending '$(zssh_node_info ${ssh_node} -k) to '$(zssh_node_info ${ssh_node} -M ${zssh_host})'"
cp -T "$(zssh_node_info ${ssh_node} -k)" "$(zssh_node_info ${ssh_node} -M ${zssh_host})" cp -T "$(zssh_node_info ${ssh_node} -k)" "$(zssh_node_info ${ssh_node} -M ${zssh_host})"
else else
zshlibs_log zssh_client "'$(zssh_node_info ${ssh_node} -K ${zssh_host})' already mailed" zshlibs_log zssh_client "'$(zssh_node_info ${ssh_node} -M ${zssh_host})' already mailed"
fi fi
} }
@ -153,8 +160,10 @@ function zssh_publish_configs()
zshlibs_log zssh_server "generating access configs for parties …" zshlibs_log zssh_server "generating access configs for parties …"
for sshmatch in ${(k)zssh_host_config_accesses} for sshmatch in ${(k)zssh_host_config_accesses}
do do
zshlibs_log zssh_server "generating our server access config '$(zssh_host_info -E ${sshmatch})'" config_filename="$(zssh_host_info -E ${sshmatch})"
zssh_generate_hostaccessconfig $sshmatch > "$(zssh_host_info -E ${sshmatch})" config_filename=${config_filename//:/_}
zshlibs_log zssh_server "generating our server access config '${config_filename}'"
zssh_generate_hostaccessconfig $sshmatch > "${config_filename}"
done done
zshlibs_log zssh_server "updating mtime for $(zssh_host_info -C)" zshlibs_log zssh_server "updating mtime for $(zssh_host_info -C)"
touch "$(zssh_host_info -C)" touch "$(zssh_host_info -C)"