From 29a52456043b33a80611007ee422963481db8841 Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Sat, 18 Feb 2023 22:37:36 -0700 Subject: [PATCH] Update: docker config in post_install --- post_install.sh | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/post_install.sh b/post_install.sh index 9085911..06f0162 100755 --- a/post_install.sh +++ b/post_install.sh @@ -172,7 +172,7 @@ check_xremap_etc() { if ! [[ -e /etc/systemd/system/xremap.service ]]; then printf "ERR: Missing service file for xremap\n" - printf "\t $ please cp ~/.configs_pointer/systemd/xremap.service /etc/systemd/system/xremap.service\n" + printf "\t $ please cp ~/.configs_pointer/systemd/system/xremap.service /etc/systemd/system/xremap.service\n" return_code=1 fi @@ -434,6 +434,39 @@ check_sshdconfig() { return $return_code } +#################### +# Docker configs +#################### +docker_checks() { + check_for_docker_service + check_for_docker_detach_keys +} + +check_for_docker_detach_keys() { + local return_code=0 + + if ! grep -q 'detachKeys' ~/.docker/config.json; then + printf 'ERR: Docker detach keys are not defined. Default is ^p^q\n' + printf '\tAdd "detachKeys": "ctrl-q,ctrl-q" to ~/.docker/config.json\n' + return_code=1 + fi + + if ! grep -q 'PermitRootLogin no' /etc/ssh/sshd_config; then + printf 'ERR: Root login permitted in /etc/ssh/sshd_config\n' + printf '\tSee ./ssh/template.sshd_config for an example\n' + return_code=1 + fi + + if grep -q 'Port 22' /etc/ssh/sshd_config || ! grep -q 'Port' /etc/ssh/sshd_config; then + printf 'ERR: Still using port 22 for sshd\n' + printf '\tSee ./ssh/template.sshd_config for an example\n' + return_code=1 + fi + + return $return_code +} + + #################### # Rust binaries #################### @@ -522,6 +555,7 @@ if [[ "$(uname -s)" == 'Linux' ]] && [[ "$1" == 'status' || "$1" == 'build' ]]; aerc_checks git_checks ssh_checks + docker_checks russy_checks else print_help