From 1f87f584f9b15c6532412cc7653fd3a379c4fdc8 Mon Sep 17 00:00:00 2001 From: Antoine Drochon Date: Fri, 15 Sep 2023 10:23:17 -0700 Subject: [PATCH] Release 0.4.3 (#9) * Change the sort order of events from DESC to ASC * Minor fix in the readme doc --------- Co-authored-by: Mike Schiessl --- README.md | 9 ++--- bin/akamai-etp | 6 ++-- cli.json | 2 +- test/test.bash | 95 -------------------------------------------------- 4 files changed, 9 insertions(+), 103 deletions(-) delete mode 100755 test/test.bash diff --git a/README.md b/README.md index 99f9748..c3c716e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Akamai CLI: Secure Internet Access Enterprise +# Akamai CLI: Secure Internet Access (SIA) Enterprise SIA Enterprise was formerly known as Enterprise Threat Protector (ETP). More information at https://www.akamai.com/sia @@ -31,7 +31,7 @@ More information at https://www.akamai.com/sia Secure Internet Access Enterprise (formerly ETP) comes with a full suite of APIs. API requires to implement code to be able to interact with the service. -That's where Akamai CLI greatly help, no longer script to wrote yourself, you can run very common operations directly from the command line. +That's where Akamai CLI greatly help, no longer code to wrote yourself, you can run very common operations directly from the command line. ## Prerequisites @@ -252,8 +252,9 @@ $ akamai etp tenant clients ## Frequently Asked Questions -Q: Can I use cli-etp to stream data to my SIEM? -A: Yes, you can use the file output and have the file monitor by a SIEM agent. Alternatively check out [Akamai Universal Log Streamer (ULS)](https://github.com/akamai/uls) which offer TCP, UDP, HTTP and File output with a lot of flexibility! +Q: Can I use `cli-etp` to stream data to my SIEM? +A: Yes, you can use the file output and have the file monitor by a SIEM agent. +Alternatively check out [Akamai Universal Log Streamer (ULS)](https://github.com/akamai/uls) which offer TCP, UDP, HTTP and File output with a lot of flexibility! Will there be a cli-sia? A: Maybe. We keep maintaining `cli-etp` and the project might be renamed to `cli-sia` at some point. diff --git a/bin/akamai-etp b/bin/akamai-etp index 9d20b3e..0fb778d 100755 --- a/bin/akamai-etp +++ b/bin/akamai-etp @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2022 Akamai Technologies, Inc. All Rights Reserved +# Copyright 2023 Akamai Technologies, Inc. All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ from requests.compat import urljoin from akamai.edgegrid import EdgeGridAuth, EdgeRc from config import EdgeGridConfig -__version__ = "0.4.2" +__version__ = "0.4.3" #: Window span in ad-hoc mode, default is 3 min span_duration_min = 3 @@ -266,7 +266,7 @@ def fetch_event_page(start, end, page_number, thread_pool, pool_futures, stats, post_data = { 'startTimeSec': start, 'endTimeSec': end, - 'orderBy': "DESC", + 'orderBy': "ASC", 'pageNumber': page_number, 'pageSize': EVENT_PAGE_SIZE, 'filters': {} diff --git a/cli.json b/cli.json index b294759..05e41d5 100755 --- a/cli.json +++ b/cli.json @@ -5,7 +5,7 @@ "commands": [ { "name": "etp", - "version": "0.4.2", + "version": "0.4.3", "description": "Akamai CLI for Secure Internet Access Enterprise (f.k.a. Enterprise Threat Protector)" } ] diff --git a/test/test.bash b/test/test.bash deleted file mode 100755 index d6c824f..0000000 --- a/test/test.bash +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -dir=$(cd .. && pwd -P) - -echo "Starting akamai cli etp tests..." - -total_pass=0 -total_fail=0 - -function test_result() { - if [[ $1 == 0 ]]; then - pass "[PASS] $2" - total_pass=$(($total_pass + 1)) - else - error "[FAIL] $2" - total_fail=$(($total_fail + 1)) - fi -} - -function pass() { - GREEN='\033[0;32m' - NC='\033[0m' # No Color - printf "${GREEN}$1${NC}\n" -} - -function error() { - RED='\033[0;31m' - NC='\033[0m' # No Color - printf "${RED}$1${NC}\n" -} - -if [ "$1" == "cli" ]; then - # Native Akamai CLI - interpreter='akamai etp -v' -else - # For development purpose - if type -t deactivate > /dev/null; then - deactivate - fi - . $dir/venv/bin/activate - interpreter="$dir/bin/akamai-etp -v" -fi - -etp_config_id=$(grep etp_config_id ~/.edgerc|awk '{print $3}') -if [[ "$etp_config_id" == "" ]]; then - echo "ERROR: cannot extract etp_config_id in ~/.edgerc" - exit 2 -fi - -random_ip="1.2.3.$(($RANDOM % 255))" -random_ip2="3.2.1.$(($RANDOM % 255))" -random_ip3="12.34.56.$(($RANDOM % 255))" - -random_host="host-$random_ip.test.akamai.com" -random_host2="host2-$random_ip.test.akamai.com" -random_host3="host3-$random_ip.test.akamai.com" - -# Version - -$interpreter version -test_result $? "Display cli-etp version" - -# Pull events - -$interpreter event aup -test_result $? "Fetch recent AUP events" -$interpreter event threat -test_result $? "Fetch recent Threat events" - -# List management -$interpreter list get -test_result $? "Fetch security lists" - -random_listid=$($interpreter list get|sort -R| head -n 1|cut -f1 -d,) -test_result $? "Pick a random list to work with" - -$interpreter list add $etp_config_id $random_ip -test_result $? "Add IP to the list $random_listid" - -$interpreter list add $etp_config_id $random_ip2 $random_ip3 -$interpreter list add $etp_config_id $random_host -$interpreter list add $etp_config_id $random_host2 $random_host3 -$interpreter list remove $etp_config_id $random_ip -$interpreter list remove $etp_config_id $random_ip2 $random_ip3 -$interpreter list remove $etp_config_id $random_host -$interpreter list remove $etp_config_id $random_host2 $random_host3 -$interpreter list deploy $etp_config_id - -if type -t deactivate > /dev/null; then - deactivate -fi - -error "Total error(s): $total_fail" -pass "Total success(es): $total_pass" - -echo "Test completed." \ No newline at end of file