mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-08 03:10:49 -08:00
Translated ['.github/pull_request_template.md', 'src/pentesting-cloud/az
This commit is contained in:
@@ -1,79 +1,71 @@
|
||||
# OpenShift - Tekton
|
||||
|
||||
**The original author of this page is** [**Haroun**](https://www.linkedin.com/in/haroun-al-mounayar-571830211)
|
||||
**このページの元の著者は** [**Haroun**](https://www.linkedin.com/in/haroun-al-mounayar-571830211)
|
||||
|
||||
### What is tekton
|
||||
### Tektonとは
|
||||
|
||||
According to the doc: _Tekton is a powerful and flexible open-source framework for creating CI/CD systems, allowing developers to build, test, and deploy across cloud providers and on-premise systems._ Both Jenkins and Tekton can be used to test, build and deploy applications, however Tekton is Cloud Native. 
|
||||
ドキュメントによると:_Tektonは、開発者がクラウドプロバイダーやオンプレミスシステム全体でビルド、テスト、デプロイを行うことを可能にする、強力で柔軟なオープンソースのCI/CDシステムを作成するためのフレームワークです。_ JenkinsとTektonの両方を使用してアプリケーションをテスト、ビルド、デプロイできますが、Tektonはクラウドネイティブです。 
|
||||
|
||||
With Tekton everything is represented by YAML files. Developers can create Custom Resources (CR) of type `Pipelines` and specify multiple `Tasks` in them that they want to run. To run a Pipeline resources of type `PipelineRun` must be created.
|
||||
Tektonでは、すべてがYAMLファイルで表現されます。開発者は`Pipelines`タイプのカスタムリソース(CR)を作成し、実行したい複数の`Tasks`を指定できます。Pipelineを実行するには、`PipelineRun`タイプのリソースを作成する必要があります。
|
||||
|
||||
When tekton is installed a service account (sa) called pipeline is created in every namespace. When a Pipeline is ran, a pod will be spawned using this sa called `pipeline` to run the tasks defined in the YAML file.
|
||||
Tektonがインストールされると、各ネームスペースに`pipeline`というサービスアカウント(sa)が作成されます。Pipelineが実行されると、このsaを使用してYAMLファイルで定義されたタスクを実行するために`pipeline`という名前のポッドが生成されます。
|
||||
|
||||
{{#ref}}
|
||||
https://tekton.dev/docs/getting-started/pipelines/
|
||||
{{#endref}}
|
||||
|
||||
### The Pipeline service account capabilities
|
||||
|
||||
By default, the pipeline service account can use the `pipelines-scc` capability. This is due to the global default configuration of tekton. Actually, the global config of tekton is also a YAML in an openshift object called `TektonConfig` that can be seen if you have some reader roles in the cluster.
|
||||
### Pipelineサービスアカウントの機能
|
||||
|
||||
デフォルトでは、pipelineサービスアカウントは`pipelines-scc`機能を使用できます。これは、Tektonのグローバルデフォルト設定によるものです。実際、Tektonのグローバル設定も、クラスター内でいくつかのリーダーロールを持っている場合に見ることができる`TektonConfig`というOpenShiftオブジェクトのYAMLです。
|
||||
```yaml
|
||||
apiVersion: operator.tekton.dev/v1alpha1
|
||||
kind: TektonConfig
|
||||
metadata:
|
||||
name: config
|
||||
name: config
|
||||
spec:
|
||||
...
|
||||
...
|
||||
platforms:
|
||||
openshift:
|
||||
scc:
|
||||
default: "pipelines-scc"
|
||||
...
|
||||
...
|
||||
platforms:
|
||||
openshift:
|
||||
scc:
|
||||
default: "pipelines-scc"
|
||||
```
|
||||
どの名前空間でも、パイプラインサービスアカウントトークンを取得できれば、`pipelines-scc`を使用できるようになります。
|
||||
|
||||
In any namespace, if you can get the pipeline service account token you will be able to use `pipelines-scc`.
|
||||
|
||||
### The Misconfig
|
||||
|
||||
The problem is that the default scc that the pipeline sa can use is user controllable. This can be done using a label in the namespace definition. For instance, if I can create a namespace with the following yaml definition:
|
||||
### 誤設定
|
||||
|
||||
問題は、パイプラインSAが使用できるデフォルトのSCCがユーザーによって制御可能であることです。これは、名前空間定義のラベルを使用して行うことができます。たとえば、次のyaml定義で名前空間を作成できる場合:
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: test-namespace
|
||||
annotations:
|
||||
operator.tekton.dev/scc: privileged
|
||||
name: test-namespace
|
||||
annotations:
|
||||
operator.tekton.dev/scc: privileged
|
||||
```
|
||||
The tekton operatorは、`test-namespace`のパイプラインサービスアカウントにscc privilegedを使用する権限を与えます。これにより、ノードのマウントが可能になります。
|
||||
|
||||
The tekton operator will give to the pipeline service account in `test-namespace` the ability to use the scc privileged. This will allow the mounting of the node.
|
||||
### 修正方法
|
||||
|
||||
### The fix
|
||||
|
||||
Tekton documents about how to restrict the override of scc by adding a label in the `TektonConfig` object.
|
||||
Tektonは、`TektonConfig`オブジェクトにラベルを追加することでsccのオーバーライドを制限する方法について文書化しています。
|
||||
|
||||
{{#ref}}
|
||||
https://tekton.dev/docs/operator/sccconfig/
|
||||
{{#endref}}
|
||||
|
||||
This label is called `max-allowed` 
|
||||
|
||||
このラベルは`max-allowed`と呼ばれます。
|
||||
```yaml
|
||||
apiVersion: operator.tekton.dev/v1alpha1
|
||||
kind: TektonConfig
|
||||
metadata:
|
||||
name: config
|
||||
name: config
|
||||
spec:
|
||||
...
|
||||
...
|
||||
platforms:
|
||||
openshift:
|
||||
scc:
|
||||
default: "restricted-v2"
|
||||
maxAllowed: "privileged"
|
||||
...
|
||||
...
|
||||
platforms:
|
||||
openshift:
|
||||
scc:
|
||||
default: "restricted-v2"
|
||||
maxAllowed: "privileged"
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user