Giter VIP home page Giter VIP logo

jiraautoaddip's Introduction

JiraAutoAddIP

Purpose

When you work sometimes you find yourself in doing very very boring & recurring tasks. These tasks often follow the same pattern with the same content changing only some variables. One scenario is for example when you have to add some IPs in a whitelist for allowing them connect to an EC2 instance.

Automation

The client asks you to whitelist (or remove) some IPs to allow him to connect to an EC2 instance. He opens a Ticket with the Jira platform, with Jira we can configure webhooks when these kinds of events happen. When a new ticket is opened Jira send a request to our webhook & based on the ticket summary he is gonna decide if add (or remove) the ip from the Security Group attached to the EC2 instance through AWS API. Once the operation is made the webhook will reply to the ticket & update the ticket status to Done.

Security

The biggest concern here is that the webhook add | remove from the whitelist every single ip in the ticket body without any kind of check, that maybe at a human eye could cause concerns. So we here trust the client request at closed eye.

Made with fun & good libraries

  • boto3 (library for using aws api)
  • jira (library for using jira api)
  • fastapi (for realizing our webhook)

Installation

  1. Clone it

    git clone https://github.com/IadRabbit/JiraAutoAddIP.git
  2. Create environment

    cd JiraAutoAddIP && python3 -m venv .env && source .env/bin/activate
  3. Install dependencies

    pip3 install -r req.txt
  4. check scrts.py and modify it with your own settings

  5. Create an IAM user with a proper policy that is able to add & remove IP from security group then edit or create .aws/config and add a profile with this name it should looks something like this

    [profile add_ip]
    aws_access_key_id = AKITHECATISONTHETABgdWFN
    aws_secret_access_key = mlzWISEEYOUlY4gsgtW
    region = eu-central-1

    [!IMPORTANT] profile name must be add_ip

  6. Run

    uvicorn webhook:app --host 0.0.0.0 --port 8000

    [!NOTE] If you are in development use --reload, it helps

jiraautoaddip's People

Watchers

Federico Zota 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.