Skip to content

Commit

Permalink
Merge pull request #41 from ambitus/dev
Browse files Browse the repository at this point in the history
Release 1.0b2
  • Loading branch information
ElijahSwiftIBM authored Nov 16, 2023
2 parents 7dc03bc + de40ec2 commit 45de716
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 33 deletions.
20 changes: 19 additions & 1 deletion pyracf/common/security_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ def __format_data_set_generic_profile_data(
messages[i]
.replace("DATASET", "DATA SET")
.replace("VOLUMES ON WHICH DATA SET RESIDES", "VOLUMES")
.replace(" IS ", " = ")
)
if "=" in messages[i]:
self.__add_key_value_pair_to_profile(
Expand Down Expand Up @@ -440,6 +441,10 @@ def __format_data_set_generic_profile_data(
i += 1
elif "NO INSTALLATION DATA" in messages[i]:
profile[current_segment]["installationData"] = None
elif "UNLOCKED" in messages[i]:
profile[current_segment]["locked"] = False
elif "LOCKED" in messages[i]:
profile[current_segment]["locked"] = True
if "INFORMATION FOR DATA SET" in messages[i]:
profile[current_segment]["name"] = (
messages[i].split("INFORMATION FOR DATA SET ")[1].lower()
Expand Down Expand Up @@ -683,6 +688,10 @@ def _clean_and_separate(self, value: str) -> Union[list, str]:
if isinstance(out, list):
if None in out:
return None
if "days" in out:
del out[out.index("days")]
if len(out) == 1:
return out[0]
open_ind = []
close_ind = []
cln_ind = []
Expand Down Expand Up @@ -711,7 +720,16 @@ def _cast_from_str(
"""Cast null values floats and integers."""
if not case_sensitive:
value = value.lower()
if value in ("n/a", "none", "none specified", "no", "None", "unknown"):
if value in (
"n/a",
"none",
"none specified",
"no",
"None",
"unknown",
"unlimited",
"",
):
return None
if value in (
"in effect",
Expand Down
4 changes: 2 additions & 2 deletions pyracf/resource/resource_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def __init__(
"cdtinfo:case_allowed": "case",
"cdtinfo:default_racroute_return_code": "defaultrc",
"cdtinfo:valid_first_characters": "first",
"cdtinfo:generic_profile_checking": "racf:generic",
"cdtinfo:generic_profile_sharing": "racf:genlist",
"cdtinfo:generic_profile_checking": "generic",
"cdtinfo:generic_profile_sharing": "genlist",
"cdtinfo:grouping_class_name": "grouping",
"cdtinfo:key_qualifiers": "keyqual",
"cdtinfo:manditory_access_control_processing": "macprocessing",
Expand Down
13 changes: 8 additions & 5 deletions pyracf/setropts/setropts_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(
"base:log_commands_issuesd_by_special_users": "racf:saudit",
"base:security_label_control": "racf:seclabct",
"base:secondary_language": "racf:seclang",
"base:session_key_verification_interval": "racf:sessint",
"base:max_session_key_interval": "racf:sessint",
"base:security_label_auditing": "racf:slabaudt",
"base:security_label_system": "racf:slbysys",
"base:security_level_auditing": "racf:slevaudt",
Expand All @@ -104,6 +104,9 @@ def __init__(
"base:program_control": "racf:whenprog",
}
}
self._extracted_key_value_pair_segment_traits_map = {
"base": {" session key verification interval": "maxSessionKeyInterval"}
}
super().__init__(
"systemSettings",
debug=debug,
Expand Down Expand Up @@ -462,13 +465,13 @@ def _format_profile(self, result: dict) -> None:
)
.replace(
"PARTNER LU-VERIFICATION SESSIONKEY INTERVAL MAXIMUM/DEFAULT",
"VTAM SESSION KEY VERIFICATION INTERVAL",
"APPC SESSION KEY VERIFICATION INTERVAL",
)
.replace(
"PARTNER LU-VERIFICATION SESSIONKEY INTERVAL DEFAULT",
"VTAM SESSION KEY VERIFICATION INTERVAL",
"APPC SESSION KEY VERIFICATION INTERVAL",
)
.replace("APPLAUDIT", "VTAM APPC TRANSACTION AUDIT")
.replace("APPLAUDIT", "APPC TRANSACTION AUDIT")
.splitlines()
)
# Merge multi-line fields into single line based on key-value relationship token.
Expand Down Expand Up @@ -521,7 +524,7 @@ def _format_profile(self, result: dict) -> None:
"LANGUAGE DEFAULT": "languageDefaults",
"DATA SET": "dataSets",
"SECURITY LABEL": "securityLabels",
"VTAM": "vtam",
"APPC": "appc",
"KERBEROS": "kerberos",
"GENERIC RULES": "genericRules",
"GROUP RULES": "groupRules",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="IBM-1047"?>
<securityresult xmlns="http://www.ibm.com/systems/zos/saf/IRRSMO00Result1">
<resource name="TSTNET.TSTLOCLU.TSTPRTLU" class="APPCLU" operation="listdata" requestid="ResourceRequest">
<resource name="TMPNET.TMPLOC.TMPPART" class="APPCLU" operation="listdata" requestid="ResourceRequest">
<command>
<safreturncode>0</safreturncode>
<returncode>0</returncode>
<reasoncode>0</reasoncode>
<image>RLIST APPCLU (TSTNET.TSTLOCLU.TSTPRTLU) SESSION </image>
<image>RLIST APPCLU (TMPNET.TMPLOC.TMPPART) SESSION </image>
<message>CLASS NAME</message>
<message>----- ----</message>
<message>APPCLU TSTNET.TSTLOCLU.TSTPRTLU</message>
<message>APPCLU TMPNET.TMPLOC.TMPPART</message>
<message> </message>
<message>LEVEL OWNER UNIVERSAL ACCESS YOUR ACCESS WARNING</message>
<message>----- -------- ---------------- ----------- -------</message>
Expand All @@ -32,8 +32,10 @@
<message> </message>
<message>SESSION INFORMATION</message>
<message>-------------------</message>
<message>SESSION KEY INTERVAL IS UNLIMITED</message>
<message>SESSION KEY IS E3C5E2E3D2C5E800</message>
<message>SESSION KEY INTERVAL IS 00005 DAYS</message>
<message>LOCKED</message>
<message>CONVSEC= CONV</message>
</command>
</resource>
<returncode>0</returncode>
Expand Down
15 changes: 10 additions & 5 deletions tests/resource/test_resource_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ def get_sample(sample_file: str) -> Union[str, bytes]:
"validFirstCharacters": "alpha",
"genericProfileSharing": "disallowed",
"genericProfileChecking": "allowed",
"groupingClassName": "",
"groupingClassName": None,
"keyQualifiers": 0,
"manditoryAccessControlProcessing": "normal",
"maxLength": 246,
"maxLengthEntityx": 246,
"memberClassName": "",
"memberClassName": None,
"operations": None,
"validOtherCharacters": ["alpha", "numeric"],
"positNumber": 200,
Expand Down Expand Up @@ -230,8 +230,8 @@ def get_sample(sample_file: str) -> Union[str, bytes]:
)

TEST_EXTRACT_STARTED_TASK_PROFILE = {
"user": "",
"group": "",
"user": None,
"group": None,
"trusted": "yes",
"privileged": None,
"trace": None,
Expand Down Expand Up @@ -304,4 +304,9 @@ def get_sample(sample_file: str) -> Union[str, bytes]:

# This segment requires additional logic that is not currently implemented.
# This will not be documented and the rest marked experimental
TEST_EXTRACT_APPC_SESSION_PROFILE = {}
TEST_EXTRACT_APPC_SESSION_PROFILE = {
"sessionKeyInterval": 5,
"locked": True,
"sessionKey": "e3c5e2e3d2c5e800",
"securityCheckingLevel": "conv",
}
4 changes: 2 additions & 2 deletions tests/setropts/setropts_log_samples/list_setropts_success.log
Original file line number Diff line number Diff line change
Expand Up @@ -956,8 +956,8 @@
"interprocessCommunications": false,
"nameHiding": false
},
"vtam": {
"sessionKeyVerificationInterval": 30
"appc": {
"maxSessionKeyInterval": 30
},
"kerberos": {
"encryptionLevel": 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,9 @@
"interprocessCommunications": true,
"nameHiding": false
},
"vtam": {
"sessionKeyVerificationInterval": 30,
"appcTransactionAudit": true
"appc": {
"maxSessionKeyInterval": 30,
"transactionAudit": true
},
"kerberos": {
"encryptionLevel": 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2017,9 +2017,9 @@
"interprocessCommunications": false,
"nameHiding": false
},
"vtam": {
"sessionKeyVerificationInterval": null,
"appcTransactionAudit": false
"appc": {
"maxSessionKeyInterval": null,
"transactionAudit": false
},
"kerberos": {
"encryptionLevel": 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,8 @@
"interprocessCommunications": false,
"nameHiding": false
},
"vtam": {
"sessionKeyVerificationInterval": 30
"appc": {
"maxSessionKeyInterval": 30
},
"kerberos": {
"encryptionLevel": 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@
"interprocessCommunications": true,
"nameHiding": false
},
"vtam": {
"sessionKeyVerificationInterval": 30,
"appcTransactionAudit": true
"appc": {
"maxSessionKeyInterval": 30,
"transactionAudit": true
},
"kerberos": {
"encryptionLevel": 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1407,9 +1407,9 @@
"interprocessCommunications": false,
"nameHiding": false
},
"vtam": {
"sessionKeyVerificationInterval": null,
"appcTransactionAudit": false
"appc": {
"maxSessionKeyInterval": null,
"transactionAudit": false
},
"kerberos": {
"encryptionLevel": 0
Expand Down

0 comments on commit 45de716

Please sign in to comment.