diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index e69de29..0000000 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5742e6b --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +keychain-2.6.8.tar.bz2 +/keychain-2.8.0.tar.bz2 +/keychain-2.8.5.tar.gz +/keychain-2.9.2.tar.gz +/keychain-2.9.8.tar.gz diff --git a/Makefile b/Makefile deleted file mode 100644 index e512bef..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: keychain -# $Id$ -NAME := keychain -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/README.Fedora b/README.Fedora new file mode 100644 index 0000000..7d0a9a0 --- /dev/null +++ b/README.Fedora @@ -0,0 +1,42 @@ +README.Fedora - keychain opt-in + +keychain is a manager for both ssh-agent and gpg-agent. It allows your shells +and cron jobs to share a single ssh-agent or gpg-agent process. keychain +typically runs from the login shell environment setting, i.e. ~/.bash_profile +when using bash or ~/.login when running a tcsh shell. It's general usage and +different options are documented in keychain(1). + +Installed from Fedora keychain can be easily activated by simply touching an +empty ~/.keychainrc file when using either bash, sh, ksh, zsh, csh or tcsh. +This will let the user's shell invoke a default setup of keychain where it +loads all user's ssh keys from ~/.ssh/ to an ssh-agent process. gpg keys are +not loaded by default as the necessary gpg-agent is not part of the Fedora Core +gnupg package, but provided by the additional gnupg2 package of Fedora. The +default setup starts keychain in quiet mode, so only messages are printed out +in case of warnings, errors or if interactivity is required. + +To override the default settings with which keychain is activated when +the shell environment finds a ~/.keychainrc, the user can customize following +variables by setting them inside the ~/.keychainrc. + +KCHOPTS="" + This variable takes options for keychain like "--nocolor" or "--noask". + Please see the keychain manpage for a full list. +SSHKEYS="" + Instead of loading all keys the user can list those keys to be loaded by + their file names. The key list has to be space separated. +GPGKEYS="" + gpg keys to be loaded by keychain have to be specified by their key ID. + The user can get a full list of keys and IDs in his secret keyring by + running `gpg --list-secret-keys'. GPGKEYS defines a single key ID or a + space separated list of key IDs. + +Please be aware that you still need to source the keychain file with the +ssh-agent environment variables along with the crontab entry when you want +to make use of ssh public key auth or of gpg signing through cron jobs, +because cron uses a non-interactive shell and has a limited environment set. + +Note: This opt-in is not part of keychain, which is originally written by +Daniel Robbins , but added to the Fedora package of +keychain to allow Fedora users an overall ease of use. + diff --git a/keychain.csh b/keychain.csh new file mode 100755 index 0000000..f937a7a --- /dev/null +++ b/keychain.csh @@ -0,0 +1,34 @@ +# /etc/profile.d/keychain.csh - calling keychain the Fedora way +# read in user's keychain settings or use defaults running keychain + +set userhome = `getent passwd $USER | cut -d: -f6` +if ( "$HOME" == "$userhome" && -f "$HOME/.keychainrc" ) then + + eval `grep -v '^[:blank:]*#' $HOME/.keychainrc | \ + sed 's|\([^=]*\)=\([^=]*\)|set \1 = \2|g' | sed 's|$|;|'` + + if (! $?KCHOPTS) then + set KCHOPTS = "--quiet" + endif + if (! $?prompt) then + set KCHOPTS = ( $KCHOPTS --noask ) + endif + if (! $?SSHKEYS) then + set SSHKEYS = `grep -s -l -e '[DRS]S[AH] PRIVATE KEY' $HOME/.ssh/*` + endif + if (! $?GPGKEYS) then + set GPGKEYS = "" + endif + + keychain $KCHOPTS $SSHKEYS $GPGKEYS + + set host = `uname -n` + if (-f $HOME/.keychain/$host-csh) then + source $HOME/.keychain/$host-csh + endif + if (-f $HOME/.keychain/$host-csh-gpg) then + source $HOME/.keychain/$host-csh-gpg + endif + +endif + diff --git a/keychain.sh b/keychain.sh new file mode 100755 index 0000000..964f391 --- /dev/null +++ b/keychain.sh @@ -0,0 +1,34 @@ +# +# /etc/profile.d/keychain.sh - calling keychain the Fedora way +# read in user's keychain settings or use defaults running keychain + +# Don't do anything if we're already done. +[ -n "$KEYCHAIN_DONE" ] && return + +userhome=$(getent passwd "$USER" | cut -d: -f6) +if [ "$HOME" = "$userhome" ] && [ -f "$HOME/.keychainrc" ]; then + + . "$HOME/.keychainrc" + [ -n "$KCHOPTS" ] || KCHOPTS="--quiet" + case $- in + *i*) ;; + *) KCHOPTS="$KCHOPTS --noask" ;; + esac + [ -n "$SSHKEYS" ] || SSHKEYS=$(grep -s -l -e '[DRS]S[AH] PRIVATE KEY' \ + "$HOME/.ssh/*") + [ -n "$GPGKEYS" ] || GPGKEYS="" + + keychain $KCHOPTS $SSHKEYS $GPGKEYS + + host=$(uname -n) + [ -f "$HOME/.keychain/$host-sh" ] && \ + . "$HOME/.keychain/$host-sh" + [ -f "$HOME/.keychain/$host-sh-gpg" ] && \ + . "$HOME/.keychain/$host-sh-gpg" + + unset KCHOPTS SSHKEYS GPGKEYS host + + KEYCHAIN_DONE=1 +fi + +unset userhome diff --git a/keychain.spec b/keychain.spec new file mode 100644 index 0000000..0074446 --- /dev/null +++ b/keychain.spec @@ -0,0 +1,52 @@ +Name: keychain +Summary: Agent manager for OpenSSH, ssh.com, Sun SSH, and GnuPG +Version: 2.9.8 +Release: %autorelease +License: GPL-2.0-only +URL: https://github.com/danielrobbins/keychain +Source0: https://github.com/funtoo/keychain/archive/%{version}/keychain-%{version}.tar.gz +Source1: keychain.sh +Source2: keychain.csh +Source3: README.Fedora +BuildArch: noarch +BuildRequires: make +BuildRequires: perl-podlators +Requires: findutils + + +%description +Keychain is a manager for OpenSSH, ssh.com, Sun SSH and GnuPG agents. +It acts as a front-end to the agents, allowing you to easily have one +long-running agent process per system, rather than per login session. +This dramatically reduces the number of times you need to enter your +passphrase from once per new login session to once every time your +local machine is rebooted. + +%prep +%setup -q +sed -i -e 's|/usr/ucb:||' keychain.sh + +%build +make keychain keychain.1 + +%install +rm -rf %{buildroot} +mkdir -p %{buildroot}%{_bindir} +mkdir -p %{buildroot}%{_sysconfdir}/profile.d +mkdir -p %{buildroot}%{_mandir}/man1 +install -pm 755 keychain %{buildroot}%{_bindir}/keychain +install -pm 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/profile.d/keychain.sh +install -pm 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/profile.d/keychain.csh +install -pm 644 keychain.1 %{buildroot}%{_mandir}/man1 +install -pm 644 %{SOURCE3} README.Fedora + +%files +%doc ChangeLog.md README.md README.Fedora +%license COPYING.txt +%config(noreplace) %{_sysconfdir}/profile.d/keychain.sh +%config(noreplace) %{_sysconfdir}/profile.d/keychain.csh +%{_bindir}/keychain +%{_mandir}/man1/keychain.1* + +%changelog +%autochangelog diff --git a/sources b/sources index e69de29..e9ff696 100644 --- a/sources +++ b/sources @@ -0,0 +1,2 @@ +SHA512 (keychain-2.9.2.tar.gz) = 1b4aa06037cb3f89f4cfa6a4c1a1104ca6a757175a636043b7fb4776773a81f20b38b058b86618b8e6b89cf7c61af86e6441da70ed92b0c18d31fb50b3dd8a96 +SHA512 (keychain-2.9.8.tar.gz) = f6677f1e365703bada641757bb7d06d8d578c48fb0350c7e3ea032c6c3b4e725f59fd10800ef02aadbf25e8e973135da5d4d3705270340dc75b6756a736a71af