summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWenzong Fan <wenzong.fan@windriver.com>2017-08-24 17:21:52 +0800
committerLans Zhang <lans.zhang2008@gmail.com>2017-08-24 17:21:52 +0800
commit90fd1b523ad58a461de418bdbd97956e29897188 (patch)
tree0d1f737327ebb411b9396b125bde0a57d42ca840
parentc41b36ea73a25607d1fd1e9dc29ef6faf2be1be1 (diff)
downloadmeta-secure-core-90fd1b523ad58a461de418bdbd97956e29897188.tar.gz
meta-ids: initial commit for IDS support (#11)
* Add new layer for IDS support * Add package mtree to provide basic IDS functions Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
-rw-r--r--meta-ids/COPYING.MIT17
-rw-r--r--meta-ids/README.md9
-rw-r--r--meta-ids/conf/layer.conf14
-rw-r--r--meta-ids/recipes-base/packagegroups/packagegroup-ids.bb12
-rw-r--r--meta-ids/recipes-ids/mtree/mtree/configure.ac-automake-error.patch35
-rw-r--r--meta-ids/recipes-ids/mtree/mtree/mtree-getlogin.patch49
-rw-r--r--meta-ids/recipes-ids/mtree/mtree_git.bb21
7 files changed, 157 insertions, 0 deletions
diff --git a/meta-ids/COPYING.MIT b/meta-ids/COPYING.MIT
new file mode 100644
index 0000000..89de354
--- /dev/null
+++ b/meta-ids/COPYING.MIT
@@ -0,0 +1,17 @@
1Permission is hereby granted, free of charge, to any person obtaining a copy
2of this software and associated documentation files (the "Software"), to deal
3in the Software without restriction, including without limitation the rights
4to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5copies of the Software, and to permit persons to whom the Software is
6furnished to do so, subject to the following conditions:
7
8The above copyright notice and this permission notice shall be included in
9all copies or substantial portions of the Software.
10
11THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17THE SOFTWARE.
diff --git a/meta-ids/README.md b/meta-ids/README.md
new file mode 100644
index 0000000..e5901aa
--- /dev/null
+++ b/meta-ids/README.md
@@ -0,0 +1,9 @@
1### Intrusion Detection System (IDS)
2This layer provides functions for Intrusion Detection System (IDS) achievement.
3
4#### MTREE
5The mtree utility compares the file hierarchy rooted in the current directory
6against a specification read from the standard input. Messages are written
7to the standard output for any files whose characteristics do not match the
8specifications, or which are missing from either the file hierarchy or the
9specification.
diff --git a/meta-ids/conf/layer.conf b/meta-ids/conf/layer.conf
new file mode 100644
index 0000000..1f2e0a6
--- /dev/null
+++ b/meta-ids/conf/layer.conf
@@ -0,0 +1,14 @@
1# We have a conf and classes directory, add to BBPATH
2BBPATH .= ":${LAYERDIR}"
3
4# We have recipes-* directories, add to BBFILES
5BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
6 ${LAYERDIR}/recipes-*/*/*.bbappend"
7
8BBFILE_COLLECTIONS += "ids"
9BBFILE_PATTERN_ids = "^${LAYERDIR}/"
10BBFILE_PRIORITY_ids = "10"
11
12BBLAYERS_LAYERINDEX_NAME_ids = "meta-ids"
13
14LAYERDEPENDS_ids = "core"
diff --git a/meta-ids/recipes-base/packagegroups/packagegroup-ids.bb b/meta-ids/recipes-base/packagegroups/packagegroup-ids.bb
new file mode 100644
index 0000000..8f79c7a
--- /dev/null
+++ b/meta-ids/recipes-base/packagegroups/packagegroup-ids.bb
@@ -0,0 +1,12 @@
1DESCRIPTION = "Packagegroup for Intrusion Detection System (IDS) utilities."
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "\
4 file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
5 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420 \
6"
7
8inherit packagegroup
9
10RDEPENDS_${PN} += "\
11 mtree \
12"
diff --git a/meta-ids/recipes-ids/mtree/mtree/configure.ac-automake-error.patch b/meta-ids/recipes-ids/mtree/mtree/configure.ac-automake-error.patch
new file mode 100644
index 0000000..41d9025
--- /dev/null
+++ b/meta-ids/recipes-ids/mtree/mtree/configure.ac-automake-error.patch
@@ -0,0 +1,35 @@
1From 72916bebc694b821fd35f8721937fdd691049e3e Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Tue, 5 Aug 2014 21:48:17 -0700
4Subject: [PATCH] configure.ac: fixed automake error
5
6Fixed:
7configure.ac:29: installing 'scripts/compile'
8Makefile.am: error: required file './NEWS' not found
9Makefile.am: error: required file './AUTHORS' not found
10Makefile.am: error: required file './ChangeLog' not found
11autoreconf: automake failed with exit status: 1
12
13Upstream-Status: Pending
14
15Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
16---
17 configure.ac | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20diff --git a/configure.ac b/configure.ac
21index bf228df..dc10bff 100644
22--- a/configure.ac
23+++ b/configure.ac
24@@ -6,7 +6,7 @@
25
26 AC_INIT([mtree Utility for creating and verifying file hierarchies], [1.0.2], [http://www.freebsd.org/], [mtree])
27 AC_CONFIG_AUX_DIR(scripts)
28-AM_INIT_AUTOMAKE
29+AM_INIT_AUTOMAKE([foreign])
30 dnl AM_MAINTAINER_MODE
31 AC_PREREQ(2.59)
32 AC_REVISION($Id: configure.ac 15 2013-05-30 15:29:35Z archie.cobbs $)
33--
341.7.9.5
35
diff --git a/meta-ids/recipes-ids/mtree/mtree/mtree-getlogin.patch b/meta-ids/recipes-ids/mtree/mtree/mtree-getlogin.patch
new file mode 100644
index 0000000..35b0f8d
--- /dev/null
+++ b/meta-ids/recipes-ids/mtree/mtree/mtree-getlogin.patch
@@ -0,0 +1,49 @@
1Upstream-Status: Pending
2
3Handle NULL return from getlogin.
4
5Signed-off-by: Kai Kang <kai.kang@windriver.com>
6---
7diff --git a/create.c b/create.c
8index e2d24d3..583af9b 100644
9--- a/create.c
10+++ b/create.c
11@@ -77,6 +77,29 @@ static void output(int, int *, const char *, ...) __attribute__ ((__format__
12 static int statd(FTS *, FTSENT *, uid_t *, gid_t *, mode_t *, u_long *);
13 static void statf(int, FTSENT *);
14
15+char *my_getlogin()
16+{
17+ const char *s = getlogin();
18+ if (s && *s)
19+ return s;
20+
21+ struct passwd *p = getpwuid(geteuid());
22+ char *ss;
23+ if (p && p->pw_name) {
24+ if (asprintf(&ss,"(no controlling terminal) %s",p->pw_name) < 0) {
25+ perror("asprintf");
26+ return NULL;
27+ }
28+ } else {
29+ if (asprintf(&ss,"(no controlling terminal) #%d",geteuid()) < 0) {
30+ perror("asprintf");
31+ return NULL;
32+ }
33+ }
34+
35+ return ss;
36+}
37+
38 void
39 cwalk(void)
40 {
41@@ -92,7 +115,7 @@ cwalk(void)
42 (void)gethostname(host, sizeof(host));
43 (void)printf(
44 "#\t user: %s\n#\tmachine: %s\n",
45- getlogin(), host);
46+ my_getlogin(), host);
47 (void)printf(
48 "#\t tree: %s\n#\t date: %s",
49 fullpath, ctime(&cl));
diff --git a/meta-ids/recipes-ids/mtree/mtree_git.bb b/meta-ids/recipes-ids/mtree/mtree_git.bb
new file mode 100644
index 0000000..27fae3c
--- /dev/null
+++ b/meta-ids/recipes-ids/mtree/mtree_git.bb
@@ -0,0 +1,21 @@
1SUMMARY = "BSD directory hierarchy mapping tool"
2DESCRIPTION = "mtree compares a file hierarchy against a specification, creates a specification for a file hierarchy, or modifies a specification."
3
4SECTION = "utils"
5
6LICENSE = "BSD"
7LIC_FILES_CHKSUM = "file://COPYING;md5=bb19ea4eac951288efda4010c5c669a8"
8
9PV = "1.0.3+git${SRCPV}"
10
11SRC_URI = "git://github.com/archiecobbs/mtree-port.git \
12 file://mtree-getlogin.patch \
13 file://configure.ac-automake-error.patch \
14 "
15SRCREV = "4f3e901aea980fc9a78ac8692fa12a22328b1d4a"
16
17S = "${WORKDIR}/git"
18
19DEPENDS = "openssl"
20
21inherit autotools