summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/vlock
diff options
context:
space:
mode:
authorJackie Huang <jackie.huang@windriver.com>2017-08-16 13:37:40 +0800
committerMartin Jansa <Martin.Jansa@gmail.com>2017-08-28 11:04:13 +0200
commitf79465b9b4f56c87fb8a1635944cc18f3aa67c2a (patch)
tree185d6f7ab6c706e37b9c716a0a0ae8f6befa01af /meta-oe/recipes-extended/vlock
parent3cf117715fa3c007c77a3603d702c808d36ce852 (diff)
downloadmeta-openembedded-f79465b9b4f56c87fb8a1635944cc18f3aa67c2a.tar.gz
vlock: add new recipe
vlock is a program to lock one or more sessions on the Linux console. Signed-off-by: Jackie Huang <jackie.huang@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-extended/vlock')
-rw-r--r--meta-oe/recipes-extended/vlock/vlock-2.2.3/disable_vlockrc.patch37
-rw-r--r--meta-oe/recipes-extended/vlock/vlock-2.2.3/vlock-no_tally.patch107
-rw-r--r--meta-oe/recipes-extended/vlock/vlock-2.2.3/vlock_pam3
-rw-r--r--meta-oe/recipes-extended/vlock/vlock-2.2.3/vlock_pam_tally2_reset.patch19
-rw-r--r--meta-oe/recipes-extended/vlock/vlock_2.2.3.bb59
5 files changed, 225 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/vlock/vlock-2.2.3/disable_vlockrc.patch b/meta-oe/recipes-extended/vlock/vlock-2.2.3/disable_vlockrc.patch
new file mode 100644
index 000000000..ee0d074de
--- /dev/null
+++ b/meta-oe/recipes-extended/vlock/vlock-2.2.3/disable_vlockrc.patch
@@ -0,0 +1,37 @@
1Upstream-Status: Inappropriate [configuration]
2
3written by: Jeff Polk <jeff.polk@windriver.com>
4Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
5
6Index: vlock-2.2.2/man/vlock.1
7===================================================================
8--- vlock-2.2.2.orig/man/vlock.1 2010-07-26 14:12:42.000000000 -0400
9+++ vlock-2.2.2/man/vlock.1 2010-07-26 14:13:06.000000000 -0400
10@@ -111,11 +111,6 @@
11 to an invalid value or 0 no timeout is used. \fBWarning\fR: If this value is
12 too low, you may not be able to unlock your session.
13 .PP
14-.SH FILES
15-.B ~/.vlockrc
16-.IP
17-This file is read by \fBvlock\fR on startup if it exists. All the variables
18-mentioned above can be set here.
19 .SH SECURITY
20 See the SECURITY file in the \fBvlock\fR distribution for more information.
21 .PP
22Index: vlock-2.2.2/src/vlock.sh
23===================================================================
24--- vlock-2.2.2.orig/src/vlock.sh 2010-07-26 14:12:32.000000000 -0400
25+++ vlock-2.2.2/src/vlock.sh 2010-07-26 14:13:33.000000000 -0400
26@@ -35,11 +35,6 @@
27
28 ${VLOCK_ENTER_PROMPT}"
29
30-# Read user settings.
31-if [ -r "${HOME}/.vlockrc" ] ; then
32- . "${HOME}/.vlockrc"
33-fi
34-
35 # "Compile" time variables.
36 VLOCK_MAIN="%PREFIX%/sbin/vlock-main"
37 VLOCK_VERSION="%VLOCK_VERSION%"
diff --git a/meta-oe/recipes-extended/vlock/vlock-2.2.3/vlock-no_tally.patch b/meta-oe/recipes-extended/vlock/vlock-2.2.3/vlock-no_tally.patch
new file mode 100644
index 000000000..6e8a6a9fd
--- /dev/null
+++ b/meta-oe/recipes-extended/vlock/vlock-2.2.3/vlock-no_tally.patch
@@ -0,0 +1,107 @@
1Upstream-Status: Pending
2
3written by: Jeff Polk <jeff.polk@windriver.com>
4Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
5
6--- a/Makefile
7+++ b/Makefile
8@@ -126,6 +126,10 @@ ifeq ($(AUTH_METHOD),shadow)
9 vlock-main : override LDLIBS += $(CRYPT_LIB)
10 endif
11
12+ifneq ($(ENABLE_FAIL_COUNT),yes)
13+vlock-main.o : override CFLAGS += -DNO_FAIL_COUNT
14+endif
15+
16 ifeq ($(ENABLE_PLUGINS),yes)
17 vlock-main: plugins.o plugin.o module.o process.o script.o tsort.o list.o
18 # -rdynamic is needed so that the all plugin can access the symbols from console_switch.o
19--- a/configure
20+++ b/configure
21@@ -44,6 +44,7 @@ Optional Features:
22 --enable-shadow enable shadow authentication [disabled]
23 --enable-root-password enable unlogging with root password [enabled]
24 --enable-debug enable debugging
25+ --enable-fail-count enable failed login attempt summary [enabled]
26
27 Additional configuration:
28 --with-scripts=SCRIPTS enable the named scripts []
29@@ -78,6 +79,9 @@ enable_feature() {
30 root-password)
31 ENABLE_ROOT_PASSWORD="$2"
32 ;;
33+ fail-count)
34+ ENABLE_FAIL_COUNT="$2"
35+ ;;
36 pam|shadow)
37 if [ "$2" = "yes" ] ; then
38 if [ -n "$auth_method" ] && [ "$auth_method" != "$1" ] ; then
39@@ -232,6 +232,7 @@ set_defaults() {
40 AUTH_METHOD="pam"
41 ENABLE_ROOT_PASSWORD="yes"
42 ENABLE_PLUGINS="yes"
43+ ENABLE_FAIL_COUNT="yes"
44 SCRIPTS=""
45
46 VLOCK_GROUP="vlock"
47@@ -356,10 +356,14 @@ ENABLE_PLUGINS = ${ENABLE_PLUGINS}
48 # which plugins should be build
49 MODULES = ${MODULES}
50 # which scripts should be installed
51 SCRIPTS = ${SCRIPTS}
52
53+# display a summary of failed authentication attempts after successfully
54+# unlocking?
55+ENABLE_FAIL_COUNT = ${ENABLE_FAIL_COUNT}
56+
57 # root's group
58 ROOT_GROUP = ${ROOT_GROUP}
59
60 # group for privileged plugins
61 VLOCK_GROUP = ${VLOCK_GROUP}
62--- a/src/vlock-main.c
63+++ b/src/vlock-main.c
64@@ -111,7 +111,9 @@ static void restore_terminal(void)
65 (void) tcsetattr(STDIN_FILENO, TCSANOW, &term);
66 }
67
68+#ifdef ENABLE_FAIL_COUNT
69 static int auth_tries;
70+#endif /* ENABLE_FAIL_COUNT */
71
72 static void auth_loop(const char *username)
73 {
74@@ -181,7 +183,9 @@ static void auth_loop(const char *userna
75 }
76 #endif
77
78+#ifdef ENABLE_FAIL_COUNT
79 auth_tries++;
80+#endif /* ENABLE_FAIL_COUNT */
81 }
82
83 /* Free timeouts memory. */
84@@ -189,11 +193,13 @@ static void auth_loop(const char *userna
85 free(prompt_timeout);
86 }
87
88+#ifdef ENABLE_FAIL_COUNT
89 void display_auth_tries(void)
90 {
91 if (auth_tries > 0)
92 fprintf(stderr, "%d failed authentication %s.\n", auth_tries, auth_tries > 1 ? "tries" : "try");
93 }
94+#endif /* ENABLE_FAIL_COUNT */
95
96 #ifdef USE_PLUGINS
97 static void call_end_hook(void)
98@@ -216,7 +222,9 @@ int main(int argc, char *const argv[])
99 if (username == NULL)
100 fatal_perror("vlock: could not get username");
101
102+#ifdef ENABLE_FAIL_COUNT
103 ensure_atexit(display_auth_tries);
104+#endif /* ENABLE_FAIL_COUNT */
105
106 #ifdef USE_PLUGINS
107 for (int i = 1; i < argc; i++)
diff --git a/meta-oe/recipes-extended/vlock/vlock-2.2.3/vlock_pam b/meta-oe/recipes-extended/vlock/vlock-2.2.3/vlock_pam
new file mode 100644
index 000000000..a919682b0
--- /dev/null
+++ b/meta-oe/recipes-extended/vlock/vlock-2.2.3/vlock_pam
@@ -0,0 +1,3 @@
1# Use the default auth and account policies for vlock
2auth include common-auth
3account include common-account
diff --git a/meta-oe/recipes-extended/vlock/vlock-2.2.3/vlock_pam_tally2_reset.patch b/meta-oe/recipes-extended/vlock/vlock-2.2.3/vlock_pam_tally2_reset.patch
new file mode 100644
index 000000000..4ce0abc71
--- /dev/null
+++ b/meta-oe/recipes-extended/vlock/vlock-2.2.3/vlock_pam_tally2_reset.patch
@@ -0,0 +1,19 @@
1Upstream-Status: Pending
2
3written by: Jeff Polk <jeff.polk@windriver.com>
4Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
5
6Index: vlock-2.2.2/src/auth-pam.c
7===================================================================
8--- vlock-2.2.2.orig/src/auth-pam.c 2010-06-14 14:38:51.000000000 -0400
9+++ vlock-2.2.2/src/auth-pam.c 2010-06-14 14:39:12.000000000 -0400
10@@ -148,6 +148,9 @@
11
12 if (pam_status != PAM_SUCCESS) {
13 fprintf(stderr, "vlock: %s\n", pam_strerror(pamh, pam_status));
14+ } else {
15+ pam_status = pam_acct_mgmt(pamh, 0);
16+ if (pam_status == PAM_SUCCESS) pam_setcred(pamh, PAM_REINITIALIZE_CRED);
17 }
18
19 end:
diff --git a/meta-oe/recipes-extended/vlock/vlock_2.2.3.bb b/meta-oe/recipes-extended/vlock/vlock_2.2.3.bb
new file mode 100644
index 000000000..259d3a5e1
--- /dev/null
+++ b/meta-oe/recipes-extended/vlock/vlock_2.2.3.bb
@@ -0,0 +1,59 @@
1SUMMARY = "Virtual Console lock program"
2DESCRIPTION = "Sometimes a malicious local user could cause more problems \
3 than a sophisticated remote one. vlock is a program that locks one or more \
4 sessions on the Linux console to prevent attackers from gaining physical \
5 access to the machine. \
6 "
7SECTION = "utils"
8
9LICENSE = "GPLv2"
10LIC_FILES_CHKSUM = "file://COPYING;md5=a17cb0a873d252440acfdf9b3d0e7fbf"
11
12SRC_URI = "${GENTOO_MIRROR}/${BP}.tar.gz \
13 file://disable_vlockrc.patch \
14 file://vlock_pam_tally2_reset.patch \
15 file://vlock-no_tally.patch \
16 file://vlock_pam \
17 "
18
19SRC_URI[md5sum] = "378175c7692a8f288e65fd4dbf8a38eb"
20SRC_URI[sha256sum] = "85aa5aed1ae49351378a0bd527a013078f0f969372a63164b1944174ae1a5e39"
21
22inherit autotools-brokensep update-alternatives
23
24# authentification method: either pam or shadow
25PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', 'shadow', d)}"
26PACKAGECONFIG[pam] = "--enable-pam,,libpam,"
27PACKAGECONFIG[shadow] = "--enable-shadow,,shadow,"
28
29CFLAGS += "-Wall -W -pedantic -std=gnu99"
30
31do_configure () {
32 # The configure tries to use 'getent' to get the group
33 # info from the host, which should be avoided.
34 sed -i 's/\(ROOT_GROUP=\).*/\1"root"/' ${CONFIGURE_SCRIPT}
35
36 ${CONFIGURE_SCRIPT} \
37 VLOCK_GROUP=root \
38 ROOT_GROUP=root \
39 CC="${CC}" \
40 CFLAGS="${CFLAGS}" \
41 LDFLAGS="${LDFLAGS}" \
42 --prefix=${prefix} \
43 --libdir=${libdir} \
44 --mandir=${mandir} \
45 --with-modules="all.so new.so nosysrq.so ttyblank.so vesablank.so" \
46 --disable-root-password --enable-debug --disable-fail-count \
47 ${PACKAGECONFIG_CONFARGS}
48}
49
50do_install_append () {
51 if [ ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'yes', '', d)} = yes ]; then
52 install -d -m 0755 ${D}/${sysconfdir}/pam.d
53 install -m 0644 ${WORKDIR}/vlock_pam ${D}${sysconfdir}/pam.d/vlock
54 fi
55}
56
57ALTERNATIVE_${PN} = "vlock"
58ALTERNATIVE_PRIORITY = "60"
59ALTERNATIVE_LINK_NAME[vlock] = "${bindir}/vlock"