only include ssh keys if configured to do so explicitly. use .chezmoiignore to skip linux files on non-linux os

main
Andrew Coleman 2022-08-12 14:05:39 -04:00
parent 8c126dabb3
commit f7a6eb1125
6 changed files with 19 additions and 22 deletions

14
.chezmoiignore Normal file
View File

@ -0,0 +1,14 @@
{{- if ne .include_ssh_keys "true" }}
.config/bash/gitea.sh
.ssh/gitea
.ssh/gitea.pub
.ssh/selfhosted
.ssh/selfhosted.pub
.ssh/github
.ssh/github.pub
{{- end }}
{{- if ne .chezmoi.os "linux" }}
.config/bash/ssh-agent.sh
.config/bash/xhost.sh
.config/systemd/
{{- end }}

View File

@ -1,4 +1,3 @@
{{- if (eq .chezmoi.os "linux") -}}
{{- if (contains "microsoft" .chezmoi.kernel.osrelease) -}} {{- if (contains "microsoft" .chezmoi.kernel.osrelease) -}}
if [ -z "$(pgrep ssh-agent)" ]; then if [ -z "$(pgrep ssh-agent)" ]; then
rm -rf /tmp/ssh-* rm -rf /tmp/ssh-*
@ -11,4 +10,3 @@ fi
SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
export SSH_AUTH_SOCK export SSH_AUTH_SOCK
{{ end }} {{ end }}
{{- end -}}

View File

@ -1,3 +1 @@
{{ if (eq .chezmoi.os "linux" ) }}
xhost +local:root > /dev/null 2>&1 xhost +local:root > /dev/null 2>&1
{{ end }}

View File

@ -1,4 +1,3 @@
{{- if (eq .chezmoi.os "linux") -}}
[Unit] [Unit]
Description=SSH key agent Description=SSH key agent
@ -11,4 +10,3 @@ ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK
[Install] [Install]
WantedBy=default.target WantedBy=default.target
{{ end }}

View File

@ -1 +1,3 @@
{{- bitwardenAttachment "selfhosted.pub" "selfhosted-ssh-keys" }} {{- if ne .include_ssh_keys "true" }}
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID3M8FYKBjXXUQpk5+bQXe1zwkONtfbifRnTr+dkNwHt selfhosted@penguincoder.org
{{- end }}

View File

@ -4,7 +4,6 @@ Host *
Host penguincoder.org Host penguincoder.org
Port 2223 Port 2223
User {{ (bitwardenFields "item" "selfhosted-ssh-keys").hydrogen_username.value }}
IdentityFile ~/.ssh/selfhosted IdentityFile ~/.ssh/selfhosted
Host git.penguincoder.org Host git.penguincoder.org
@ -13,16 +12,10 @@ Host git.penguincoder.org
IdentityFile ~/.ssh/gitea IdentityFile ~/.ssh/gitea
ProxyCommand none ProxyCommand none
Host helium.penguincoder.org helium Host helium helium.penguincoder.org
User {{ (bitwardenFields "item" "selfhosted-ssh-keys").hydrogen_username.value }}
HostName 192.168.1.50 HostName 192.168.1.50
Host hydrogen hydrogen.olympus Host potassium potassium.penguincoder.org
User {{ (bitwardenFields "item" "selfhosted-ssh-keys").hydrogen_username.value }}
HostName 192.168.1.80
Host potassium potassium.olympus
User {{ (bitwardenFields "item" "selfhosted-ssh-keys").hydrogen_username.value }}
HostName 192.168.1.60 HostName 192.168.1.60
ProxyCommand none ProxyCommand none
@ -33,9 +26,3 @@ Host *.penguincoder.org !git.penguincoder.org
Host github.com Host github.com
User git User git
IdentityFile ~/.ssh/github IdentityFile ~/.ssh/github
Host jolijardin.co
User {{ (bitwardenFields "item" "jolijardin.co").username.value }}
PubKeyAuthentication no
# {{ (bitwardenFields "item" "jolijardin.co").password.value }}