aboutsummaryrefslogtreecommitdiff
blob: 44b6b1e25bad137af529487e01bdffe827cc23b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=5

MY_PV="${PV/_/-}"

inherit eutils multilib user

DESCRIPTION="YubiPAM: PAM module for Yubikeys"
HOMEPAGE="http://www.securixlive.com/yubipam/"
SRC_URI="http://www.securixlive.com/download/yubipam/YubiPAM-${MY_PV}.tar.gz"
RESTRICT="nomirror"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~mips ~x86"
IUSE=""

DEPEND="sys-libs/pam"
RDEPEND="${DEPEND}"

DOCS=( README INSTALL RELEASE.NOTES )
S="${WORKDIR}/YubiPAM-${MY_PV}"

pkg_setup() {
	enewgroup yubiauth
}

src_prepare() {
	cd "${S}"

	epatch "${FILESDIR}/${P}-concat-twofactor.patch" || die "epatch failed"
	epatch "${FILESDIR}/${P}-resource.h.patch" || die "epatch failed"
}

src_install() {
	emake install DESTDIR="${ED}" PAMDIR="$(get_libdir)/security"
	find "${ED}" -type f -name \*.a -delete
	find "${ED}" -type f -name \*.la -delete

	#diropts -m0660 -g yubiauth
	#dodir /etc/yubikey || die "creation of state directory failed"
	touch "${T}"/yubikey
	insinto /etc
	doins "${T}"/yubikey

	fowners :yubiauth /etc/yubikey /sbin/yk_chkpwd
	fperms g+rw /etc/yubikey
	fperms g+s /sbin/yk_chkpwd
	
	dodoc "${DOCS[@]}"
}

pkg_postinst() {
	einfo "To enable YubiPAM for system authentication"
	einfo "edit your /etc/pam.d/system-auth to include:"
	einfo
	einfo "	 auth sufficient pam_yubikey.so"
	einfo
	einfo "... just before pam_unix.so"
	echo
	einfo "See included README for module parameters"
}