summaryrefslogtreecommitdiff
path: root/src/libimcv/plugins/imc_os
diff options
context:
space:
mode:
Diffstat (limited to 'src/libimcv/plugins/imc_os')
-rw-r--r--src/libimcv/plugins/imc_os/Makefile.am9
-rw-r--r--src/libimcv/plugins/imc_os/Makefile.in73
-rw-r--r--src/libimcv/plugins/imc_os/imc_os.c99
3 files changed, 126 insertions, 55 deletions
diff --git a/src/libimcv/plugins/imc_os/Makefile.am b/src/libimcv/plugins/imc_os/Makefile.am
index 0bfe776a5..83c46558b 100644
--- a/src/libimcv/plugins/imc_os/Makefile.am
+++ b/src/libimcv/plugins/imc_os/Makefile.am
@@ -1,8 +1,10 @@
-
-INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libtncif \
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libtncif \
-I$(top_srcdir)/src/libimcv
-AM_CFLAGS = -rdynamic
+AM_CFLAGS = \
+ -rdynamic
imcv_LTLIBRARIES = imc-os.la
@@ -12,4 +14,3 @@ imc_os_la_LIBADD = $(top_builddir)/src/libimcv/libimcv.la \
imc_os_la_SOURCES = imc_os.c imc_os_state.h imc_os_state.c
imc_os_la_LDFLAGS = -module -avoid-version
-
diff --git a/src/libimcv/plugins/imc_os/Makefile.in b/src/libimcv/plugins/imc_os/Makefile.in
index 351e659ad..729fa8478 100644
--- a/src/libimcv/plugins/imc_os/Makefile.in
+++ b/src/libimcv/plugins/imc_os/Makefile.in
@@ -62,7 +62,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/config/libtool.m4 \
$(top_srcdir)/m4/macros/with.m4 \
$(top_srcdir)/m4/macros/enable-disable.m4 \
$(top_srcdir)/m4/macros/add-plugin.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -102,7 +102,10 @@ imc_os_la_DEPENDENCIES = $(top_builddir)/src/libimcv/libimcv.la \
$(top_builddir)/src/libstrongswan/libstrongswan.la
am_imc_os_la_OBJECTS = imc_os.lo imc_os_state.lo
imc_os_la_OBJECTS = $(am_imc_os_la_OBJECTS)
-imc_os_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+imc_os_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(imc_os_la_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
@@ -111,13 +114,26 @@ am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(imc_os_la_SOURCES)
DIST_SOURCES = $(imc_os_la_SOURCES)
am__can_run_installinfo = \
@@ -131,6 +147,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
@@ -143,6 +160,8 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHECK_CFLAGS = @CHECK_CFLAGS@
CHECK_LIBS = @CHECK_LIBS@
+COVERAGE_CFLAGS = @COVERAGE_CFLAGS@
+COVERAGE_LDFLAGS = @COVERAGE_LDFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
@@ -158,6 +177,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
+GENHTML = @GENHTML@
GPERF = @GPERF@
GPRBUILD = @GPRBUILD@
GREP = @GREP@
@@ -166,6 +186,7 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LCOV = @LCOV@
LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
@@ -212,6 +233,7 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOCKLIB = @SOCKLIB@
STRIP = @STRIP@
+UNWINDLIB = @UNWINDLIB@
VERSION = @VERSION@
YACC = @YACC@
YFLAGS = @YFLAGS@
@@ -240,6 +262,7 @@ charon_natt_port = @charon_natt_port@
charon_plugins = @charon_plugins@
charon_udp_port = @charon_udp_port@
clearsilver_LIBS = @clearsilver_LIBS@
+cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
dbusservicedir = @dbusservicedir@
@@ -317,10 +340,14 @@ top_srcdir = @top_srcdir@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
-INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libtncif \
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libtncif \
-I$(top_srcdir)/src/libimcv
-AM_CFLAGS = -rdynamic
+AM_CFLAGS = \
+ -rdynamic
+
imcv_LTLIBRARIES = imc-os.la
imc_os_la_LIBADD = $(top_builddir)/src/libimcv/libimcv.la \
$(top_builddir)/src/libstrongswan/libstrongswan.la
@@ -394,7 +421,7 @@ clean-imcvLTLIBRARIES:
rm -f "$${dir}/so_locations"; \
done
imc-os.la: $(imc_os_la_OBJECTS) $(imc_os_la_DEPENDENCIES) $(EXTRA_imc_os_la_DEPENDENCIES)
- $(imc_os_la_LINK) -rpath $(imcvdir) $(imc_os_la_OBJECTS) $(imc_os_la_LIBADD) $(LIBS)
+ $(AM_V_CCLD)$(imc_os_la_LINK) -rpath $(imcvdir) $(imc_os_la_OBJECTS) $(imc_os_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -406,25 +433,25 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imc_os_state.Plo@am__quote@
.c.o:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
.c.obj:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
-@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
diff --git a/src/libimcv/plugins/imc_os/imc_os.c b/src/libimcv/plugins/imc_os/imc_os.c
index f6e205ce7..2558be9f8 100644
--- a/src/libimcv/plugins/imc_os/imc_os.c
+++ b/src/libimcv/plugins/imc_os/imc_os.c
@@ -30,6 +30,7 @@
#include <ita/ita_attr_get_settings.h>
#include <ita/ita_attr_settings.h>
#include <ita/ita_attr_angel.h>
+#include <ita/ita_attr_device_id.h>
#include <os_info/os_info.h>
#include <tncif_pa_subtypes.h>
@@ -213,7 +214,7 @@ static void add_fwd_enabled(imc_msg_t *msg)
os_fwd_status_t fwd_status;
fwd_status = os->get_fwd_status(os);
- DBG1(DBG_IMC, "IPv4 forwarding status: %N",
+ DBG1(DBG_IMC, "IPv4 forwarding is %N",
os_fwd_status_names, fwd_status);
attr = ietf_attr_fwd_enabled_create(fwd_status);
msg->add_attribute(msg, attr);
@@ -226,12 +227,43 @@ static void add_default_pwd_enabled(imc_msg_t *msg)
{
pa_tnc_attr_t *attr;
- DBG1(DBG_IMC, "factory default password: disabled");
+ DBG1(DBG_IMC, "factory default password is disabled");
attr = ietf_attr_default_pwd_enabled_create(FALSE);
msg->add_attribute(msg, attr);
}
/**
+ * Add ITA Device ID attribute to the send queue
+ */
+static void add_device_id(imc_msg_t *msg)
+{
+ pa_tnc_attr_t *attr;
+ chunk_t value;
+ char *name;
+
+ name = os->get_type(os) == OS_TYPE_ANDROID ?
+ "android_id" : "/var/lib/dbus/machine-id";
+ value = os->get_setting(os, name);
+
+ if (value.len == 0)
+ {
+ DBG1(DBG_IMC, "no device ID available");
+ return;
+ }
+
+ /* trim trailing newline character */
+ if (value.ptr[value.len - 1] == '\n')
+ {
+ value.len--;
+ }
+
+ DBG1(DBG_IMC, "device ID is %.*s", value.len, value.ptr);
+ attr = ita_attr_device_id_create(value);
+ msg->add_attribute(msg, attr);
+ free(value.ptr);
+}
+
+/**
* Add an IETF Installed Packages attribute to the send queue
*/
static void add_installed_packages(imc_state_t *state, imc_msg_t *msg)
@@ -365,6 +397,7 @@ TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
add_op_status(out_msg);
add_fwd_enabled(out_msg);
add_default_pwd_enabled(out_msg);
+ add_device_id(out_msg);
/* send PA-TNC message with the excl flag not set */
result = out_msg->send(out_msg, FALSE);
@@ -410,35 +443,45 @@ static TNC_Result receive_message(imc_state_t *state, imc_msg_t *in_msg)
e = attr_cast->create_enumerator(attr_cast);
while (e->enumerate(e, &entry))
{
- if (entry->vendor_id != PEN_IETF)
+ if (entry->vendor_id == PEN_IETF)
{
- continue;
+ switch (entry->type)
+ {
+ case IETF_ATTR_PRODUCT_INFORMATION:
+ add_product_info(out_msg);
+ break;
+ case IETF_ATTR_STRING_VERSION:
+ add_string_version(out_msg);
+ break;
+ case IETF_ATTR_NUMERIC_VERSION:
+ add_numeric_version(out_msg);
+ break;
+ case IETF_ATTR_OPERATIONAL_STATUS:
+ add_op_status(out_msg);
+ break;
+ case IETF_ATTR_FORWARDING_ENABLED:
+ add_fwd_enabled(out_msg);
+ break;
+ case IETF_ATTR_FACTORY_DEFAULT_PWD_ENABLED:
+ add_default_pwd_enabled(out_msg);
+ break;
+ case IETF_ATTR_INSTALLED_PACKAGES:
+ add_installed_packages(state, out_msg);
+ break;
+ default:
+ break;
+ }
}
- switch (entry->type)
+ else if (entry->vendor_id == PEN_ITA)
{
- case IETF_ATTR_PRODUCT_INFORMATION:
- add_product_info(out_msg);
- break;
- case IETF_ATTR_STRING_VERSION:
- add_string_version(out_msg);
- break;
- case IETF_ATTR_NUMERIC_VERSION:
- add_numeric_version(out_msg);
- break;
- case IETF_ATTR_OPERATIONAL_STATUS:
- add_op_status(out_msg);
- break;
- case IETF_ATTR_FORWARDING_ENABLED:
- add_fwd_enabled(out_msg);
- break;
- case IETF_ATTR_FACTORY_DEFAULT_PWD_ENABLED:
- add_default_pwd_enabled(out_msg);
- break;
- case IETF_ATTR_INSTALLED_PACKAGES:
- add_installed_packages(state, out_msg);
- break;
- default:
- break;
+ switch (entry->type)
+ {
+ case ITA_ATTR_DEVICE_ID:
+ add_device_id(out_msg);
+ break;
+ default:
+ break;
+ }
}
}
e->destroy(e);