Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Add support for Okta #40

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions cartography/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,14 @@ def _build_parser(self):
'Okta organizational id to sync. Required if you are using the Okta intel module. Ignored otherwise.'
),
)
parser.add_argument(
'--okta-api-key',
type=str,
default=None,
help=(
'Key with which to auth to the Okta API.'
),
)
parser.add_argument(
'--okta-api-key-env-var',
type=str,
Expand Down Expand Up @@ -513,12 +521,7 @@ def main(self, argv: str) -> int:
else:
config.azure_client_secret = None

# Okta config
if config.okta_org_id and config.okta_api_key_env_var:
logger.debug(f"Reading API key for Okta from environment variable {config.okta_api_key_env_var}")
config.okta_api_key = os.environ.get(config.okta_api_key_env_var)
else:
config.okta_api_key = None
# Okta config. Rajat: No extra work required any more.

# CRXcavator config
if config.crxcavator_api_base_uri and config.crxcavator_api_key_env_var:
Expand Down Expand Up @@ -622,8 +625,10 @@ def main(argv=None, sync_flag=None):
if(requested_sync == 'rule_check'):
sync = cartography.sync.build_rule_check_sync()
result = CLI(sync, prog='cartography').main(argv)
if(requested_sync.startswith("gcp")):
elif(requested_sync.startswith("gcp")):
sync = cartography.sync.build_borneo_gcp_sync("skip_index" in requested_sync)
elif(requested_sync.startswith("okta")):
sync = cartography.sync.build_borneo_okta_sync("skip_index" in requested_sync)
result = CLI(sync, prog='cartography').main(argv)
else:
if(requested_sync != "default"):
Expand Down
9 changes: 9 additions & 0 deletions cartography/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,15 @@ def build_borneo_gcp_sync(skipIndex: bool) -> Sync:
])
return sync

def build_borneo_okta_sync(skipIndex: bool) -> Sync:
sync = Sync()
if skipIndex != True:
sync.add_stages([('create-indexes', cartography.intel.create_indexes.run)])
sync.add_stages([
('okta', cartography.intel.okta.start_okta_ingestion),
])
return sync

def build_rule_check_sync() -> Sync:
sync = Sync()
sync.add_stages([
Expand Down
Loading