[SECIOTSW-456] Change file trees considering adding this module in kernel 89/124189/5
authorSungbae Yoo <sungbae.yoo@samsung.com>
Mon, 10 Apr 2017 11:52:48 +0000 (20:52 +0900)
committerSungbae Yoo <sungbae.yoo@samsung.com>
Wed, 12 Apr 2017 06:03:56 +0000 (15:03 +0900)
When this module is added in kernel, "audittrail" directory
have only to be copied.

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Change-Id: I794ba71dbd66d2031ead6f82953cd4355fd46ad7

Makefile
audittrail/Kconfig [new file with mode: 0644]
audittrail/Makefile [new file with mode: 0644]
audittrail/log.h [new file with mode: 0644]
audittrail/main.c [new file with mode: 0644]
include/log.h [deleted file]
src/main.c [deleted file]

index c2d24a74f78a44ee422cd9e8189bace6f225725f..59a3d017dbf1a5a9ad6ffe59ab61d4ccf252446c 100644 (file)
--- a/Makefile
+++ b/Makefile
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
-EXTRA_CFLAGS := -I${PWD}/include
+CONFIG_AUDITTRAIL = m
+export CONFIG_AUDITTRAIL
 
-obj-m = audit-trail.o
-
-audit-trail-objs =     \
-       src/main.o
+obj-y = audittrail/
 
 all:
        $(MAKE) -C ${KERNEL_DEV_PATH} M=${PWD} modules
 
 install:
-       @cp audit-trail.ko ${KERNEL_MOD_PATH}/.
+       @cp audittrail/*.ko ${KERNEL_MOD_PATH}/.
 
 clean:
        $(MAKE) -C ${KERNEL_DEV_PATH} M=${PWD} clean
diff --git a/audittrail/Kconfig b/audittrail/Kconfig
new file mode 100644 (file)
index 0000000..77bdc1c
--- /dev/null
@@ -0,0 +1,11 @@
+config AUDITTRAIL
+       boolean "Enable Audit trail collector"
+       depends on SECURITYFS
+       default y
+       help
+         This option enables a system to collect various kinds of audit trail
+         (audit log). It has a directory which has two files.
+         First file is used for sending some commands such as registering
+         process itself as a consumer or provider.
+         Second files is used for getting or putting audit logs as a consumer
+         or provider.
diff --git a/audittrail/Makefile b/audittrail/Makefile
new file mode 100644 (file)
index 0000000..e4abc09
--- /dev/null
@@ -0,0 +1,2 @@
+obj-$(CONFIG_AUDITTRAIL) = audittrail.o
+audittrail-objs += main.o
diff --git a/audittrail/log.h b/audittrail/log.h
new file mode 100644 (file)
index 0000000..0bdf8d6
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+#ifndef __AUDITTRAIL_LOG_H__
+#define __AUDITTRAIL_LOG_H__
+
+#include <linux/printk.h>
+
+#define LOG_TAG "audit-trail: "
+
+#define FMT(fmt) fmt
+#define AUDITTRAIL_ERROR(fmt, ...) \
+       printk(KERN_ERR LOG_TAG FMT(fmt), ##__VA_ARGS__)
+#define AUDITTRAIL_WARN(fmt, ...) \
+       printk(KERN_WARNING LOG_TAG FMT(fmt), ##__VA_ARGS__)
+#define AUDITTRAIL_INFO(fmt, ...) \
+       printk(KERN_INFO LOG_TAG FMT(fmt), ##__VA_ARGS__)
+
+#endif  //! __AUDITTRAIL_LOG_H__
diff --git a/audittrail/main.c b/audittrail/main.c
new file mode 100644 (file)
index 0000000..047c165
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ *  Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+#include <linux/module.h>
+
+#include "log.h"
+
+int audittrail_init(void)
+{
+       AUDITTRAIL_INFO("loaded");
+
+       return 0;
+}
+
+void audittrail_exit(void)
+{
+       AUDITTRAIL_INFO("unloaded");
+}
+
+module_init(audittrail_init);
+module_exit(audittrail_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Sungbae Yoo");
diff --git a/include/log.h b/include/log.h
deleted file mode 100644 (file)
index 6a953b1..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-#ifndef __AUDIT_LOG_H__
-#define __AUDIT_LOG_H__
-
-#include <linux/printk.h>
-
-#define LOG_TAG "audit: "
-
-#define FMT(fmt) fmt
-#define AUDIT_ERROR(fmt, ...) \
-       printk(KERN_ERR LOG_TAG FMT(fmt), ##__VA_ARGS__)
-#define AUDIT_WARN(fmt, ...) \
-       printk(KERN_WARNING LOG_TAG FMT(fmt), ##__VA_ARGS__)
-#define AUDIT_INFO(fmt, ...) \
-       printk(KERN_INFO LOG_TAG FMT(fmt), ##__VA_ARGS__)
-
-#endif  //! __AUDIT_LOG_H__
diff --git a/src/main.c b/src/main.c
deleted file mode 100644 (file)
index 789e993..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-#include <linux/module.h>
-
-#include "log.h"
-
-int audit_trail_init(void)
-{
-       AUDIT_INFO("loaded");
-
-       return 0;
-}
-
-void audit_trail_exit(void)
-{
-       AUDIT_INFO("unloaded");
-}
-
-module_init(audit_trail_init);
-module_exit(audit_trail_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Sungbae Yoo");