commit before push.

This commit is contained in:
cyteen 2022-02-22 08:03:23 +00:00
parent 63ddbd8223
commit 4e6750a067
2 changed files with 56 additions and 4 deletions

View File

@ -5,7 +5,8 @@ LOCAL_USER_EMAIL=cyteen@ring-zero.co.uk
cat > /tmp/generate-ssh-key.sh << EOF
ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ~/.ssh/mozilla_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ~/.ssh/devuan_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ~/.ssh/debian_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ~/.ssh/gitlab_rsa
EOF
@ -13,7 +14,8 @@ cat > /tmp/ssh-key-add.sh << EOF
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
ssh-add ~/.ssh/github_rsa
ssh-add ~/.ssh/mozilla_rsa
ssh-add ~/.ssh/devuan_rsa
ssh-add ~/.ssh/debian_rsa
ssh-add ~/.ssh/gitlab_rsa
EOF
@ -28,11 +30,57 @@ chmod 600 ~/.ssh/gitlab_rsa
chmod 644 ~/.ssh/gitlab_rsa.pub
chmod 600 ~/.ssh/github_rsa
chmod 644 ~/.ssh/github_rsa.pub
chmod 600 ~/.ssh/mozilla_rsa
chmod 644 ~/.ssh/mozilla_rsa.pub
chmod 600 ~/.ssh/devuan_rsa
chmod 644 ~/.ssh/devuan_rsa.pub
chmod 600 ~/.ssh/debian_rsa
chmod 644 ~/.ssh/debian_rsa.pub
EOF
## Set preferred key for each
# local gitlab
cat <<EOF | sudo tee -a /etc/ssh/ssh_config >/dev/null
Host git.ring-zero.co.uk
User git
Preferredauthentications publickey
IdentityFile ${HOME}/.ssh/gitlab_rsa
EOF
# gitlab
cat <<EOF | sudo tee -a /etc/ssh/ssh_config >/dev/null
Host gitlab.com
User git
Preferredauthentications publickey
IdentityFile ${HOME}/.ssh/gitlab_rsa
EOF
# github
cat <<EOF | sudo tee -a /etc/ssh/ssh_config >/dev/null
Host github.com
User git
Preferredauthentications publickey
IdentityFile ${HOME}/.ssh/github_rsa
EOF
# github
cat <<EOF | sudo tee -a /etc/ssh/ssh_config >/dev/null
Host git.devuan.org
User git
Preferredauthentications publickey
IdentityFile ${HOME}/.ssh/devuan_rsa
EOF
# debian
cat <<EOF | sudo tee -a /etc/ssh/ssh_config >/dev/null
Host salsa.debian.org
User git
Preferredauthentications publickey
IdentityFile ${HOME}/.ssh/debian_rsa
EOF
DEST=${1:-/etc/skel}
cat > ${DEST}/.zprofile <<'EOF'

View File

@ -11,6 +11,10 @@ PROTO="https" # http
#CURL_OPTIONS="--insecure"
PRIVATE_TOKEN="P8mHeR6ASfAsHeqQKdvg" # ${PROTO}://${GITLAB_URL}/profile/personal_access_tokens //*[@id="feed_token"]
# Create with: ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ~/.ssh/gitlab_rsa or use existing pubkey
#RSA_KEY=$(cat ${HOME}/.ssh/gitlab_rsa.pub)
RSA_KEY=$(cat ${HOME}/.ssh/id_rsa.pub)
# Send