Skip to content

Hawk132000/Akamai-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Akamai API Manager

A user-friendly command-line tool for managing and auditing Akamai CDN configurations. This tool helps you easily view and manage your Akamai properties, hostnames, and SSL certificates without navigating through the complex Akamai Control Center.

Akamai API Manager Python License

πŸ“– Table of Contents

✨ Features

  • Property Management

    • πŸ“‹ View all your Akamai properties in a simple list
    • πŸ” See all hostnames associated with each property
  • Hostname Analysis

    • 🌐 Resolve edge hostnames to their IP addresses
    • πŸ”„ Compare production and staging configurations
    • πŸ“Š Export hostname data in Confluence-ready formats
  • SSL Certificate Management

    • πŸ”’ List all certificate enrollments
    • πŸ“‘ View detailed certificate configurations
    • πŸ” Check certificate status across environments
  • Performance & Usability

    • ⚑ Intelligent caching of API responses for faster operation
    • πŸ“Š Export data as HTML or Markdown tables for documentation
    • πŸš€ Multi-threaded processing for faster data retrieval

πŸ€” Why Use This Tool?

  • Save Time: Get all your Akamai configuration data without navigating through the Akamai Control Center
  • Documentation: Generate formatted tables for your team documentation
  • Auditing: Easily review your Akamai configurations across multiple properties
  • Troubleshooting: Quickly verify DNS configurations and certificate statuses

πŸ“‹ Prerequisites

  • Python 3.6 or higher
  • Akamai API credentials with access to:
    • Property Manager API (PAPI)
    • Certificate Provisioning System API (CPS)
  • Basic knowledge of Akamai CDN concepts

πŸš€ Quick Start

# Clone the repository
git clone https://github.com/yourusername/akamai-api-manager.git

# Navigate to the project directory
cd akamai-api-manager

# Set up virtual environment and install dependencies
python -m venv akamai-venv
source akamai-venv/bin/activate  # On Windows: akamai-venv\Scripts\activate
pip install -r requirements.txt

# Configure your credentials (see Detailed Setup below)

# Run the tool
python main.py

πŸ“ Detailed Setup

1. Clone the Repository

git clone https://github.com/yourusername/akamai-api-manager.git
cd akamai-api-manager

2. Create a Virtual Environment

# Create a virtual environment
python -m venv akamai-venv

# Activate the virtual environment
# On macOS/Linux:
source akamai-venv/bin/activate
# On Windows:
akamai-venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure Akamai Credentials

Create an .edgerc file in your home directory:

[papi]
client_secret = your_client_secret
host = akab-xxxxxxxxxxxxx.luna.akamaiapis.net
access_token = akab-xxxxxxxxxxxxx
client_token = akab-xxxxxxxxxxxxx

Create a .env file in the project directory:

AKAMAI_CONTRACT_ID='your_contract_id'
AKAMAI_GROUP_ID='your_group_id'

OR

Copy the .env.example file to .env and add your Akamai credentials:

cp .env.example .env
# Then edit .env with your details

To find your contract ID and group ID:

  1. Log in to the Akamai Control Center
  2. Navigate to Property Manager
  3. Look at the URL - you'll see something like /papi/v1/groups/XXXXX/contracts/YYYYY/
  4. Your group ID is XXXXX and contract ID is YYYYY

πŸ“š Usage Guide

Starting the Application

# Start with normal caching (faster for repeated queries)
python main.py

# Start with fresh data on each query (slower but always up-to-date)
python main.py --non-cache

Main Menu Options

When you run the application, you'll see this menu:

Select operation:
1. List All Properties
2. Get Hostnames for a Property
3. Manage SSL Certificates (CPS)
4. Exit

Option 1: List All Properties

This option shows all properties and their hostnames:

  • Lists property names and IDs
  • Shows all hostnames associated with each property
  • Provides Confluence-ready tables for documentation

Option 2: Get Hostnames for a Property

This option provides detailed information for a selected property:

  • Shows CNAME mappings
  • Displays edge hostname details
  • Resolves IP addresses for both production and staging
  • Shows certificate status
  • Generates formatted tables for documentation

Option 3: SSL Certificate Management

This submenu provides certificate management options:

=== SSL Certificate Management (CPS) ===
1. List All Certificate Enrollments
2. Get Detailed Certificate Information
3. Return to Main Menu
  • List All Enrollments: Shows all certificates with their basic information
  • Get Detailed Information: Provides in-depth technical details about a specific certificate
  • You can save certificate details to a file for documentation

βš™οΈ Configuration

Command Line Arguments

  • --non-cache: Disables caching of API responses, ensuring fresh data on each query

Environment Variables

Edit the .env file to change:

  • AKAMAI_CONTRACT_ID: Your Akamai contract ID
  • AKAMAI_GROUP_ID: Your Akamai group ID

πŸ” Example Workflows

Example 1: Auditing All Properties

  1. Run python main.py
  2. Select option 1: "List All Properties"
  3. Review the list of all properties and their hostnames
  4. Copy the HTML or Markdown table for documentation

Example 2: Checking Certificate Configuration

  1. Run python main.py
  2. Select option 3: "Manage SSL Certificates (CPS)"
  3. Select option 1: "List All Certificate Enrollments"
  4. Identify the certificate you want to examine
  5. Return to the certificate menu and select option 2
  6. Enter the number of the certificate to see detailed information
  7. Choose to save the details to a file if needed

❓ Troubleshooting

API Authentication Issues

If you see authentication errors:

  1. Verify your .edgerc file has the correct credentials
  2. Check that your API user has the necessary permissions
  3. Ensure your credentials haven't expired

Property or Hostname Not Found

If properties or hostnames are missing:

  1. Verify your contract ID and group ID in the .env file
  2. Check that your API user has access to those properties
  3. Try running with the --non-cache flag to fetch fresh data

DNS Resolution Problems

If IP address resolution fails:

  1. Check your internet connection
  2. Verify the hostname exists and is correctly configured
  3. There might be DNS propagation delays if changes were recently made

πŸ—οΈ Code Structure

  • main.py - Main application entry point and interactive menu
  • utils.py - Utility functions for DNS resolution and table generation
  • akamai_papi.py - Functions for interacting with Akamai Property Manager API
  • akamai_cps.py - Functions for interacting with Akamai Certificate Provisioning System API

🀝 Contributing

Contributions are welcome and appreciated! Here's how you can contribute:

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add some amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Please make sure your code follows the existing style and includes appropriate comments.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details. You are free to use, modify, and distribute this code as you wish.

About

A user-friendly command-line tool for managing and auditing Akamai CDN configurations.

Resources

License

Stars

Watchers

Forks

Languages