Concourse Lab Creation
Reading time: 5 minutes
tip
AWS 해킹 배우기 및 연습하기:HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 배우기 및 연습하기: HackTricks Training GCP Red Team Expert (GRTE)
Azure 해킹 배우기 및 연습하기:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks 지원하기
- 구독 계획 확인하기!
- **💬 Discord 그룹 또는 텔레그램 그룹에 참여하거나 Twitter 🐦 @hacktricks_live를 팔로우하세요.
- HackTricks 및 HackTricks Cloud 깃허브 리포지토리에 PR을 제출하여 해킹 트릭을 공유하세요.
Testing Environment
Running Concourse
With Docker-Compose
이 docker-compose 파일은 concourse로 몇 가지 테스트를 수행하기 위한 설치를 간소화합니다:
wget https://raw.githubusercontent.com/starkandwayne/concourse-tutorial/master/docker-compose.yml
docker-compose up -d
당신은 웹에서 127.0.0.1:8080
에서 자신의 OS에 맞는 명령줄 fly
를 다운로드할 수 있습니다.
Kubernetes를 사용하여 (권장)
당신은 helm-chart를 사용하여 Kubernetes(예: minikube)에 concourse를 쉽게 배포할 수 있습니다: concourse-chart.
brew install helm
helm repo add concourse https://concourse-charts.storage.googleapis.com/
helm install concourse-release concourse/concourse
# concourse-release will be the prefix name for the concourse elements in k8s
# After the installation you will find the indications to connect to it in the console
# If you need to delete it
helm delete concourse-release
concourse 환경을 생성한 후, 비밀을 생성하고 concourse 웹에서 실행 중인 SA가 K8s 비밀에 접근할 수 있도록 권한을 부여할 수 있습니다:
echo 'apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: read-secrets
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: read-secrets-concourse
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: read-secrets
subjects:
- kind: ServiceAccount
name: concourse-release-web
namespace: default
---
apiVersion: v1
kind: Secret
metadata:
name: super
namespace: concourse-release-main
type: Opaque
data:
secret: MWYyZDFlMmU2N2Rm
' | kubectl apply -f -
파이프라인 생성
파이프라인은 Jobs의 목록으로 구성되며, 여기에는 Steps의 순서가 있는 목록이 포함됩니다.
단계
여러 가지 유형의 단계가 사용될 수 있습니다:
- the
task
step 는 task를 실행합니다. - the
get
step는 resource를 가져옵니다. - the
put
step는 resource를 업데이트합니다. - the
set_pipeline
step는 pipeline을 구성합니다. - the
load_var
step는 값을 local var에 로드합니다. - the
in_parallel
step는 단계를 병렬로 실행합니다. - the
do
step는 단계를 순차적으로 실행합니다. - the
across
step modifier는 변수가 있는 값의 조합마다 한 번씩 단계를 여러 번 실행합니다. - the
try
step는 단계를 실행하려고 시도하며, 단계가 실패하더라도 성공합니다.
각 step은 job plan에서 자신의 컨테이너에서 실행됩니다. 컨테이너 내에서 원하는 모든 것을 실행할 수 있습니다 (예: 내 테스트 실행, 이 bash 스크립트 실행, 이 이미지 빌드 등). 따라서 다섯 개의 단계가 있는 작업이 있다면 Concourse는 각 단계마다 하나씩 다섯 개의 컨테이너를 생성합니다.
따라서 각 단계가 실행될 컨테이너의 유형을 지정하는 것이 가능합니다.
간단한 파이프라인 예제
jobs:
- name: simple
plan:
- task: simple-task
privileged: true
config:
# Tells Concourse which type of worker this task should run on
platform: linux
image_resource:
type: registry-image
source:
repository: busybox # images are pulled from docker hub by default
run:
path: sh
args:
- -cx
- |
sleep 1000
echo "$SUPER_SECRET"
params:
SUPER_SECRET: ((super.secret))
fly -t tutorial set-pipeline -p pipe-name -c hello-world.yml
# pipelines are paused when first created
fly -t tutorial unpause-pipeline -p pipe-name
# trigger the job and watch it run to completion
fly -t tutorial trigger-job --job pipe-name/simple --watch
# From another console
fly -t tutorial intercept --job pipe-name/simple
127.0.0.1:8080에서 파이프라인 흐름을 확인하세요.
출력/입력 파이프라인이 있는 Bash 스크립트
하나의 작업 결과를 파일에 저장하고 이를 출력으로 표시한 다음, 다음 작업의 입력을 이전 작업의 출력으로 표시할 수 있습니다. concourse가 하는 일은 이전 작업의 디렉토리를 새로운 작업에 마운트하여 이전 작업에서 생성된 파일에 접근할 수 있게 하는 것입니다.
트리거
작업을 수동으로 매번 실행할 필요는 없으며, 매번 실행되도록 프로그래밍할 수도 있습니다:
- 시간이 경과함: Time resource
- 메인 브랜치에 새로운 커밋이 있을 때: Git resource
- 새로운 PR: Github-PR resource
- 앱의 최신 이미지를 가져오거나 푸시: Registry-image resource
마스터에 새로운 커밋이 있을 때 트리거되는 YAML 파이프라인 예제를 확인하세요: https://concourse-ci.org/tutorial-resources.html
tip
AWS 해킹 배우기 및 연습하기:HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 배우기 및 연습하기: HackTricks Training GCP Red Team Expert (GRTE)
Azure 해킹 배우기 및 연습하기:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks 지원하기
- 구독 계획 확인하기!
- **💬 Discord 그룹 또는 텔레그램 그룹에 참여하거나 Twitter 🐦 @hacktricks_live를 팔로우하세요.
- HackTricks 및 HackTricks Cloud 깃허브 리포지토리에 PR을 제출하여 해킹 트릭을 공유하세요.