Concourse Lab Creation

htARTE (HackTricks AWS Red Team Expert)를 통해 AWS 해킹을 처음부터 전문가까지 배워보세요!

HackTricks를 지원하는 다른 방법:

테스트 환경

Concourse 실행

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에서 웹에서 운영 체제에 맞는 명령 줄 fly를 다운로드 할 수 있습니다.

Kubernetes로 (권장)

concourse-chart를 사용하여 Kubernetes(예: minikube)에 쉽게 concourse를 배포할 수 있습니다.

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 env를 생성한 후, 비밀을 생성하고 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 -

파이프라인 생성

파이프라인은 작업 목록으로 구성되며, 각 작업은 단계의 순서가 있는 목록입니다.

단계

다양한 유형의 단계를 사용할 수 있습니다:

작업 계획단계독립적인 컨테이너에서 실행됩니다. 컨테이너 내에서 원하는 작업을 실행할 수 있습니다. (예: 테스트 실행, 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는 이전 작업의 디렉토리를 새 작업에 마운트하여 이전 작업에서 생성된 파일에 액세스할 수 있도록 합니다.

트리거

작업을 수동으로 실행할 필요 없이, 프로그램을 실행할 때마다 실행되도록 할 수도 있습니다:

https://concourse-ci.org/tutorial-resources.html에서 메인 브랜치에 새로운 커밋이 있을 때 트리거되는 YAML 파이프라인 예제를 확인하세요.

htARTE (HackTricks AWS Red Team Expert)를 통해 AWS 해킹을 처음부터 전문가까지 배워보세요!

HackTricks를 지원하는 다른 방법:

最終更新