McAfee ePolicy Orchestrator Policies Python Class Library
Overview
This package provides a set of Python classes to read, inspect, and modify policy
documents exported from the Policy Catalog of McAfee ePolicy Orchestrator (ePO),
without needing to know the underlying XML schema. Each supported policy is
exposed as an object with named properties (e.g. policy.asci = 15) instead of
raw Section/Setting XML lookups. Policies can also be exported as a Markdown
document (to_markdown() / save_markdown(), see "Policy documentation"
below) to keep a documentation of the enforced security policies.
Supported policies
| Product | Policy | Status | Markdown report |
|---|---|---|---|
| McAfee Agent | General | Full read/write | Not yet |
| McAfee Agent | Repository | Full read/write | Not yet |
| McAfee Agent | Troubleshooting | Full read/write | Not yet |
| McAfee Agent | Custom Properties | Full read/write | Not yet |
| McAfee Agent | Product Improvement Program (Telemetry) | Full read/write | Not yet |
| ENS Threat Prevention | On-Access Scan | Full read/write | Yes |
| ENS Threat Prevention | On-Demand Scan | Full read/write | Yes |
| ENS Threat Prevention | Exploit Prevention | Partial (signatures/expert rules full read/write; application rules read + enable/disable; process exclusions not yet implemented) | Yes |
| ENS Threat Prevention | Access Protection | Full read/write: rules (user-defined created/edited/removed, Trellix-defined Block/Report/executables/notes), subrules, exclusions | Yes |
| ENS Threat Prevention | Options | Full read/write | Yes |
| ENS Firewall | Rules | Read-only / reporting (editing not yet implemented) | Yes |
| ENS Firewall | Options | Full read/write | Yes |
| Solidcore - General | Configuration (Client) | Full read/write (CLI password: raw hashes only) | Not yet |
| Solidcore - General | Exception Rules (Windows/Unix) | Full read/write | Not yet |
| Solidcore - Application Control | Application Control Options (Windows/Unix) | Full read/write | Not yet |
| Solidcore - Application Control | Application Control Rules (Windows/Unix) | Full read/write (all tabs); Rule Groups added/removed | Not yet |
| Solidcore - Change Control | Change Control Rules (Windows/Unix) | Full read/write (all tabs); Rule Groups added/removed | Not yet |
| Solidcore - Integrity Monitor | Integrity Monitoring Rules (Windows/Unix) | Full read/write (all tabs); Rule Groups added/removed | Not yet |
| Solidcore | Rule Groups (Application Control, Change Control, Integrity Monitor) | Full read/write of the scor.rulegroup.export / import files |
Not yet |
The "Markdown report" column tells which policy types support the Markdown
export (to_markdown() / save_markdown()); for the other policy classes
these methods raise NotImplementedError for now (SCRuleGroups has no
Markdown export method yet).
McAfee Agent policy coverage is complete - all 5 McAfee Agent policy types are implemented.
Solidcore (Trellix Application and Change Control) policy coverage is complete -
all 13 Solidcore policy types of the ePO Policy Catalog are implemented, in the
sc subpackage (sc.gen, sc.awl, sc.cc, sc.fim, named after the ePO
feature IDs SCOR_GEN, SCOR_AWL, SCOR_CC and SCOR_FIM).
Installation
pip install mcafee_epo_policies
Usage
from mcafee_epo_policies import McAfeeAgentPolicies, McAfeeAgentPolicyGeneral
# Load a Policies export (XML) from the ePO Policy Catalog
with open('EPOAGENTMETA_policies.xml', 'rb') as f:
policies = McAfeeAgentPolicies(f.read())
# List the policies contained in the export
print(policies.list())
# Extract one policy and wrap it for editing
policy_xml = policies.get_policy('General', 'My Custom Policy')
policy = McAfeeAgentPolicyGeneral(policy_xml)
# Read and change a setting through a property, instead of raw XML
print(policy.asci)
policy.asci = 15
# Save the edited policy, ready to re-import into ePO
policy.save_to_file('My Custom Policy - edited.xml')
Policy documentation (Markdown)
Most companies must keep a documentation of the security policies they
enforce (audits, compliance). to_markdown() returns a Markdown document of a
policy, as close as possible to the ePO console: a metadata header (product,
policy category, name, ePO server and version, date), a table of contents,
one section per console tab with the console labels, settings as
"Setting | Value" tables, lists (exclusions, signatures, firewall rules...)
as numbered tables, and a document control section (review/approval
sign-off, change history) to fill in. save_markdown() writes it to a file.
policy.save_markdown('On-Access Scan - My Custom Policy.md',
author='Jane Doe', reviewers=['CISO'])
Available for all ENS policy types: Threat Prevention (On-Access Scan,
On-Demand Scan, Exploit Prevention, Access Protection, Options) and Firewall
(Options, and Rules documented as a firewall review: a rule summary numbered
in evaluation order, then one detail card per group/rule). Labels, order and
displayed items were checked against the ePO 5.10 console (e.g. Exploit
Prevention lists the same 486 signatures as the console). See
examples/policy_documentation.py.
ENS Access Protection rules
from mcafee_epo_policies import (ESTPPolicyAccessProtection, APRule, APSubRule, APTarget,
APExecutable, APUserName)
rule = APRule('Block ransomware extensions', block=True, report=True)
rule.add_executable(APExecutable('Backup agent', path='**\\backupagent.exe', inclusion='exclude'))
rule.add_user_name(APUserName('Local\\System', inclusion='exclude'))
rule.add_subrule(APSubRule('Ransomware extensions', APSubRule.FILES, ['create', 'rename'],
targets=[APTarget('*.locky'), APTarget('*.lockbit')]))
policy.add_rule(rule) # policy: ESTPPolicyAccessProtection
policy.set_rule_block('PREVENT_MIMIKATZ_CREATION', '1') # Trellix-defined rule
Subrule types and operation codes are listed in APSubRule.OPERATIONS (Windows)
and APSubRule.LINUX_OPERATIONS (Linux rules), with the console labels.
Solidcore
Solidcore policies are exported all together, for every Solidcore feature
(policy.export productId=SOLIDCORE_META with the ePO API). Unlike the other
products, a Solidcore policy is a list of rules, plus references to shared Rule
Groups: each tab of the ePO console has its own list methods.
from mcafee_epo_policies import SCPolicies, SCAWLPolicyRules, SCException
with open('SOLIDCORE_META_policies.xml', 'rb') as f:
policies = SCPolicies(f.read())
# Copy an Application Control Rules policy (shared Rule Groups are kept)
policy = SCAWLPolicyRules(policies.new_policy('AWL Rules (Windows)', 'My Copy',
template='My Rules Policy'))
print(policy.get_rule_group_names())
policy.add_updater('C:\\Program Files\\MyApp\\updater.exe', 'MyApp updater')
policy.add_exclusion(SCException.CASP, 'legacy.exe')
policy.add_execution_control_rule('powershell.exe', 'block',
[('command_line', 'matches', '.*-enc.*')])
policy.save_to_file('My Copy.xml')
Solidcore Rule Groups
Rule Groups (Menu > Configuration > Solidcore Rules) are exported and imported
with their own ePO API commands, scor.rulegroup.export and
scor.rulegroup.import (without a Rule Group name, the export only contains
the user defined Rule Groups). SCRuleGroups reads and writes those files, and
each Rule Group is edited with the same methods as the matching policy tabs.
from mcafee_epo_policies import SCRuleGroups, SCAWLPolicyRules
rule_groups = SCRuleGroups() # or SCRuleGroups(<scor.rulegroup.export output>)
group = rule_groups.new_rule_group('My Apps', SCRuleGroups.APPLICATION_CONTROL,
SCRuleGroups.WINDOWS)
group.add_updater('C:\\Program Files\\MyApp\\updater.exe', 'MyApp updater')
rule_groups.save_to_file('rule_group.xml') # scor.rulegroup.import file=rule_group.xml
policy = SCAWLPolicyRules(policies.get_policy('AWL Rules (Windows)', 'My Policy'))
policy.add_rule_group(group) # policy.importPolicy, after the Rule Group
ePO links a policy to a Rule Group by its name: import the Rule Group before
the policy that uses it. An existing Rule Group is only replaced by
scor.rulegroup.import with override=true (otherwise the import fails, even
though the API answers success - check the "Import Solidcore Rule Groups"
server task).
Note: ePO stores some Solidcore policies under an internal type name, used as
type_id (e.g. Lockdown Rules for Configuration (Client), Attr Rules (Windows) for Exception Rules (Windows), Mon Rules (Unix) for Integrity
Monitoring Rules (Unix)); SCPolicies.list() shows them.
Examples
The examples/ directory has short, runnable scripts covering
McAfee Agent (General/Repository), ENS Threat Prevention (On-Access Scan,
On-Demand Scan, process exclusions), ENS Firewall (Rules reporting), and
Solidcore (Application Control, Integrity Monitor and Change Control policies,
Rule Groups - some of them working directly against an ePO server).
Documentation
There is no separate documentation site yet; every class and method has a docstring describing which ePO UI setting it maps to.
Requirements
Python 3.8 or later.
History
0.4.0 - 2026-10-03
Added
- Markdown documentation of policies:
Policy.to_markdown()/save_markdown()with Markdown helpers (md_table,md_settings...), for all ENS policy types;examples/policy_documentation.py. ESTPPolicyAccessProtection(ENS TP Access Protection) with an object model following the console workflow:APRule,APSubRule,APTarget,APExecutable,APUserName- rules are created, edited and removed (add_rule(),update_rule(),remove_rule()), exclusions too; checked end to end (built with the library, imported into ePO, shown as expected in the console, exported back unchanged);examples/access_protection.py.ESTPPolicyOptions(ENS TP Options: Quarantine Manager, Detection Exclusion, custom unwanted programs, Proactive Data Analysis) andESFWPolicyOptions(ENS Firewall Options, including DNS Blocking, Defined Networks and Trusted Executables).OASStateconstants: the On-Access Scan "Disable and unregister with Windows Security Center" option (stored by ePO asbOASEnabled= 0 plusbUnregisterWithWSC= 1), supported by theon_access_scanproperty.
Fixed
- On-Demand Scan: the GTI sensitivity level getters/setters (
fs_,qs_,rs_gti_level) looked for the setting in the wrong section (returned None, setter failed). - ENS Firewall:
get_content()crashed on ICMP rules without message type. - Exploit Prevention: debug messages printed when loading a policy or applying
a
SearchFilter.
0.3.0 - 2026-10-03
Added
- Solidcore (Trellix Application and Change Control) support, in the new
scsubpackage - all 13 Solidcore policy types:sc.gen:SCGENPolicyConfiguration(Configuration (Client)) andSCGENPolicyExceptionRules(Exception Rules, Windows/Unix);sc.awl:SCAWLPolicyOptionsandSCAWLPolicyRules(Application Control Options and Rules, Windows/Unix);sc.cc:SCCCPolicyRules(Change Control Rules, Windows/Unix);sc.fim:SCFIMPolicyRules(Integrity Monitoring Rules, Windows/Unix);SCPolicies(Solidcore export), whosenew_policy()keeps the shared Rule Groups referenced by the template, and theSCPolicybase class giving generic access to Solidcore rules and Rule Groups;sc.rulegroups:SCRuleGroupsfor the Solidcore Rule Groups files of thescor.rulegroup.export/scor.rulegroup.importAPI commands (create, copy, edit user defined Rule Groups), withSCAWLRuleGroup,SCCCRuleGroupandSCFIMRuleGroupsharing the policy tab methods, andadd_rule_group()/remove_rule_group()to make a policy use a Rule Group.
SCExceptionandSCReputationconstants classes.SCPolicies.new_empty_policy(): a new policy without any rule or Rule Group (the ePO "Blank Template" can't be exported).examples/solidcore_application_control.pyandexamples/solidcore_rule_groups.py, and three examples working directly against an ePO server with the "mcafee-epo" API client (optional dependencypip install mcafee_epo_policies[examples]): Application Control policy with one item per tab and a database Rule Group, Integrity Monitor policy with a "Windows Critical Config Files" Rule Group, and Change Control policy protecting some of those files.- Tests built from real ePO 5.10 exports, each policy type also checked end to end: edited with the library, imported into ePO, exported back unchanged and displayed as expected in the ePO console.
0.2.0 - 2026-08-28
Added
- Full support for the remaining McAfee Agent policies: Troubleshooting, Custom Properties, and Product Improvement Program (Telemetry) - McAfee Agent policy coverage is now complete.
Languageconstants class for the Troubleshooting policy's agent language selection (21 languages, LCID codes).- Two new "Ransomware" options on the On-Access Scan policy:
detect_unknown_ransomwareandransomware_bait_files. - Read support and enable/disable control for Exploit Prevention
Application Protection Rules (
application_rules_list,application_rule_get,get/set_application_rule_status,get/set_application_rule_inclusion_status). signatures_delete()on the Exploit Prevention policy now actually removes an Expert Rule (previously a no-op).- Validation when
signatures_add()is called with an explicitsig_id: rejects IDs that are already in use or outside the valid range. - Generic
get_indexed_list/set_indexed_list/get_indexed_table/set_indexed_tablehelpers on the basePolicyclass, replacing eight independent hand-written implementations of the same "count + indexed settings" XML pattern. - A
tests/suite (pytest, 52 tests) built from real ePO policy exports, including two structural tests that check the whole package for property-wiring and mutable-default-argument mistakes. - An
examples/directory with runnable scripts for McAfee Agent, On-Access Scan, On-Demand Scan, and Firewall Rules reporting.
Changed
- Migrated packaging from
setup.pytopyproject.toml(PEP 621), with an SPDX license expression. mcafee_epo_policies.__version__now reads the installed package version viaimportlib.metadata, instead of accidentally reporting the version ofsetuptools.
Fixed
- Six mismatched
property(getter, setter)declarations in the McAfee Agent General policy that made several settings silently unreadable, unwritable, or both. test_cert_authenticationis now correctly read-only, and its certificate files are located relative to the package instead of the caller's working directory.- Shared mutable default arguments in
ExclusionList,OASProcessList,OASURLList, andODSLocationListthat could leak state between unrelated instances. - On-Access Scan
process_list: a key mismatch (TypeItem_x{row}vsTypeItem_{row}) meant a process's risk level set viaset_process_list()could never be read back. - On-Access Scan
set_process_list([])no longer leaves the policy in a state that crashes the nextget_process_list()call. - On-Demand Scan
fs_performance_level/qs_performance_level: a typo (_Performace) meant the setting was never actually persisted. - Saving a policy containing any non-ASCII character (accents, curly quotes, etc.) produced XML that neither this library nor ePO could reliably read back, due to an invalid encoding name.
signatures_get()on the Exploit Prevention policy, previously non-functional for any signature.- The indexed-list/table helpers could leave stale, duplicate settings behind when an ePO export already contained orphaned entries beyond their declared count - now cleaned up correctly on every write.
0.0.6 - 2020-11-25
Starting point for this changelog.
Bugs and Feedback
For bugs, questions and discussions please use the GitHub Issues.
License
Copyright 2020 Benjamin Marandel
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Metadata
Release files for mcafee-epo-policies 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mcafee_epo_policies-0.4.0.tar.gz | 138.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcafee_epo_policies-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 261.0 kB
Release files / mcafee_epo_policies-0.4.0.tar.gz
| Download URL | mcafee_epo_policies-0.4.0.tar.gz |
|---|---|
| Size | 138.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8343fe8accf886d39c0e56307015ce511e4e9a3f96487fdf392b8e4d583b3f0a
|
|
BLAKE2b-256 checksum How to use checksums |
5f344c5bb7d75422ea39b95daaa97518e6595266445086e1f0e46a79efd8aa77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / mcafee_epo_policies-0.4.0-py3-none-any.whl
| Download URL | mcafee_epo_policies-0.4.0-py3-none-any.whl |
|---|---|
| Size | 122.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8df1eba5d65d0d04949948ed99915f8325971566c191fc84474e02201c1ffae0
|
|
BLAKE2b-256 checksum How to use checksums |
8bb9747b19ba9e88e2c3a00176949e0c3fbe55525f4b0fdf290ea98ecf2a0ba8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|