DESCRIPTION:
ce script regroupe des règles pour administrer la VM ($vm_fqdn)
_depuis_ une machine distante ;
- il sert à la fois d'outil et de documentation.
+ il sert à la fois d'outil (aisément bidouillable)
+ et de documentation (préçise).
Voir \`$tool/vm_host' pour les règles côté machine hôte ($vm_host).
Voir \`$tool/vm_hosted' pour les règles côté VM hébergée ($vm_fqdn).
SYNTAX: $0 \$RULE \${RULE}_SYNTAX
cd "$tool"
git remote rm host || true
git remote add host $vm_host:tool/vm
- git config --replace remote.host.push HEAD:refs/heads/origin
+ git config --replace remote.host.push HEAD:refs/remotes/master
git remote rm hosted || true
git remote add hosted root@$vm_fqdn:tool/vm
- git config --replace remote.hosted.push HEAD:refs/heads/origin
+ git config --replace remote.hosted.push HEAD:refs/remotes/master
)
}
rule_git_push () { # SYNTAX: {host|hosted} $git_push_options
local remote=${1#remote=}; shift
GIT_SSH=./vm_ssh git push -v "$remote" "$@"
+ info "penser à faire : vm_hosted git_reset"
}
rule_ssh () {
"$tool"/vm_ssh $vm_fqdn "$@"
}
+rule_mosh () {
+ mosh --ssh="$tool/vm_ssh $*" $vm_fqdn
+ }
rule__ssh_known_hosts_update () {
rule ssh \
-o StrictHostKeyChecking=no \
whoami
}
rule_key_disk_send () {
- gpg --decrypt var/lib/luks/$vm_fqdn.key.gpg |
+ gpg --decrypt var/sec/luks/$vm_fqdn.key.gpg |
"$tool"/vm_ssh root@$vm_fqdn "$@" \
-o CheckHostIP=no \
-o HostKeyAlias=init.$vm_fqdn \
rule_key_disk_backup () {
for part in root var home
do
- mkdir -p var/lib/luks
+ mkdir -p var/sec/luks
rule ssh -l root ' \
tmp=$(mktemp)
cryptsetup luksHeaderBackup \
shred --remove "$tmp"
' |
gpg --encrypt --recipient $USER@ \
- -o var/lib/luks/${vm_lvm_lv}_${part}.luks.gpg
+ -o var/sec/luks/${vm_lvm_lv}_${part}.luks.gpg
done
}