capabilities: CAP_CHOWN might be required by many plugins opening UNIX sockets
authorTobias Brunner <tobias@strongswan.org>
Tue, 25 Jun 2013 07:03:00 +0000 (09:03 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 25 Jun 2013 15:16:33 +0000 (17:16 +0200)
But as the sockets will be created with the user/group of the running
process this might not be required as no change may be needed.

src/libcharon/plugins/duplicheck/duplicheck_plugin.c
src/libcharon/plugins/error_notify/error_notify_plugin.c
src/libcharon/plugins/ha/ha_plugin.c
src/libcharon/plugins/load_tester/load_tester_plugin.c
src/libcharon/plugins/lookip/lookip_plugin.c
src/libcharon/plugins/smp/smp.c
src/libcharon/plugins/stroke/stroke_plugin.c
src/libcharon/plugins/whitelist/whitelist_plugin.c

index 4d018db..d6e652d 100644 (file)
@@ -98,6 +98,12 @@ plugin_t *duplicheck_plugin_create()
                return NULL;
        }
 
+       if (!lib->caps->keep(lib->caps, CAP_CHOWN))
+       {       /* required to chown(2) notify socket */
+               DBG1(DBG_CFG, "duplicheck plugin requires CAP_CHOWN capability");
+               return NULL;
+       }
+
        INIT(this,
                .public = {
                        .plugin = {
index a1e4351..48b3d94 100644 (file)
@@ -92,6 +92,12 @@ plugin_t *error_notify_plugin_create()
 {
        private_error_notify_plugin_t *this;
 
+       if (!lib->caps->keep(lib->caps, CAP_CHOWN))
+       {       /* required to chown(2) notify socket */
+               DBG1(DBG_CFG, "error-notify plugin requires CAP_CHOWN capability");
+               return NULL;
+       }
+
        INIT(this,
                .public = {
                        .plugin = {
index 677985c..e7697dc 100644 (file)
@@ -179,6 +179,12 @@ plugin_t *ha_plugin_create()
                return NULL;
        }
 
+       if (!lib->caps->keep(lib->caps, CAP_CHOWN))
+       {       /* required to chown(2) control socket */
+               DBG1(DBG_CFG, "ha plugin requires CAP_CHOWN capability");
+               return NULL;
+       }
+
        INIT(this,
                .public = {
                        .plugin = {
index 6fee2bf..a32a2a4 100644 (file)
@@ -269,6 +269,12 @@ plugin_t *load_tester_plugin_create()
                return NULL;
        }
 
+       if (!lib->caps->keep(lib->caps, CAP_CHOWN))
+       {       /* required to chown(2) control socket */
+               DBG1(DBG_CFG, "load-tester plugin requires CAP_CHOWN capability");
+               return NULL;
+       }
+
        INIT(this,
                .public = {
                        .plugin = {
index 319d727..89bdad9 100644 (file)
@@ -92,6 +92,12 @@ plugin_t *lookip_plugin_create()
 {
        private_lookip_plugin_t *this;
 
+       if (!lib->caps->keep(lib->caps, CAP_CHOWN))
+       {       /* required to chown(2) control socket */
+               DBG1(DBG_CFG, "lookip plugin requires CAP_CHOWN capability");
+               return NULL;
+       }
+
        INIT(this,
                .public = {
                        .plugin = {
index 0c240cf..d13b822 100644 (file)
@@ -739,6 +739,12 @@ plugin_t *smp_plugin_create()
        private_smp_t *this;
        mode_t old;
 
+       if (!lib->caps->keep(lib->caps, CAP_CHOWN))
+       {       /* required to chown(2) control socket */
+               DBG1(DBG_CFG, "smp plugin requires CAP_CHOWN capability");
+               return NULL;
+       }
+
        INIT(this,
                .public = {
                        .plugin = {
index 4e47a12..6c4687f 100644 (file)
@@ -91,6 +91,12 @@ plugin_t *stroke_plugin_create()
 {
        private_stroke_plugin_t *this;
 
+       if (!lib->caps->keep(lib->caps, CAP_CHOWN))
+       {       /* required to chown(2) stroke socket */
+               DBG1(DBG_CFG, "stroke plugin requires CAP_CHOWN capability");
+               return NULL;
+       }
+
        INIT(this,
                .public = {
                        .plugin = {
index 5ba3e14..4f397d7 100644 (file)
@@ -92,6 +92,12 @@ plugin_t *whitelist_plugin_create()
 {
        private_whitelist_plugin_t *this;
 
+       if (!lib->caps->keep(lib->caps, CAP_CHOWN))
+       {       /* required to chown(2) control socket */
+               DBG1(DBG_CFG, "whitelist plugin requires CAP_CHOWN capability");
+               return NULL;
+       }
+
        INIT(this,
                .public = {
                        .plugin = {