capabilities: CAP_CHOWN might be required by many plugins opening UNIX sockets
[strongswan.git] / src / libcharon / plugins / whitelist / whitelist_plugin.c
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 = {