Skip to content

Commit

Permalink
#293 Fix issue with optional Okta sync (#295)
Browse files Browse the repository at this point in the history
* Set okta_api_key to None when not configured. Corrected the log for CRXcavator (#293)

* Update setup step for JAVA_HOME and Neo4j auth setting when testing locally. Replaced tabs with spaces
  • Loading branch information
khanhldt authored Apr 30, 2020
1 parent 66fe5a1 commit 2603f46
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
4 changes: 3 additions & 1 deletion cartography/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,12 @@ def main(self, argv):
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

# CRXcavator config
if config.crxcavator_api_base_uri and config.crxcavator_api_key_env_var:
logger.debug("Reading API key for CRXcavator from environment variable '%s'.")
logger.debug(f"Reading API key for CRXcavator from env variable {config.crxcavator_api_key_env_var}.")
config.crxcavator_api_key = os.environ.get(config.crxcavator_api_key_env_var)
else:
config.crxcavator_api_key = None
Expand Down
45 changes: 24 additions & 21 deletions docs/setup/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,46 @@
Time to set up the server that will run Cartography. Cartography _should_ work on both Linux and Windows servers, but bear in mind we've only tested it in Linux so far. Cartography requires Python 3.6 or greater.

1. **Get and install the Neo4j graph database** on your server.
1. Neo4j requires a JVM (JDK/JRE 11 or higher) to be installed. One option is to install [Amazon Coretto 11](https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/what-is-corretto-11.html).
1. Neo4j requires a JVM (JDK/JRE 11 or higher) to be installed. One option is to install [Amazon Coretto 11](https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/what-is-corretto-11.html).

1. Go to the [Neo4j download page](https://neo4j.com/download-center/#releases), click "Community Server" and download Neo4j Community Edition 3.5.\*.
⚠️ Make sure you have `JAVA_HOME` environment variable set. The following works for Mac OS: `export JAVA_HOME=$(/usr/libexec/java_home)`

⚠️ At this time we run our automated tests on Neo4j version 3.5.\*. Other versions may work but are not explicitly supported. ⚠️
1. Go to the [Neo4j download page](https://neo4j.com/download-center/#releases), click "Community Server" and download Neo4j Community Edition 3.5.\*.

1. [Install](https://neo4j.com/docs/operations-manual/current/installation/) Neo4j on the server you will run Cartography on.
⚠️ At this time we run our automated tests on Neo4j version 3.5.\*. Other versions may work but are not explicitly supported. ⚠️

1. [Install](https://neo4j.com/docs/operations-manual/current/installation/) Neo4j on the server you will run Cartography on.

⚠️ For local testing, you might want to turn off authentication via property `dbms.security.auth_enabled` in file /NEO4J_PATH/conf/neo4j.conf

1. [Configure your data sources](config).

1. **Get and run Cartography**

1. Run `pip install cartography` to install our code.
1. Run `pip install cartography` to install our code.

1. Finally, to sync your data:
1. Finally, to sync your data:

- For one account using the `default` profile defined in your AWS config file, run
- For one account using the `default` profile defined in your AWS config file, run

```
cartography --neo4j-uri <uri for your neo4j instance; usually bolt://localhost:7687>
```
```
cartography --neo4j-uri <uri for your neo4j instance; usually bolt://localhost:7687>
```

- Or for a specific account defined as a separate profile in your AWS config file, set the `AWS_PROFILE` environment variable, for example
- Or for a specific account defined as a separate profile in your AWS config file, set the `AWS_PROFILE` environment variable, for example

```
AWS_PROFILE=other-profile cartography --neo4j-uri <uri for your neo4j instance; usually bolt://localhost:7687>
```
```
AWS_PROFILE=other-profile cartography --neo4j-uri <uri for your neo4j instance; usually bolt://localhost:7687>
```
- For more than one AWS account, run
- For more than one AWS account, run
```
AWS_CONFIG_FILE=/path/to/your/aws/config cartography --neo4j-uri <uri for your neo4j instance; usually bolt://localhost:7687> --aws-sync-all-profiles
```
```
AWS_CONFIG_FILE=/path/to/your/aws/config cartography --neo4j-uri <uri for your neo4j instance; usually bolt://localhost:7687> --aws-sync-all-profiles
```
You can view a full list of Cartography's CLI arguments by running `cartography --help`
You can view a full list of Cartography's CLI arguments by running `cartography --help`
The sync will pull data from your configured accounts and ingest data to Neo4j! This process might take a long time if your account has a lot of assets.
The sync will pull data from your configured accounts and ingest data to Neo4j! This process might take a long time if your account has a lot of assets.
1. See our [Operations Guide](ops.md) for tips on running Cartography in production.
1. See our [Operations Guide](ops.md) for tips on running Cartography in production.

0 comments on commit 2603f46

Please sign in to comment.