Index: src/EBox/DHCP.pm.in =================================================================== --- src/EBox/DHCP.pm.in (revision 21295) +++ src/EBox/DHCP.pm.in (working copy) @@ -70,7 +70,7 @@ use constant DHCPCONFFILE => "@DHCPDCONF@"; use constant LEASEFILE => "@DHCPDLEASES@"; use constant PIDFILE => "@DHCPDPID@"; -use constant APPARMOR_PROFILE => '/etc/apparmor.d/usr.sbin.dhcpd3.zentyal'; +use constant APPARMOR_PROFILE => '/etc/apparmor.d/usr.sbin.dhcpd3'; use constant DHCP_SERVICE => "@DHCPD_SERVICE@"; use constant TFTP_SERVICE => "tftpd-hpa"; use constant APPARMOR_SERVICE => '/etc/init.d/apparmor'; @@ -118,7 +118,13 @@ 'file' => DHCPCONFFILE, 'module' => 'dhcp', 'reason' => __x('{server} configuration file', server => 'dhcpd'), - } + }, + { + 'file' => APPARMOR_PROFILE, + 'module' => 'dhcp', + 'reason' => __x('{server} apparmor profile, if installed', + server => 'dhcpd'), + }, ]; } @@ -140,11 +146,19 @@ # Method: enableActions # -# Override EBox::Module::Service::enableActions +# Override to disable dhcp3-server init.d script and overwrite the +# apparmor profile # +# Overrides: +# +# +# sub enableActions { + my ($self) = @_; + EBox::Sudo::root(EBox::Config::share() . '/ebox-dhcp/ebox-dhcp-enable'); + } # Method: _daemons @@ -1388,12 +1402,13 @@ $self->writeConfFile(DHCPCONFFILE, "dhcp/dhcpd.conf.mas", \@params); # Write apparmor profile if needed - if ( not -f APPARMOR_PROFILE ) { + if ( -x APPARMOR_SERVICE ) { $self->writeConfFile(APPARMOR_PROFILE, "dhcp/apparmor-dhcpd.profile.mas", [ ( 'keysFile' => $self->_keysFile(), 'confDir' => $self->IncludeDir() ) ]); EBox::Sudo::root(APPARMOR_SERVICE . ' restart'); } + } # Method: _setTFTPDConf Index: migration/0006_remove_zentyal_apparmor_profile.pl =================================================================== --- migration/0006_remove_zentyal_apparmor_profile.pl (revision 0) +++ migration/0006_remove_zentyal_apparmor_profile.pl (revision 0) @@ -0,0 +1,61 @@ +#!/usr/bin/perl + +# Copyright (C) 2011 eBox Technologies S.L. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License, version 2, as +# published by the Free Software Foundation. +# +# 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 + + +package EBox::Migration; +use base 'EBox::Migration::Base'; + +use strict; +use warnings; + +use EBox; +use EBox::Global; +use EBox::Sudo; + +use constant APPARMOR_PROFILE => '/etc/apparmor.d/usr.sbin.dhcpd3'; +use constant APPARMOR_SERVICE => '/etc/init.d/apparmor'; +use constant OLD_APPARMOR_PROFILE => '/etc/apparmor.d/usr.sbin.dhcpd3.zentyal'; + +sub runGConf +{ + my ($self) = @_; + + my $dhcpMod = $self->{gconfmodule}; + + if ( -e OLD_APPARMOR_PROFILE ) { + EBox::Sudo::root('rm -f ' . OLD_APPARMOR_PROFILE); + } + + if ( $dhcpMod->isEnabled() and (-x APPARMOR_SERVICE )) { + $dhcpMod->writeConfFile(APPARMOR_PROFILE, + 'dhcp/apparmor-dhcpd.profile.mas', + [ ( 'keysFile' => $dhcpMod->_keysFile(), + 'confDir' => $dhcpMod->IncludeDir() ) ]); + EBox::Sudo::root(APPARMOR_SERVICE . ' restart'); + } + +} + +EBox::init(); + +my $dhcpMod = EBox::Global->modInstance('dhcp'); +my $migration = __PACKAGE__->new( + 'gconfmodule' => $dhcpMod, + 'version' => 6 +); +$migration->execute(); + Index: migration/Makefile.am =================================================================== --- migration/Makefile.am (revision 21295) +++ migration/Makefile.am (working copy) @@ -4,7 +4,8 @@ nobase_Migrations_SCRIPTS = 0001_import_to_mvc.pl 0002_add_services.pl \ 0003_fixed_addr_obj.pl 0004_dyn_domains.pl \ - 0005_upgrade_apparmor_profile.pl + 0005_upgrade_apparmor_profile.pl \ + 0006_remove_zentyal_apparmor_profile.pl EXTRA_DIST = $(nobase_Migrations_SCRIPTS)