GithubHelp home page GithubHelp logo

arvindmits / pythonsecuritypipeline Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pawnu/pythonsecuritypipeline

0.0 1.0 0.0 193 KB

DevSecOps pipeline for Python based project using Jenkins, Ansible, AWS, and open-source security tools and checks.

License: MIT License

Dockerfile 26.78% Shell 18.66% Groovy 18.12% Python 36.45%

pythonsecuritypipeline's Introduction

DevSecOps pipeline for Python project

A Jenkins end-to-end DevSecOps pipeline for Python web application, hosted on AWS Ubuntu 18.04

pipeline

psparchitecture

Disclaimer: This project is for demonstration purpose with surface level checks only, do not use it as-is for production

Checkout project - check out python application project repository with XSS vulnerability

git secret check - check there is no password/token/keys/secrets accidently commited to project github

SCA - check external dependencies/libraries used by the project have no known vulnerabilities

SAST - static analysis of the application source code for exploits, bugs, vulnerabilites

Container audit - audit the container that is used to deploy the python application

DAST - deploy the application, register, login, attack & analyse it from the frontend as authenticated user

System security audit - analyse at the security posture of the system hosting the application

WAF - deploy application with WAF which will filter malicious requests according to OWASP core ruleset

Installation steps

  1. Clone this repository to your Ubuntu Server (t2-medium recommended)
git clone https://github.com/pawnu/PythonSecurityPipeline.git
  1. Edit the code to make it work on your AWS

    • Change to your AWS subnet vpc_subnet_id
    • Change to your AWS security_group (allow inbound ssh(22), WAF(80), Optional web-app(10007) from your IP ONLY)
    • Create an IAM role which gives full-ec2-access and assign it to your ubuntu server
  2. Run the setup script to create CICD server with Jenkins+pipeline ready to go

cd PythonSecurityPipeline
sudo sh setup-ubuntu.sh
  1. Make sure your firewall allows incoming traffic to port 8080. Then, go to your jenkins server URL
http://your-jenkins-server:8080/
  1. Use the temporary credentials provided on the logs to login. Change your password!
  2. Go to the python pipeline project dashboard, click on "Build Now" button to start it off.

Setting up a Jenkins Pipeline project manually

A sample pipeline is already provided through automation

  1. Click on New Item, input name for your project and select Pipeline as the option and click OK.
  2. Scroll down to Pipeline section - Definition, select "Pipeline script from SCM" from drop down menu.
  3. Select Git under SCM, and input Repository URL.
  4. (Optional) Create and Add your credentials for the Git repo if your repo is private, and click Save.
  5. You will be brought to the Dashboard of your Pipeline project, click on "Build Now" button to start off the pipeline.

To do list:

  • Select appropriate security tools and sample python project
  • Set up Jenkins server using docker (Dockerfile) and pipeline as code (Jenkinsfile) to run the checks
  • Use ansible to create AWS ec2 test instance, configure the environment, and interact with it
  • Hook up the web-app with nginx+modsecurity providing WAF, DDoS protection, reverse proxy capabilities
  • Bootstrap with Jenkins API/configfile to setup and automatically create the pipeline job
  • Carry out authenticated DAST scan on the python web app

Demo

finalgif4

Report

workspace

Authors

pythonsecuritypipeline's People

Contributors

pawnu avatar ibmappsec avatar initcron avatar

Watchers

 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.