nodestream-plugin-akamai 0.15.0a1
Pipeline Plugin for Akamai Data
Requires Python: <4.0,>=3.11

# Overview
This repo contains the scripts necessary to parse Akamai property and redirect configs
and ingest them into Neo4j.  It is a starting point to help visualize your external attack surface
within Akamai.

[LinkedIn Blog post](https://www.linkedin.com/pulse/neo4j-akamai-mapping-your-external-attack-surface-chad-cloes/?published=t&trackingId=ucgj3ZLISy6RW78UL0iYxQ%3D%3D)

# Setup Neo4j
1. Download and install Neo4j: https://neo4j.com/docs/desktop-manual/current/installation/download-installation/
1. Create and start database (version 5.7.0: https://neo4j.com/docs/desktop-manual/current/operations/create-dbms/
1. Install APOC: https://neo4j.com/docs/apoc/5/installation/

# Download Akamai credentials
1. Create and download akamai credentials: https://techdocs.akamai.com/developer/docs/set-up-authentication-credentials

NOTE: These values will be used in your `.env` 

# Install and run the app
1. Install python3: https://www.python.org/downloads/ 
1. Install poetry: https://python-poetry.org/docs/#installation 
1. Install nodestream: https://nodestream-proj.github.io/nodestream/0.5/docs/tutorial/
1. Generate a new nodestream project
1. Add `nodestream-akamai` to your project dependencies in your nodestream projects pyproject.toml file.
1. Install necessary dependencies: `poetry install`
1. In `nodestream.yaml` add the following:
```yaml
plugin_config:
  akamai:
    base_url: !env AKAMAI_BASE_URL
    client_token: !env AKAMAI_CLIENT_TOKEN
    client_secret: !env AKAMAI_CLIENT_SECRET
    access_token: !env AKAMAI_ACCESS_TOKEN
    # If you are using an akamai account key add the following line:
    account_key: !env AKAMAI_ACCOUNT_KEY
targets:
  my-db:
    database: neo4j 
    uri: bolt://localhost:7687
    username: neo4j
    password: neo4j123
```
1. Set environment variables in your terminal session for: `AKAMAI_BASE_URL`, `AKAMAI_CLIENT_TOKEN`, `AKAMAI_CLIENT_SECRET`, `AKAMAI_ACCESS_TOKEN` and if using an akamai account key `AKAMAI_ACCOUNT_KEY`.
1. Verify nodestream has loaded the pipelines: `poetry run nodestream show`
1. Use nodestream to run the pipelines: `poetry run nodestream run <pipeline-name> --target my-db`

# Using make
1. Install make (ie. `brew install make`)
1. Run `make run`

# Install Bloom visualization
1. For detailed instructions on how to import a perspective: https://neo4j.com/docs/bloom-user-guide/current/bloom-perspectives/perspective-creation/
1. Download the perspective to a file https://github.com/ccloes/neo4j-akamai/blob/main/Bloom_Perspective.json

# Using the saved cypher queries
1. Type `show endpoint <some.fqdn.com>` (this will show that endpoint and the relationships to it)
* ![show endpoint <fqdn>](./imgs/showendpoint.png)
1. Type `show akamai graph` (this will show the current akamai data loaded in the graph)
* ![show akamai graph](./imgs/showgraph.png)
1. Type `show schema` (this will show the graph schema and how the nodes relate and their relationships)
* ![show schema](./imgs/showschema.png)

# Schema visualization
[Arrows.app link](https://arrows.app/#/import/json=eyJncmFwaCI6eyJzdHlsZSI6eyJmb250LWZhbWlseSI6InNhbnMtc2VyaWYiLCJiYWNrZ3JvdW5kLWNvbG9yIjoiI2ZmZmZmZiIsImJhY2tncm91bmQtaW1hZ2UiOiIiLCJiYWNrZ3JvdW5kLXNpemUiOiIxMDAlIiwibm9kZS1jb2xvciI6IiNmZmZmZmYiLCJib3JkZXItd2lkdGgiOjQsImJvcmRlci1jb2xvciI6IiMwMDAwMDAiLCJyYWRpdXMiOjUwLCJub2RlLXBhZGRpbmciOjUsIm5vZGUtbWFyZ2luIjoyLCJvdXRzaWRlLXBvc2l0aW9uIjoiYXV0byIsIm5vZGUtaWNvbi1pbWFnZSI6IiIsIm5vZGUtYmFja2dyb3VuZC1pbWFnZSI6IiIsImljb24tcG9zaXRpb24iOiJpbnNpZGUiLCJpY29uLXNpemUiOjY0LCJjYXB0aW9uLXBvc2l0aW9uIjoiaW5zaWRlIiwiY2FwdGlvbi1tYXgtd2lkdGgiOjIwMCwiY2FwdGlvbi1jb2xvciI6IiMwMDAwMDAiLCJjYXB0aW9uLWZvbnQtc2l6ZSI6NTAsImNhcHRpb24tZm9udC13ZWlnaHQiOiJub3JtYWwiLCJsYWJlbC1wb3NpdGlvbiI6Imluc2lkZSIsImxhYmVsLWRpc3BsYXk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