diff options
author | SeongJae Park <sj@kernel.org> | 2023-12-22 13:00:31 -0800 |
---|---|---|
committer | SeongJae Park <sj@kernel.org> | 2023-12-22 13:00:31 -0800 |
commit | fa7b344db6303fa351cc65cefcc83ac393ec6c73 (patch) | |
tree | dd44eaaad2df5c93b739e2a2d734fad19c1c2834 | |
parent | d782bfd7a21d652cce569dd9180440295678549d (diff) | |
download | damon-hack-fa7b344db6303fa351cc65cefcc83ac393ec6c73.tar.gz |
ensure_gpg_password: Add more checks
Signed-off-by: SeongJae Park <sj@kernel.org>
-rw-r--r-- | _ssh_config | 11 | ||||
-rwxr-xr-x | ensure_gpg_password.sh | 21 |
2 files changed, 32 insertions, 0 deletions
diff --git a/_ssh_config b/_ssh_config new file mode 100644 index 0000000..2c208cf --- /dev/null +++ b/_ssh_config @@ -0,0 +1,11 @@ +Host gitolite.kernel.org + User git + ClearAllForwardings yes + # We prefer ed25519 keys, but will fall back to others if your + # openssh client does not support that + HostKeyAlgorithms ssh-ed25519,ecdsa-sha2-nistp256,ssh-rsa + # Below are very useful for speeding up repeat access + # and for 2-factor validating your sessions + ControlPath ~/.ssh/cm-%r@%h:%p + ControlMaster auto + ControlPersist 30m diff --git a/ensure_gpg_password.sh b/ensure_gpg_password.sh index 769cfb9..1d96478 100755 --- a/ensure_gpg_password.sh +++ b/ensure_gpg_password.sh @@ -1,5 +1,26 @@ #!/bin/bash +bindir=$(dirname "$0") + +if ! diff "$bindir/_ssh_config" $HOME/.ssh/config +then + echo "Please set $HOME/.ssh/config same to $bindir/_ssh_config" + exit 1 +fi + + +if ! grep --quiet "^export SSH_AUTH_SOCK=\$(gpgconf --list-dirs agent-ssh-socket)" "$HOME/.bashrc" +then + echo "Add export SSH_AUTH_SOCK=\$(gpgconf --list-dirs agent-ssh-socket) to .bashrc" + exit 1 +fi + +if [ ! $(git config --get gpg.program) = "gpg" ] +then + echo "do git config gpg.program gpg" + exit 1 +fi + gpg-connect-agent updatestartuptty /bye > /dev/null ssh gitolite.kernel.org help > /dev/null ssh git@github.com &> /dev/null |