• Running kde4 inside virtualbox feels like running doom1 on 386 with 2MB RAM. It works and looks nice, but it is slow as hell. #

Powered by Twitter Tools.

One of most wanted features for new MSEC in Mandriva 2009.1 was the support for plugins. It is an interesting idea, as it allows to convert MSEC from a tool with fixed-and-controlled-by-msec-gods list of features into a utility that can be extended by anyone, adding their own functionality, or just implementing something specific to their organization, class, or environment.

Well, starting today, it is possible to do so :) . I just committed into cooker a new version of msec which supports plugins, and fully integrates them with other msec modules. I added a “sample” plugin (which will someday become the AppArmor plugin, but.. as it is still not working in cooker, I just added it to use as a proof-of-concept).

Plugins are automatically loaded by libmsec on startup, checking for all entries in config.PLUGINS_DIR configuration variable (which defaults to /usr/share/msec/plugins). For each file there, it is parsed as a python script, the plugin name is determined, and a plugin class is initialized with current msec settings (such as logging backend, chroot’ed configuration and list of modified system files). After that, the plugin is automatically added into the config.SETTINGS array, which correlates msec variables (such as ENABLE_APPARMOR) with corresponding callback function (libmsec.somefunction or, in our case, apparmor.enable_apparmor) and list of valid parameters (in our case, yes and no).

After that, everything continues normally. Msec processes the configuration parameters as usual, until it gets to the ENABLE_APPARMOR parameter. At this point, it detects that this functionality is provided by the apparmor plugin, and it is handled by enable_apparmor function. So it simply calls this function, in exactly the same way as any other libmsec element.

To show how simple a msec plugin can be, the following is the complete code of (not yet functional) AppArmor plugin:

#!/usr/bin/python
"""AppArmor plugin for msec """

# main plugin class name
PLUGIN = "apparmor"

# msec configuration
import config

class apparmor:
    def __init__(self, log=None, configfiles=None, root=None):
        """Initializes AppArmor plugin"""
        # initializing plugin with libmsec data
        self.log = log
        self.configfiles = configfiles
        self.root = root

        # configuring entry in global settings
        param = 'ENABLE_APPARMOR'
        callback = "%s.enable_apparmor" % PLUGIN
        valid_values = ['yes', 'no']
        config.SETTINGS[param] = (callback, valid_values)

        # insert entry into system security settings
        config.SETTINGS_SYSTEM.append(param)

    def enable_apparmor(self, params):
        """Enable AppArmor security framework on boot"""
        if self.log:
            #self.log.info("AppArmor plugin: not implemented yet!")
            pass

That’s it. Any python functionality can be added to the enable_apparmor function afterwards.

This is more like a proof-of-concept than complete plugin, but the remaining pieces will be polished soon. Keep visiting here for news :) .

Combining this with the possibility of creating custom msec frontends (right now we have command line frontend (msec) and a graphical one (msecgui)), the possibilities are endless. You could create a WEB frontend with just a few lines of python code (for example, using web.py or django), add plugins which enforce settings for your organization (for example, configure all user home directories to start with “user_” prefix, check periodically for changes into /usr/local/big_project/* files, synchronize ldap databases for offices, and so on).

  • por algum motivo a integração twitter/blog quebrou de vez esses dias… :( #

Powered by Twitter Tools.

  • 18:47 T-13 (and counting) para o carnaval! #

Automatically shipped by LoudTwitter

  • T-13 (and counting) para o carnaval! #

Powered by Twitter Tools.

  • 09:46 @olavojunior, querer eu quero faz tempo, o problema é $$$. Depois de andar num Land Rover, a minha vida nunca mais foi a mesma :) hehehe. #
  • 18:59 Estava em Salvador a exatamente 1 ano atrás… e exatamente 2 anos atrás estava nos EUA. E hoje estou trabalhando. hehehe. É a vida :) . #

Automatically shipped by LoudTwitter

  • 10:31 World of Goo acaba com a vida social.. #
  • 10:43 Living with XFCE 4.6 alpha. Arch Linux version uses the same source as Mandriva, but it just works WAAY faster… #
  • 11:00 @Capitulino, @coxande, i686. I just installed default packages for both Mandriva and Arch. I’m looking on what’s wrong with it right now :) . #
  • 12:45 @fabiocpn, o arch é um dos melhores que eu conheço. Mas é um rolling release, não tem versões fixas, tudo é atualizado diariamente. #
  • 17:44 @Capitulino, daqui a 1 mes tem Iron em SP! Esse é mais light :) . #
  • 18:09 haja paciencia.. (tinyurl.com/cxq3r8) #
  • 20:05 @mvkampen é f**a… a mesma coisa acontece com UFSCar, metade do campus é praticamente sede de PSTU.. #
  • 21:32 @olavojunior eu tentei fazer trilha (sem querer :) ) com o meu megane nesse fim da semana. Meu deus… como eu queria um jipe :) . hehehe. #
  • 21:35 Chegou um spam aqui: "Earn your PhD easily". Eles só podem estar de brincadeira!! Que raiva!!!! #

Automatically shipped by LoudTwitter

  • 08:41 @fabiocpn xulrunner nada, compila o openoffice para você ver :) #
  • 12:22 Dear God.. please, please, PLEASE make all perl code in the world burst in flames and disappear from this universe forever. #
  • 21:03 update do X do arch linux f***u com minha configuracao de teclado de uma vez por todas agora! #
  • 22:33 Um email que recebi hoje literalmente f***u com o meu carnaval. #
  • 22:45 @Capitulino, eu estou remoto de qualquer jeito.. No pior caso, código com àlcool no sangue sai até mais bonito! Principalmente em perl :) #

Automatically shipped by LoudTwitter

  • 18:40 400+ emails para email de mandriva over the weekend… e isso que só estamos na metade de domingo ainda… #
  • 23:48 Updated flickr with nice Ituverava photos. Powered by N95. And a bit of gimp+hugin :) . tinyurl.com/c32tvv #

Automatically shipped by LoudTwitter

  • 09:04 World of Goo nativo para Linux!! Mais um software comprado :) . #

Automatically shipped by LoudTwitter

© 2012 Eugeni's blog Suffusion theme by Sayontan Sinha