コード例 #1
0
        /// <summary>
        /// Determines if the supplied xml GUID permits supplemental policies. i.e. extendable
        /// </summary>
        /// <param name="basePolPath">Path to the xml CI policy</param>
        /// <returns>Returns true if the GUID allows supplemental policies</returns>
        private int isPolicyExtendable(string basePolPath)
        {
            // Checks that this policy is 1) a base policy, 2) has the allow supplemental policy rule-option
            WDAC_Policy _BasePolicy        = new WDAC_Policy();
            bool        allowsSupplemental = false;

            // Read File
            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(SiPolicy));
                StreamReader  reader     = new StreamReader(basePolPath);
                _BasePolicy.siPolicy = (SiPolicy)serializer.Deserialize(reader);
                reader.Close();
            }
            catch (Exception exp)
            {
                this._MainWindow.Log.AddErrorMsg("Reading the xml CI policy encountered the following error ", exp);
                // Prompt user for additional confirmation
                DialogResult res = MessageBox.Show("The Wizard is unable to read your base CI policy xml file. The policy XML appears to be corrupted.",
                                                   "Parsing Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return(99);
            }

            this.Log.AddInfoMsg(String.Format("isPolicyExtendable -- Policy Type: {0}", _BasePolicy.siPolicy.PolicyType.ToString()));

            if (_BasePolicy.siPolicy.PolicyType.ToString().Contains("Supplemental"))
            {
                // Policy is not base -- not going to fix this case
                this.Log.AddInfoMsg("isPolicyExtendable -- returns error code 2");
                return(2);
            }

            foreach (var rule in _BasePolicy.siPolicy.Rules)
            {
                if (rule.Item.ToString().Contains("Supplemental"))
                {
                    allowsSupplemental = true;
                    this.Log.AddInfoMsg(String.Format("isPolicyExtendable -- {0}: True", rule.ToString()));
                    break;
                }
            }

            // if both allows supplemental policies, and this policy is not already a supplemental policy (ie. a base)
            if (allowsSupplemental)
            {
                this.Log.AddInfoMsg("isPolicyExtendable -- returns error code 0");
                return(0);
            }
            else
            {
                // Policy does not have the supplemental rule option -- can fix this case
                this.Log.AddInfoMsg("isPolicyExtendable -- returns error code 1");
                return(1);
            }
        }
コード例 #2
0
ファイル: PolicyType.cs プロジェクト: mrmagooey/WDAC-Toolkit
        public PolicyType(MainWindow pMainWindow)
        {
            InitializeComponent();
            this._MainWindow = pMainWindow;
            this._Policy     = new WDAC_Policy();
            this.Log         = this._MainWindow.Log;

            this._MainWindow.ErrorOnPage      = false;
            this._MainWindow.RedoFlowRequired = false;
        }
コード例 #3
0
ファイル: TemplatePage.cs プロジェクト: namism77/WDAC-Toolkit
 public TemplatePage(MainWindow pMainWindow)
 {
     InitializeComponent();
     this._MainWindow                  = pMainWindow;
     this._MainWindow.ErrorOnPage      = true;
     this._MainWindow.RedoFlowRequired = false;
     this._MainWindow.ErrorMsg         = "Please select a policy template before continuing.";
     this._Policy = new WDAC_Policy();
     this.Log     = this._MainWindow.Log;
 }
コード例 #4
0
        public ConfigTemplate_Control(MainWindow pMainWindow)
        {
            InitializeComponent();

            this.Policy      = new WDAC_Policy();
            this._MainWindow = pMainWindow;
            this.Log         = this._MainWindow.Log;

            this._MainWindow.ErrorOnPage      = false;
            this._MainWindow.RedoFlowRequired = false; // Nothing on this page will change the state of this
        }
コード例 #5
0
        public PolicyType(MainWindow pMainWindow)
        {
            InitializeComponent();
            this._MainWindow = pMainWindow;
            this._Policy     = pMainWindow.Policy;
            this.Log         = this._MainWindow.Log;

            this._MainWindow.ErrorOnPage      = false;
            this._MainWindow.RedoFlowRequired = false;

            this.Log.AddInfoMsg("==== Policy Type Page Initialized ====");
        }
コード例 #6
0
        public EditWorkflow(MainWindow pMainWindow)
        {
            InitializeComponent();

            this._MainWindow                    = pMainWindow;
            this._MainWindow.ErrorOnPage        = false;
            this._MainWindow.RedoFlowRequired   = false;
            this._MainWindow.Policy._PolicyType = WDAC_Policy.PolicyType.Edit;
            this.Policy = this._MainWindow.Policy;
            this.Log    = this._MainWindow.Log;
            this.Log.AddInfoMsg("==== Edit Workflow Page Initialized ====");
            this.Workflow      = WorkflowType.Edit; // Edit xml is default in the UI
            this.SelectedLevel = RuleLevel.None;
        }
コード例 #7
0
        public ConfigTemplate_Control(MainWindow pMainWindow)
        {
            InitializeComponent();


            this.Policy      = pMainWindow.Policy;
            this._MainWindow = pMainWindow;
            this.Log         = this._MainWindow.Log;

            this._MainWindow.ErrorOnPage      = false;
            this._MainWindow.RedoFlowRequired = false; // Nothing on this page will change the state of this

            this.Log.AddInfoMsg("==== Configuration Template Page Initialized ====");
        }
コード例 #8
0
        public SigningRules_Control(MainWindow pMainWindow)
        {
            InitializeComponent();
            this.Policy           = pMainWindow.Policy;
            this.AllFilesinFolder = new List <string>();

            this._MainWindow = pMainWindow;
            this._MainWindow.RedoFlowRequired     = false;
            this._MainWindow.CustomRuleinProgress = false;
            this.Log         = this._MainWindow.Log;
            this.RowSelected = -1;

            this.Log.AddInfoMsg("==== Signing Rules Page Initialized ====");
        }