Giter Site home page Giter Site logo

c0c1 / get-azure-cdn-ips Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gelob/get-azure-cdn-ips

0.0 0.0 0.0 4 KB

Simple bash script to spit out IPs from Azure's CDN EdgeNodes API endpoint

License: BSD 3-Clause Clear License

Shell 100.00%

get-azure-cdn-ips's Introduction

get-azure-cdn-ips

A simple bash script to get IP subnets from Azure's CDN EdgeNodes API

This repository contains two bash scripts that query the EdgeNodes API to return a list of IPv4 or IPv6 subnets.

  • getips.sh - very simple bash script that returns a list of subnets to stdout
  • getips-cron.sh - based off the above script, except it has more error checking, outputs the list of subnets to text files, and the original JSON response. It is responsible for generating the files in azure-cdn-ips.

Requirements

  • bash
  • curl
  • jq
  • git

Usage

getips.sh

You need to edit the script to provide your Azure App API token details. See my blog post for details on how to generate one.

You'll need 3 things:

  1. Directory (tenant) ID - [tenantid]
  2. Application (client) ID - [clientid]
  3. Client Secret - [clientsecret] Run ./getips.sh to get a list of IPv4 subnets. Run ./getips.sh 6 to get a list of IPv6 subnets
getips-cron.sh

Same as above but you also need edit two additional variables:

  1. installdir - Where the bash script will live and log file will be written to (default: /opt/azure)
  2. gitdir - Where the downloaded files will live, you will have to run git init in this directory and setup a remote repoistory if you want it to push) (default: /opt/azure/getips)

The script will write 4 files to the directory specified in gitdir upon successful execution

  • edgenodes-ipv4.txt - contains IP/CIDR formatted list of IPv4 Addresses
  • edgenodes-ipv6.txt - contains IP/CIDR formatted list of IPv6 Addresses
  • edgenodes.json - contains raw JSON output from the Azure API
  • lastrun - contains the date the script last ran

If any errors are detected they will be logged to the directory specified in installdir/getips.log

Community

Want to contribute, or have comments? Feel free to open an issue

License

Clear BSD License

get-azure-cdn-ips's People

Contributors

gelob avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.