3.3. Building Novell AppArmor Profiles with the YaST GUI

Open the YaST GUI by starting YaST+Novell AppArmor from the main menu. Novell AppArmor opens in the YaST interface as shown below:

[Note]Note

You can also access the YaST GUI by opening a terminal window, logging in as root, and entering yast2.

YaST's main controls for
       Novell AppArmor

In the right frame, you see several Novell AppArmor option icons. If Novell AppArmor does not display in the left frame of the YaST window or if the Novell AppArmor icons do not display, you might want to reinstall Novell AppArmor. The following actions are available from Novell AppArmor.

Click one of the following Novell AppArmor icons and proceed to the section referenced below:

Add Profile Wizard

For detailed steps, refer to Section 3.3.1, “Adding a Profile Using the Wizard” (↑Novell AppArmor 2.0 Administration Guide).

Manually Add Profile

Add a Novell AppArmor profile for an application on your system without the help of the wizard. For detailed steps, refer to Section 3.3.2, “Manually Adding a Profile” (↑Novell AppArmor 2.0 Administration Guide).

Edit Profile

Edits an existing Novell AppArmor profile on your system. For detailed steps, refer to Section 3.3.3, “Editing a Profile” (↑Novell AppArmor 2.0 Administration Guide).

Delete Profile

Deletes an existing Novell AppArmor profile from your system. For detailed steps, refer to Section 3.3.4, “Deleting a Profile” (↑Novell AppArmor 2.0 Administration Guide).

Update Profile Wizard

For detailed steps, refer to Section 3.3.5, “Updating Profiles from Syslog Entries” (↑Novell AppArmor 2.0 Administration Guide).

AppArmor Reports

For detailed steps, refer to Section 4.3, “Reports” (↑Novell AppArmor 2.0 Administration Guide).

AppArmor Control Panel

For detailed steps, refer to Section 3.3.6, “Managing Novell AppArmor and Security Event Status” (↑Novell AppArmor 2.0 Administration Guide).

3.3.1. Adding a Profile Using the Wizard

The Add Profile Wizard is designed to set up Novell AppArmor profiles using the Novell AppArmor profiling tools, genprof (Generate Profile) and logprof (Update Profiles From Learning Mode Log File). For more information about these tools, refer to Section 3.5.3, “Summary of Profiling Tools” (↑Novell AppArmor 2.0 Administration Guide).

  1. Stop the application before profiling it to ensure that the application start-up is included in the profile. To do this, make sure that the application or daemon is not running prior to profiling it.

    For example, enter /etc/init.d/PROGRAM stop in a terminal window while logged in as root, replacing PROGRAM is the name of the program to profile.

  2. If you have not done so already, in the YaST GUI, click Novell AppArmor+Add Profile Wizard.

    Choose the application to
	  profile
  3. Enter the name of the application or browse to the location of the program.

  4. Click Create. This runs a Novell AppArmor tool named autodep, which performs a static analysis of the program to profile and loads an approximate profile into Novell AppArmor module. For more information about autodep, refer to Section 3.5.3.1, “autodep” (↑Novell AppArmor 2.0 Administration Guide).

    The AppArmor Profiling Wizard window opens.

    The Novell AppArmor genprof Profiling
	  Wizard

    In the background, Novell AppArmor also sets the profile to learning mode. For more information about learning mode, refer to Section 3.5.3.2, “Complain or Learning Mode” (↑Novell AppArmor 2.0 Administration Guide).

  5. Run the application that is being profiled.

  6. Perform as many of the application functions as possible so learning mode can log the files and directories to which the program requires access to function properly.

  7. Click Scan System Log for Entries to Add to Profile to parse the learning mode log files. This generates a series of questions that you must answer to guide the wizard in generating the security profile.

    The questions fall into two categories:

    Each of these cases results in a series of questions that you must answer to add the resource to the profile or to add the program into the profile. The following two figures show an example of each case. Subsequent steps describe your options in answering these questions.

    The AppArmor Profiling Wizard window opens.

    Figure 3.1. Learning Mode Exception: Controlling Access to Specific Resources

    Learning Mode Exception: Controlling Access to Specific Resources

    Figure 3.2. Learning Mode Exception: Defining Execute Permissions for an Entry

    Learning Mode Exception: Defining Execute Permissions for an Entry
  8. The Add Profile Wizard begins suggesting directory path entries that have been accessed by the application you are profiling (as seen in Figure 3.1, “Learning Mode Exception: Controlling Access to Specific Resources” (↑Novell AppArmor 2.0 Administration Guide)) or requiring you to define execute permissions for entries (as seen in Figure 3.2, “Learning Mode Exception: Defining Execute Permissions for an Entry” (↑Novell AppArmor 2.0 Administration Guide)).

    1. For (↑Novell AppArmor 2.0 Administration Guide): From the following options, select the one that satisfies the request for access, which could be a suggested include, a particular globbed version of the path, or the actual pathname. Note that all of these options are not always available.

      #include

      The section of a Novell AppArmor profile that refers to an include file. Include files procure access permissions for programs. By using an include, you can give the program access to directory paths or files that are also required by other programs. Using includes can reduce the size of a profile. It is good practice to select includes when suggested.

      Globbed Version

      Accessed by clicking Glob as described in the next step. For information about globbing syntax, refer to Section 3.6, “Pathnames and Globbing” (↑Novell AppArmor 2.0 Administration Guide).

      Actual Pathname

      Literal path that the program needs access to so that it can run properly.

    2. For (↑Novell AppArmor 2.0 Administration Guide): From the following options, select the one that satisfies the request for access.

      Inherit

      Stay in the same security profile (parent's profile).

      Profile

      Requires that a separate profile exists for the executed program.

      Unconfined

      Executes the program without a security profile.

      [Warning]Warning

      Unless absolutely necessary, do not run unconfined. Choosing the Unconfined option executes the new program without any protection from AppArmor.

  9. After you select a directory path, you need to process it as an entry into the Novell AppArmor profile by clicking Allow or Deny. If you are not satisfied with the directory path entry as it is displayed, you can also Glob or Edit it.

    The following options are available to process the learning mode entries and to build the profile:

    Allow

    Grants the program access to the specified directory path entries. The Add Profile Wizard suggests file permission access. For more information about this, refer to Section 3.7, “File Permission Access Modes” (↑Novell AppArmor 2.0 Administration Guide).

    Deny

    Click Deny to prevent the program from accessing the specified directory path entries.

    Glob

    Clicking this modifies the directory path (by using wild cards) to include all files in the suggested entry directory. Double-clicking it grants access to all files and subdirectories beneath the one shown.

    For more information about globbing syntax, refer to Section 3.6, “Pathnames and Globbing” (↑Novell AppArmor 2.0 Administration Guide).

    Glob w/Ext

    Modifies the original directory path while retaining the filename extension. A single click causes /etc/apache2/file.ext to become /etc/apache2/*.ext, adding the wild card (asterisk) in place of the file name. This allows the program to access all files in the suggested directories that end with the .ext extension. When you double-click it, access is granted to all files (with the particular extension) and subdirectories beneath the one shown.

    Edit

    Enables editing of the highlighted line. The new (edited) line appears at the bottom of the list.

    Abort

    Aborts logprof, dumping all rule changes entered so far and leaving all profiles unmodified.

    Finish

    Closes logprof, saving all rule changes entered so far and modifying all profiles.

    Click Allow or Deny for each learning mode entry. These help build the Novell AppArmor profile.

    [Note]Note

    The number of learning mode entries corresponds to the complexity of the application.

    Repeat the previous steps if you need to execute more functionality of your application.

    When you are done, click Finish. In the following pop-up, click Yes to exit the Profile Creation Wizard. The profile is saved and loaded into the Novell AppArmor module.

3.3.2. Manually Adding a Profile

Novell AppArmor enables you to create a Novell AppArmor profile by manually adding entries into the profile. You simply need to select the application for which to create a profile, then add entries.

  1. To add a profile, open YaST+Novell AppArmor. The Novell AppArmor interface opens.

  2. In Novell AppArmor, click Manually Add Profile (see Figure 3.3, “Manually Adding a Profile: Select Application” (↑Novell AppArmor 2.0 Administration Guide)).

    Figure 3.3. Manually Adding a Profile: Select Application

    Selecting an application to
	  create a profile for
  3. Browse your system to find the application for which to create a profile.

  4. When you find the profile, select it and click Open. A basic, empty profile appears in the Novell AppArmor Profile Dialog window.

    Manually creating a profile
  5. In the AppArmor Profile Dialog window, you can add, edit, or delete Novell AppArmor profile entries by clicking the corresponding buttons and referring to the following sections: Section 3.3.2.1, “Adding an Entry” (↑Novell AppArmor 2.0 Administration Guide), Section 3.3.2.2, “Editing an Entry” (↑Novell AppArmor 2.0 Administration Guide), or Section 3.3.2.2, “Editing an Entry” (↑Novell AppArmor 2.0 Administration Guide).

  6. When you are finished, click Done.

3.3.2.1. Adding an Entry

This section explains the Add Entry option that can be found in Section 3.3.2, “Manually Adding a Profile” (↑Novell AppArmor 2.0 Administration Guide) or Section 3.3.3, “Editing a Profile” (↑Novell AppArmor 2.0 Administration Guide). When you select Add Entry, a drop-down list displays the types of entries you can add to the Novell AppArmor profile.

3.3.2.2. Editing an Entry

This section explains the Edit Entry option that can be found in Section 3.3.2, “Manually Adding a Profile” (↑Novell AppArmor 2.0 Administration Guide) or Section 3.3.3, “Editing a Profile” (↑Novell AppArmor 2.0 Administration Guide). When you select Edit Entry, the file browser pop-up window opens. From here, you can edit the selected entry.

In the pop-up window, specify the absolute path of a file, including the type of access permitted. You can use globbing if necessary. When finished, click OK.

For globbing information, refer to Section 3.6, “Pathnames and Globbing” (↑Novell AppArmor 2.0 Administration Guide). For file access permission information, refer to Section 3.7, “File Permission Access Modes” (↑Novell AppArmor 2.0 Administration Guide).

Edit an entry

3.3.2.3. Deleting an Entry

This section explains the Delete Entry option that can be found in the Section 3.3.2, “Manually Adding a Profile” (↑Novell AppArmor 2.0 Administration Guide) or Section 3.3.3, “Editing a Profile” (↑Novell AppArmor 2.0 Administration Guide). When you select an entry then select Delete Entry, Novell AppArmor removes the profile entry that you have selected.

3.3.3. Editing a Profile

Novell AppArmor enables you to manually edit Novell AppArmor profiles by adding, editing, or deleting entries. You simply need to select the profile then add, edit, or delete entries. To edit a profile, follow these steps:

  1. Open YaST+Novell AppArmor.

  2. In Novell AppArmor, click Edit Profile. The Edit Profile—Choose Profile to Edit window opens.

    Choose profile to edit
  3. From the list of profiled programs, select the profile to edit.

  4. Click Next. The AppArmor Profile Dialog window displays the profile.

    AppArmor profile dialog
  5. In the AppArmor Profile Dialog window, you can add, edit, or delete Novell AppArmor profile entries by clicking the corresponding buttons and referring to the following sections: Section 3.3.2.1, “Adding an Entry” (↑Novell AppArmor 2.0 Administration Guide), Section 3.3.2.2, “Editing an Entry” (↑Novell AppArmor 2.0 Administration Guide), or Section 3.3.2.3, “Deleting an Entry” (↑Novell AppArmor 2.0 Administration Guide).

  6. When you are finished, click Done.

  7. In the pop-up that appears, click Yes to confirm your changes to the profile.

3.3.4. Deleting a Profile

Novell AppArmor enables you to delete a Novell AppArmor profile manually. You simply need to select the application for which to delete a profile then delete it as follows:

  1. Open the YaST+Novell AppArmor. The Novell AppArmor interface displays.

  2. In Novell AppArmor, click Delete Profile icon. The Delete Profile—Choose Profile to Delete window opens.

    Delete profile, choose profile
	  to delete
  3. Select the profile to delete.

  4. Click Next.

  5. In the pop-up that opens, click Yes to delete the profile.

3.3.5. Updating Profiles from Syslog Entries

The Novell AppArmor Profile wizard uses logprof, the tool that scans log files and enables you to update profiles. logprof tracks messages from the Novell AppArmor module that represent exceptions for all profiles running on your system. These exceptions represent the behavior of the profiled application that is outside of the profile definition for the program. You can add the new behavior to the relevant profile by selecting the suggested profile entry.

  1. Open YaST+Novell AppArmor. The Novell AppArmor interface displays.

  2. In Novell AppArmor, click Update Profile Wizard. The AppArmor Profile Wizard window displays.

    The AppArmor profile wizard

    Running the Update Profile Wizard (logprof) parses the learning mode log files. This generates a series of questions that you must answer to guide logprof to generate the security profile.

    The questions fall into two categories:

    Each of these cases results in a question that you must answer that enables you to add the resource or program into the profile. The following two figures show an example of each case. Subsequent steps describe your options in answering these questions.

    Figure 3.4. Learning Mode Exception: Controlling Access to Specific Resources

    Learning Mode Exception: Controlling Access to Specific Resources

    Figure 3.5. Learning Mode Exception: Defining Execute Permissions for an Entry

    Learning Mode Exception: Defining Execute Permissions for an Entry
  3. logprof begins suggesting directory path entries that have been accessed by the application you are profiling (as seen in Figure 3.4, “Learning Mode Exception: Controlling Access to Specific Resources” (↑Novell AppArmor 2.0 Administration Guide)) or requiring you to define execute permissions for entries (as seen in Figure 3.5, “Learning Mode Exception: Defining Execute Permissions for an Entry” (↑Novell AppArmor 2.0 Administration Guide)).

    1. For Figure 3.4, “Learning Mode Exception: Controlling Access to Specific Resources” (↑Novell AppArmor 2.0 Administration Guide): From the following options, select the one that satisfies the request for access, which could be a suggested include, a particular globbed version of the path, or the actual pathname. Note that all of these options are not always available.

      #include

      The section of a Novell AppArmor profile that refers to an include file. Include files fetch access permissions for programs. By using an include, you can give the program access to directory paths or files that are also required by other programs. Using includes can reduce the size of a profile. It is good practice to select includes when suggested.

      Globbed Version

      Accessed by clicking Glob as described in the next step. For information about globbing syntax, refer to Section 3.6, “Pathnames and Globbing” (↑Novell AppArmor 2.0 Administration Guide).

      Actual Pathname

      This is the literal path to which the program needs access so that it can run properly.

    2. For Figure 3.5, “Learning Mode Exception: Defining Execute Permissions for an Entry” (↑Novell AppArmor 2.0 Administration Guide): Select the one that satisfies the request for access by choosing one of the following:

      Inherit

      stay in the same security profile (parent's profile)

      Profile

      requires that a separate profile exists for the executed program

      Unconfined

      program executed without a security profile

      [Warning]Warning

      Unless absolutely necessary, do not run unconfined. Choosing the Unconfined option executes the new program without any protection from AppArmor.

  4. After you select a directory path, you need to process it as an entry into the Novell AppArmor profile by clicking Allow or Deny. If you are not satisfied with the directory path entry as it is displayed, you can also Glob or Edit it.

    The following options are available to process the learning mode entries and to build the profile:

    Allow

    Grant the program access to the specified directory path entries. The Profile Creation Wizard suggests file permission access. For more information about this, refer to Section 3.7, “File Permission Access Modes” (↑Novell AppArmor 2.0 Administration Guide).

    Deny

    Click Deny to prevent the program from accessing the specified directory path entries.

    Glob

    Clicking this modifies the directory path (by using wild cards) to include all files in the suggested entry directory. Double-clicking it grants access to all files and subdirectories beneath the one shown.

    For more information about globbing syntax, refer to Section 3.6, “Pathnames and Globbing” (↑Novell AppArmor 2.0 Administration Guide).

    Glob w/Ext

    Modify the original directory path while retaining the filename extension. A single click causes /etc/apache2/file.ext to become /etc/apache2/*.ext, adding the wild card (asterisk) in place of the filename. This allows the program to access all files in the suggested directories that end with the .ext extension. When you double-click it, access is granted to all files (with the particular extension) and subdirectories beneath the one shown.

    Edit

    Enable editing of the highlighted line. The new (edited) line appears at the bottom of the list.

    Abort

    Abort logprof, dumping all rule changes entered so far and leaving all profiles unmodified.

    Finish

    Close logprof, saving all rule changes entered so far and modifying all profiles.

    Click Allow or Deny for each learning mode entry. These help build the Novell AppArmor profile.

    [Note]Note

    The number of learning mode entries corresponds to the complexity of the application.

    Repeat the previous steps if you need to execute more functionality of your application.

    When you are done, click Finish. In the following pop-up, click Yes to exit the Profile Creation Wizard. The profile is saved and loaded into the Novell AppArmor module.

3.3.6. Managing Novell AppArmor and Security Event Status

Novell AppArmor enables you to change the status of Novell AppArmor and configure event notification.

Changing Novell AppArmor Status

You can change the status of Novell AppArmor by enabling or disabling it. Enabling Novell AppArmor protects your system from potential program exploitation. Disabling Novell AppArmor, even if your profiles have been set up, removes protection from your system.

Configuring Event Notification

You can determine how and when you are notified when system security events occur.

[Note]Note

You must set up a mail server on your SUSE Linux server that can send outgoing mail using the single mail transfer protocol (smtp). For example, postfix or exim, in order for event notification to work.

To either configure event notification or change the status of Novell AppArmor, perform the following steps:

  1. When you click Novell AppArmor Control Panel, the Novell AppArmor Configuration window appears as shown below:

    The AppArmor control
	  panel
  2. From the AppArmor Configuration screen, determine whether Novell AppArmor and security event notification are running by looking for a status message that reads enabled.

3.3.6.1. Changing Novell AppArmor Status

When you change the status of Novell AppArmor, you set it to enable or disable. When Novell AppArmor is enabled, it is installed, running and enforcing the Novell AppArmor security policies.

  1. To enable Novell AppArmor, open YaST+Novell AppArmor. The Novell AppArmor main menu opens.

  2. In the Novell AppArmor main menu, click AppArmor Control Panel. The AppArmor Configuration window appears.

    AppArmor configuration
	   window
  3. In the Enable Novell AppArmor section of the window, click Configure. The Enable Novell AppArmor dialog box opens.

    Enable AppArmor
  4. Enable Novell AppArmor by selecting Enable or disable Novell AppArmor by selecting Disable. Then click OK.

  5. Click Done in the AppArmor Configuration window.

  6. Click File+Quit in the YaST Control Center.