OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

4.4. Samba AppArmor Profile


Ubuntu comes with the AppArmor security module, which provides mandatory access controls. The default AppArmor profile for Samba will need to be adapted to your configuration. For more details on using AppArmor see Section 4, “AppArmor” [p. 194].


There are default AppArmor profiles for /usr/sbin/smbd and /usr/sbin/nmbd, the Samba daemon binaries, as part of the apparmor-profiles packages. To install the package, from a terminal prompt enter:


sudo apt install apparmor-profiles apparmor-utils


image

This package contains profiles for several other binaries.


By default the profiles for smbd and nmbd are in complain mode allowing Samba to work without modifying the profile, and only logging errors. To place the smbd profile into enforce mode, and have Samba work as expected, the profile will need to be modified to reflect any directories that are shared.


Edit /etc/apparmor.d/usr.sbin.smbd adding information for [share] from the file server example:


/srv/samba/share/ r,

/srv/samba/share/** rwkix,


Now place the profile into enforce and reload it:


sudo aa-enforce /usr/sbin/smbd

cat /etc/apparmor.d/usr.sbin.smbd | sudo apparmor_parser -r


You should now be able to read, write, and execute files in the shared directory as normal, and the smbd binary will have access to only the configured files and directories. Be sure to add entries for each directory you configure Samba to share. Also, any errors will be logged to /var/log/syslog.


Top OS Cloud Computing at OnWorks: