Changeset 1964

Show
Ignore:
Timestamp:
02/29/08 13:29:52 (9 months ago)
Author:
dsugar
Message:

include the reason for the av failure

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/mls/framework-plugin/src/com/tresys/framework/compiler/policy/Component.java

    r1963 r1964  
    2525import com.tresys.framework.compiler.AbstractToken; 
    2626import com.tresys.framework.compiler.linkage.Linkage; 
     27import com.tresys.framework.compiler.mls.MLSSupport; 
    2728 
    2829/** 
     
    214215         * @return 
    215216         */ 
    216         public String getSensitivity (
     217        public String getSensitivity (MLSSupport i_support
    217218        { 
    218219                return "s0"; 
     
    223224         * @return 
    224225         */ 
    225         public String getFullContext (
     226        public String getFullContext (MLSSupport i_support
    226227        { 
    227228                StringBuffer buf = new StringBuffer (); 
     
    231232                buf.append (':'); 
    232233                buf.append (getType ()); 
    233                 buf.append (':'); 
    234                 buf.append (getSensitivity ()); 
     234                 
     235                if (i_support != null) 
     236                { 
     237                        buf.append (':'); 
     238                        buf.append (getSensitivity (i_support)); 
     239                } 
    235240                 
    236241                return buf.toString (); 
  • branches/mls/framework-plugin/src/com/tresys/framework/compiler/policy/ComponentWithDictObjects.java

    r1901 r1964  
    2626import com.tresys.framework.compiler.dictionary.SysResourceState; 
    2727import com.tresys.framework.compiler.linkage.Linkage; 
     28import com.tresys.framework.compiler.mls.MLSLevel; 
     29import com.tresys.framework.compiler.mls.MLSSupport; 
    2830import com.tresys.framework.compiler.systemResources.DirResource; 
    2931import com.tresys.framework.compiler.systemResources.SystemResource; 
     
    321323        } 
    322324 
     325         
     326        /** 
     327         * get the sensitivity portion of the context 
     328         * @return 
     329         */ 
     330        public String getSensitivity (MLSSupport i_support) 
     331        { 
     332                if (i_support != null) 
     333                { 
     334                        MLSLevel mlsLevel = i_support.getLevel (getMLSLabel ()); 
     335                        if (mlsLevel != null) 
     336                                return mlsLevel.getRange (); 
     337                } 
     338 
     339                return "s0"; 
     340        } 
     341 
    323342        public boolean Validate(Linkage linkage)  
    324343        { 
  • branches/mls/framework-plugin/src/com/tresys/framework/compiler/policy/EntrypointResource.java

    r1901 r1964  
    1919import com.tresys.framework.compiler.dictionary.Entrypoint; 
    2020import com.tresys.framework.compiler.linkage.Linkage; 
     21import com.tresys.framework.compiler.mls.MLSLevel; 
     22import com.tresys.framework.compiler.mls.MLSSupport; 
    2123import com.tresys.framework.compiler.systemResources.FileResource; 
    2224 
     
    139141        } 
    140142         
     143        /** 
     144         * get the sensitivity portion of the context 
     145         * @return 
     146         */ 
     147        public String getSensitivity (MLSSupport i_support) 
     148        { 
     149                if (i_support != null) 
     150                { 
     151                        MLSLevel mlsLevel = i_support.getLevel (getMLSLabel ()); 
     152                        if (mlsLevel != null) 
     153                                return mlsLevel.getRange (); 
     154                } 
     155                 
     156                return "s0"; 
     157        } 
     158 
    141159        public boolean Validate(Linkage linkage)  
    142160        { 
  • branches/mls/framework-plugin/src/com/tresys/framework/compiler/policy/IDomain.java

    r1963 r1964  
    1919import com.tresys.framework.compiler.AbstractToken; 
    2020import com.tresys.framework.compiler.linkage.Linkage; 
     21import com.tresys.framework.compiler.mls.MLSSupport; 
    2122 
    2223public interface IDomain  
     
    6061         * @return true if this domain has an enter that matches the given criteria, false otherwise. 
    6162         */ 
    62         public boolean IsEnterPresent(IDomain src, Domain dest, 
    63                                                                         EntrypointResource ep); 
     63        public boolean IsEnterPresent(IDomain src, Domain dest, EntrypointResource ep); 
    6464 
    6565        public String getType(); 
    6666         
    67         public String getFullContext (); 
     67        public String getFullContext (MLSSupport i_support); 
    6868 
    6969        public Domain getParent(); 
  • branches/mls/framework-plugin/src/com/tresys/framework/plugin/builder/AccessCheckVisitor.java

    r1963 r1964  
    3434import com.tresys.framework.compiler.linkage.libselinuxjava.sepol_security_id_t; 
    3535import com.tresys.framework.compiler.linkage.libselinuxjava.sidtab_t; 
     36import com.tresys.framework.compiler.mls.MLSSupport; 
    3637import com.tresys.framework.compiler.policy.AccessBaseResource; 
    3738import com.tresys.framework.compiler.policy.AccessResource; 
     
    6263        protected policydb_t m_policyDB; 
    6364        protected sidtab_t m_sidTab; 
    64          
    65         AccessCheckVisitor (IFile i_policyFile) 
     65        private final MLSSupport m_MLSSupport; 
     66         
     67        AccessCheckVisitor (IFile i_policyFile, MLSSupport i_support) 
    6668                throws FileNotFoundException, IOException 
    6769        { 
    6870                 
     71                m_MLSSupport = i_support; 
    6972                policy_file_t pFile = null; 
    7073         
     
    133136                         
    134137                        String sType = res.getName () + "_" + rdef.GetName () + "_t"; 
    135                         sepol_security_id_t ssid = new sepol_security_id_t (dom.getFullContext ()); 
     138                        sepol_security_id_t ssid = new sepol_security_id_t (dom.getFullContext (m_MLSSupport)); 
    136139                        System.out.println ("Source SID: " + ssid.toString ()); 
    137140 
    138                         sepol_security_id_t tsid = new sepol_security_id_t (res.getUser () + ":" + res.getRole () + ":" + sType + ":" + res.getSensitivity ()); 
     141                        String sSensitivity = new String (); 
     142                        if (m_MLSSupport != null) 
     143                                sSensitivity = ':' + res.getSensitivity (m_MLSSupport);                  
     144 
     145                        sepol_security_id_t tsid = new sepol_security_id_t (res.getUser () + ":" + res.getRole () + ":" + sType + sSensitivity); 
    139146                        System.out.println ("Target SID: " + tsid.toString ()); 
    140147                                 
     
    155162                                System.out.println("Audit Allowed (" + auditAllowVec.intValue () + "): " + auditAllowVec.toString ()); 
    156163                                System.out.println("Audit Denyed (" + auditDenyVec.intValue () + "): " + auditDenyVec.toString ()); 
     164                                 
     165                                System.out.println ("Reason: " + accessDecision.getReason ()); 
    157166                        } 
    158167                } 
  • branches/mls/framework-plugin/src/com/tresys/framework/plugin/builder/FrameworkNature.java

    r1963 r1964  
    837837                        try 
    838838                        { 
    839                                  
    840                                 AccessCheckVisitor visitor = new AccessCheckVisitor (i_policy); 
    841  
    842                                 SELinuxSystem sys = getSystem (i_policy); 
    843                                 Policy policy = sys.getPolicy (); 
    844                                  
    845                                 policy.Accept (visitor); 
    846                                  
     839                                AccessCheckVisitor visitor = null; 
     840                                try 
     841                                { 
     842                                        visitor = new AccessCheckVisitor (i_policy, getMLSSupport ()); 
     843                                         
     844                                } 
     845                                catch (MLSInitializationException mie) 
     846                                { 
     847                                        visitor = new AccessCheckVisitor (i_policy, null); 
     848                                } 
     849 
     850                                if (visitor != null) 
     851                                { 
     852                                        SELinuxSystem sys = getSystem (i_policy); 
     853                                        Policy policy = sys.getPolicy (); 
     854                                         
     855                                        policy.Accept (visitor); 
     856                                } 
    847857                        } 
    848858                        catch (IOException e) 
  • branches/mls/libselinuxjava-plugin/swig/selinuxswig.i

    r1963 r1964  
    385385        sepol_security_id_t m_tsid; 
    386386        sepol_decision m_decision; 
     387        unsigned int m_reason; 
    387388//      sepol_access_vector_t m_vector; 
    388389//      sepol_security_class_t m_class; 
     
    391392 
    392393 
     394 
    393395typedef struct my_sepol_access_decision {} sepol_access_decision; 
    394396%extend sepol_access_decision 
    395397{ 
     398        %constant long SEPOL_DECISION_COMPUTEAV_TE = SEPOL_COMPUTEAV_TE; 
     399        %constant long SEPOL_DECISION_COMPUTEAV_CONS = SEPOL_COMPUTEAV_CONS; 
     400        %constant long SEPOL_DECISION_COMPUTEAV_RBAC = SEPOL_COMPUTEAV_RBAC; 
     401         
    396402        sepol_access_decision(sepol_security_id_t i_ssid,  
    397403                sepol_security_id_t i_tsid, 
     
    404410                result->m_tsid = i_tsid; 
    405411                 
    406                 sepol_compute_av(result->m_ssid, result->m_tsid, result->m_vector.m_class, result->m_vector.m_vector, &result->m_decision); 
     412                int rc = sepol_compute_av_reason(result->m_ssid,  
     413                                                result->m_tsid,  
     414                                                result->m_vector.m_class,  
     415                                                result->m_vector.m_vector,  
     416                                                &result->m_decision,  
     417                                                &result->m_reason); 
     418                 
    407419                return result; 
    408420        } 
     
    433445                return new_sepol_access_vector__SWIG_2(self->m_vector.m_class, self->m_decision.auditdeny); 
    434446        } 
    435 }; 
     447         
     448        unsigned int getReason () 
     449        { 
     450                return self->m_reason; 
     451        } 
     452};