📋
A Journey From IT to IT Security
  • IT Training Resources
  • IT Security Roles
    • Web Application Security Specialist
      • Training Guide
      • Self-hosted Training Lab
        • Vulnerable Web Apps
      • Web Security testing Methodology
        • 1 Footprinting
        • 2 Scanning
        • 3 Enumeration
        • 4 Gaining Access
        • 5 Maintain Access
        • 6 Covering Tracks
        • 7 Vulnerability assessment
    • DevSecOps Engineer
      • Training Guide
      • Building a DevSecOps CD/CI Pipeline
        • Self-hosted DevOps CD/CI platforms
        • Software Component Analysis (SCA)
        • Static Application Security Testing (SAST)
        • Dynamic Application Security Testing (DAST)
        • System Hardening
        • System Compliance Analysis
        • Vulnerability Analysis
      • Ready-to-use and train DevSecOps CD/CI Pipeline
    • Chief Information Security Officer (CISO)
    • Digital Forensics Investigator
      • Forensics Methodology
    • Cloud Security Engineer
      • Getting started with kubernetes
  • Resources
    • IT Basics
      • Networking Basics Study Guide
      • RBAC / ABAC
      • Anonymous Surfing
      • Python Programming
      • Infrastructure as code
      • Containers
        • Docker
        • Docker security
      • The Security Development Lifecycle (SDL)
    • Literature
    • Useful Tool Tutorials
    • Useful Online Tools
    • Exploits
  • Unsorted
    • Gitlab-ci with docker-compose
Powered by GitBook
On this page
  • Gitlab CI
  • Gitlab-ci on a virtual machine
  • Add runners
  • Push a vulnerable app to gitlab
  • Jenkins CI
  • Travis CI
  • Github Actions
  1. IT Security Roles
  2. DevSecOps Engineer
  3. Building a DevSecOps CD/CI Pipeline

Self-hosted DevOps CD/CI platforms

PreviousBuilding a DevSecOps CD/CI PipelineNextSoftware Component Analysis (SCA)

Last updated 3 years ago

Gitlab CI

I recommend gitlab CI if you want to experiment how to integrate different tools into a CD/CI. Gitlab has a professional version, so the private installation is limited in features.

Before installing anything on your local machine or VM check the system requirements here .

Gitlab-ci on a virtual machine

Recommended solution

Install your own gitlab server on a virtual machine as described in

Register your local machine as a runner and run it with gitlab-runner --debug run to see if it connects to the server. Why should you register your local computer as a runner? If your build steps run locally, then they will also run successfully with your local gitlab runner. Don't forget to try everything before putting it into a pipeline. Also test if your docker container runs sucessfully on you local machien before setting it up in the pipeline.

Thank you embedded inventor for the detailed tutorial!

Add runners

Docs

With docker-compose on the local machine

There is already a running instance thanks to our dockerfile. We need to enter the container and register the runner with:

docker container exec -it gitlab-runner /bin/bash
$ 
gitlab-runner register \
  --non-interactive \
  --locked=false \
  --description=local \
  --url=https://localhost \
  --registration-token=o8Yesbgz5hPWVLQqxWF3 \
  --executor=docker \
  --docker-image=debian \
  --docker-volumes "/var/run/docker.sock:/var/run/docker.sock"

With docker on the local machine

docker run -d --name gitlab-runner --restart always \
     -v /srv/gitlab-runner/config:/etc/gitlab-runner \
     -v /var/run/docker.sock:/var/run/docker.sock \
     gitlab/gitlab-runner:latest

Push a vulnerable app to gitlab

  1. Create a namespace (group) and call it vulnlab, create a project in your gitlab instance with name dsvw

  2. Read your public ssh key and enter it in the ssh key sections of your user in gitlab cat ~/.ssh/id_rsa.pub

  3. Push it to you local gitlab instance git push --set-upstream git@localhost:vulnlab/dsvw.git

Jenkins CI

I recommend jenkins if you want to learn how to configure your CD/CI server in detail. Jenkins is completely free of charge and open source. No sign-up, no limits. It is more difficult to maintain than the other platforms. Jenkinsfiles that describe the pipeline workflow are less human friendly than the yaml description files used by many other systems.

Travis CI

You to sign-up for the free version.

Github Actions

If your code is hosted on github in a public repository you can use the free version of Github actions without limits. You don't need to install your own CD/CI server. I recommend this option if you want to test some tools and quickly get their output for further analysis.

You need to sign-up an account in order to use it.

For private repos there is the following limit as of mai 2021:

  • 2,000 automation minutes/month

  • 500MB of Packages storage

I found the solution here:

Add a docker container with the gitlab-runner image. See for more info.

Clone a vulnerable app from github (see ), for instance git clone

Start building your pipeline!

run the docker container described here

Sales arguments for using travis over jenkins:

🏁
https://docs.gitlab.com/ee/install/requirements.html
https://embeddedinventor.com/complete-guide-to-setting-up-gitlab-locally-on-mac/#STEP4_Create_and_edit_gitlab_ciyml_to_run_the_above_script
https://docs.gitlab.com/runner/
https://gitlab.com/gitlab-org/gitlab/-/issues/23911
https://docs.gitlab.com/runner/
Vulnerable Web Apps
https://github.com/stamparm/DSVW.git
https://www.jenkins.io/doc/book/installing/docker/
https://travis-ci.com/travisci-vs-jenkins
LogoFeatures • GitHub ActionsGitHub