Skip to content

Instantly share code, notes, and snippets.

@keysie
Last active March 16, 2017 16:22
Show Gist options
  • Save keysie/ff52512b991634724640b92c1ff042e9 to your computer and use it in GitHub Desktop.
Save keysie/ff52512b991634724640b92c1ff042e9 to your computer and use it in GitHub Desktop.
### Questions to ask the user ###
* enforce use of gpg2? [Y/n]
* install newest git? [Y/n]
* name and email to set up git
### Dependencies ###
# predepend on debconf
# smartcard tools
pcscd scdaemon pcsc-tools
# GnuPG2 and newest git
# check if possible to depend on software from other ppa
gnupg2
sudo add-apt-repository ppa:???
# enforce gpg2 with symlink
# check if possible to do this with an alias so it can be
# configured on a per user basis
sudo ln -s /usr/bin/gpg2 /usr/local/bin/gpg
### Installation ###
# check gpg settings for best practices
# set up git with name and email and configure to use yubikey
echo "export SSH_AUTH_SOCK=~/.gnupg/S.gpg-agent.ssh" >> ~/.bashrc
# disable gnome keyring FOR ONE USER
SOURCE_DIR = "/etc/xdg/autostart"
TARGET_DIR = "/home/${SUDO_USER}/.config/autostart/"
## create folder if not existing
mkdir -p "${TARGET_DIR}"
## if file does not already exist copy it
if [ ! -e "${TARGET_DIR}/gnome-keyring-ssh.desktop" ]
then
cp /etc/xdg/autostart/gnome-keyring-ssh.desktop /home/${SUDO_USER}/.config/autostart/gnome-keyring-ssh.desktop
end
if [! -e "${TARGET_DIR}/gnome-keyring-gpg.desktop" ]
cp /etc/xdg/autostart/gnome-keyring-gpg.desktop /home/${SUDO_USER}/.config/autostart/gnome-keyring-gpg.desktop
end
# if file does exist, check if the desired line is already in it
# and if it is not disabled and then enabled again
echo "X-GNOME-Autostart-enabled=false" >> /home/${SUDO_USER}/.config/autostart/gnome-keyring-ssh.desktop
echo "X-GNOME-Autostart-enabled=false" >> /home/${SUDO_USER}/.config/autostart/gnome-keyring-gpg.desktop
# disable gnome keyring FOR ALL USERS
echo "X-GNOME-Autostart-enabled=false" >> /etc/xdg/autostart/gnome-keyring-ssh.desktop
echo "X-GNOME-Autostart-enabled=false" >> /etc/xdg/autostart/gnome-keyring-gpg.desktop
# enable GnuPG agent for gpg and ssh (per user)
echo "use-agent" >> /home/${SUDO_USER}/.gnupg/gpg.conf
echo "enable-ssh-support" >> /home/${SUDO_USER}/.gnupg/gpg-agent.conf
# create scd-event to kill hanging scdaemon (check if necessary)
touch ~/.gnupg/scd-event
-----------<<<
#!/bin/sh
state=$8
if [ "$state" = "NOCARD" ]; then
pkill -9 scdaemon
fi
------------<<<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment