3 Kl�f�; � @ s� d Z ddlZddlZddljZyddlT W n Y nX ddlmZ ddlmZ ddlm Z ddlm Z dd lmZ dd lmZ dZ dZdZG dd � d �Zdefdd�Zdd� ZG dd� d�Zdd� ZdS )z> classes and algorithms for the generation of SELinux policy. � N)�*� )� refpolicy)�objectmodel)�access)� interfaces)�matching)�util� c @ s� e Zd ZdZddd�Zd dd�Zd!dd �Zefd d�Zdd � Z dd� Z dd� Zd"dd�Zdd� Z dd� Zdd� Zdd� Zdd� ZdS )#�PolicyGeneratora� Generate a reference policy module from access vectors. PolicyGenerator generates a new reference policy module or updates an existing module based on requested access in the form of access vectors. It generates allow rules and optionally module require statements, reference policy interfaces, and extended permission access vector rules. By default only allow rules are generated. The methods .set_gen_refpol, .set_gen_requires and .set_gen_xperms turns on interface generation, requires generation, and xperms rules genration respectively. PolicyGenerator can also optionally add comments explaining why a particular access was allowed based on the audit messages that generated the access. The access vectors passed in must have the .audit_msgs field set correctly and .explain set to SHORT|LONG_EXPLANATION to enable this feature. The module created by PolicyGenerator can be passed to output.ModuleWriter to output a text representation. Nc C s>