mirror of
https://github.com/devitq/homelab.git
synced 2026-11-20 10:17:39 +00:00
init(): initial commit
This commit is contained in:
216 files changed
+36511
No files matched your search
@@ -0,0 +1,45 @@
|
|||||||
|
name: Lint & validate Kubernetes manifests
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '**/*.yaml'
|
||||||
|
- '**/*.yml'
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: 'stable'
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install tools
|
||||||
|
run: |
|
||||||
|
pip install yamllint
|
||||||
|
go install github.com/google/yamlfmt/cmd/yamlfmt@latest
|
||||||
|
go install github.com/yannh/kubeconform/cmd/kubeconform@latest
|
||||||
|
go install golang.stackrox.io/kube-linter/cmd/kube-linter@latest
|
||||||
|
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
- name: yamllint
|
||||||
|
run: yamllint .
|
||||||
|
|
||||||
|
- name: yamlfmt (check only, no writes)
|
||||||
|
run: yamlfmt -lint .
|
||||||
|
|
||||||
|
- name: kube-linter
|
||||||
|
run: kube-linter lint --config .kube-linter.yaml proxmox/manifests
|
||||||
|
|
||||||
|
- name: kubeconform
|
||||||
|
run: |-
|
||||||
|
kubeconform -strict -summary -ignore-missing-schemas \
|
||||||
|
-kubernetes-version 1.36.1 proxmox/manifests
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.DS_Store
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
checks:
|
||||||
|
# Keep KubeLinter's built-in default checks
|
||||||
|
# no-read-only-root-fs, unset-cpu-requirements, unset-memory-requirements, host-network/-pid, latest-tag, privileged-container, privilege-escalation-container, pdb-*, unsafe-sysctls, no-anti-affinity, env-var-secret, dangling-service, ...
|
||||||
|
doNotAutoAddDefaults: false
|
||||||
|
|
||||||
|
include:
|
||||||
|
- no-liveness-probe
|
||||||
|
- no-readiness-probe
|
||||||
|
|
||||||
|
- unset-cpu-requirements
|
||||||
|
- unset-memory-requirements
|
||||||
|
|
||||||
|
- run-as-non-root
|
||||||
|
- default-service-account
|
||||||
|
- deprecated-service-account-field
|
||||||
|
|
||||||
|
- wildcard-in-rules
|
||||||
|
- writable-host-mount
|
||||||
|
- read-secret-from-env-var
|
||||||
|
- privileged-ports
|
||||||
|
|
||||||
|
- no-rolling-update-strategy
|
||||||
|
- minimum-three-replicas
|
||||||
|
- hpa-minimum-three-replicas
|
||||||
|
|
||||||
|
- dangling-ingress
|
||||||
|
- dangling-networkpolicy
|
||||||
|
- dangling-horizontalpodautoscaler
|
||||||
|
- dangling-servicemonitor
|
||||||
|
|
||||||
|
exclude: []
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/adrienverge/yamllint.git
|
||||||
|
rev: v1.38.0
|
||||||
|
hooks:
|
||||||
|
- id: yamllint
|
||||||
|
args: [--strict]
|
||||||
|
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: yamlfmt
|
||||||
|
name: yamlfmt (format YAML)
|
||||||
|
entry: yamlfmt
|
||||||
|
language: system
|
||||||
|
types: [yaml]
|
||||||
|
|
||||||
|
- id: kubeconform
|
||||||
|
name: kubeconform (validate against k8s API schema)
|
||||||
|
entry: kubeconform -strict -summary -ignore-missing-schemas -kubernetes-version 1.34.0
|
||||||
|
language: system
|
||||||
|
files: ^proxmox/manifests/.*\.ya?ml$
|
||||||
|
|
||||||
|
- id: kube-linter
|
||||||
|
name: kube-linter (best-practice & security checks)
|
||||||
|
entry: kube-linter lint --config .kube-linter.yaml proxmox/manifests
|
||||||
|
language: system
|
||||||
|
pass_filenames: false
|
||||||
|
files: ^proxmox/manifests/.*\.ya?ml$
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
creation_rules:
|
||||||
|
- path_regex: '\.yaml$'
|
||||||
|
pgp: B13C2DAF24268258F525697A063A10A651314CE9
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
include:
|
||||||
|
- "**/*.yaml"
|
||||||
|
- "**/*.yml"
|
||||||
|
|
||||||
|
exclude:
|
||||||
|
- "**/vendor/**"
|
||||||
|
- "**/node_modules/**"
|
||||||
|
- "**/charts/**/templates/**"
|
||||||
|
|
||||||
|
line_ending: lf
|
||||||
|
|
||||||
|
formatter:
|
||||||
|
type: basic
|
||||||
|
indent: 2
|
||||||
|
include_document_start: false
|
||||||
|
retain_line_breaks_single: true
|
||||||
|
trim_trailing_whitespace: true
|
||||||
|
eof_newline: true
|
||||||
|
pad_line_comments: 1
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
extends: default
|
||||||
|
|
||||||
|
yaml-files:
|
||||||
|
- '*.yaml'
|
||||||
|
- '*.yml'
|
||||||
|
- '.yamllint.yaml'
|
||||||
|
|
||||||
|
ignore: |
|
||||||
|
vendor/
|
||||||
|
node_modules/
|
||||||
|
charts/**/templates/**
|
||||||
|
|
||||||
|
rules:
|
||||||
|
document-start: disable
|
||||||
|
|
||||||
|
line-length:
|
||||||
|
max: 120
|
||||||
|
level: warning
|
||||||
|
|
||||||
|
indentation:
|
||||||
|
spaces: 2
|
||||||
|
indent-sequences: consistent
|
||||||
|
|
||||||
|
truthy:
|
||||||
|
allowed-values: ['true', 'false']
|
||||||
|
check-keys: false
|
||||||
|
|
||||||
|
comments:
|
||||||
|
min-spaces-from-content: 1
|
||||||
|
|
||||||
|
braces:
|
||||||
|
max-spaces-inside: 1
|
||||||
|
|
||||||
|
brackets:
|
||||||
|
max-spaces-inside: 0
|
||||||
|
|
||||||
|
empty-lines:
|
||||||
|
max: 1
|
||||||
|
max-end: 1
|
||||||
|
|
||||||
|
trailing-spaces: enable
|
||||||
|
new-line-at-end-of-file: enable
|
||||||
|
key-duplicates: enable
|
||||||
|
|
||||||
|
hyphens:
|
||||||
|
max-spaces-after: 1
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Homelab Configurations
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Install lint tools
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install yamllint
|
||||||
|
|
||||||
|
brew install kubeconform
|
||||||
|
brew install kube-linter
|
||||||
|
brew install yamlfmt
|
||||||
|
```
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3938.112484931551 2312.14211963582" width="3938.112484931551" height="2312.14211963582" class="excalidraw-svg"><!-- svg-source:excalidraw --><metadata></metadata><defs><style class="style-fonts">
|
||||||
|
@font-face { font-family: Excalifont; src: url(data:font/woff2;base64,d09GMgABAAAAACXgAA4AAAAARTgAACWIAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGiIbkxwcghwGYACBBBEICulYzggLfgABNgIkA4F4BCAFgxgHIBv3NSMDwcYBCKD4xsj++oCOa7EOZascTMo2OFYixhsGE+sFR1xhZlWXtX3um5WvtFRaKu1D3TJCklniP/Z73XvCqP5EKWIZj6zC1RWawMq61jh+Q/yc/j1NnJhBhCQQTANFIo6FIF4IeKE0iLVOV6CO1Iz6rPX92jYqts5aX+0XurrODucys23fIdLBQL0QZnJKBfQCoP9Vwgn3P4B//59y8/+TbWZ7ZiZCyxUgUH1S2j4RR56s+mV5F6tvsOVuMyTBagnBWvpvaWn9ukwyXw7VVfi/gzZdjO2nVMUEx7dXfXVFL7VSO6NxAMPuyhZh4y+wKV0MsvT305rdf0dTzDxgfKl2haULg1AY8/OuvhSSyVKSfFr7UVdbKLUJdYNwyVLvepZS63iUQKIEq07IcxoH3iGMQ2U48dyQ3Gba8RCnaky17zOWGhFj+b2iAvQDGQgC06No4kASJIIKn0+vMDro8mpqNhAddjU3ANFpc1U9EF25WxuBCAoQQ5zL4+YlEQMEkHC3DB8Y0SeCO6+VrNX1octHQlpxqJ4Gh64ZE5x+v06/Ue+Qa9L5D2+GBBSOeGps4xKy9Rby9p6Q6+0K4O/mvYzCGdZjAyEgss7See041q+Rdxp9RdrYgHPba5CzDaSaMk3JNXbZanEy/FqAHdryUDnnRD4LxZq7NnbRmjYhYUodWgobwwt2CFcTTw8wcIGFqA/UVMBvNjkU4mUZCNRpXbuzLhTq8QR3GWt5oVYK48C6NM5aA8dxEiyDUvACL9Z9YbYuflHv7Quti01oDTIocALQJyF0zCVw8cIFfBGp+OEIIPAF8RgeKoJQjDjeEknymnBYAhZgAgk/mmJ0t7CBMDREL2QTCTCZGhQobw6XGAl8IMGHk1H5koimNo0QD53ILPfCAIqMIBhaaQHAGhnIRfl2GKATpTYJGQUVjUTXjCuGMeu+mDFrogk7RoQHsKkxAkJAG80KJFxKcqcOPidVJ9iIoe38Md5Gq9/OE9q1mul1eT31UBQNFulrdhahCwjebgNrrYQxwAQUBiSEXBJAaIDxApgQYN6AUCTjlFSI1EDlDwShQBQORJFAptUoRBMBDNIyIHQAKhQKS4fyqLmNNi+byQjphZlY2qvzGjfg3TZXNgI6MsrSwE1yh63jJQjJhbC15elQ8cYNBAS1nMUKoYXVITN50BWDM5GoBIgECCAhgEtCHWO7tKh2MKCBtiFdWujOSYsEjaKOGilLNTul4IDRBcRPlgkWVwe0QZNd/TDEzEs+YGtyLrUjwmeYsVx2eduaDkbIdLW1/69gr3LVPgN8fpP2GsecyW1lG2DcatAEUB45jQE5zFRGI1QkLTM7p3x1uhqi0k+Q8M0noWeVwsWtvuFu+MM1l/zsnJ+cddQI7nqBUVoVzF6yV423gZE3YPyueLPukuvqCQRc963DOxm8jo3A0xbwxbqECeEniIKm8SGhGh+WKjQ/O5bvk8M18NgOo0+La3xFzrjKEm9NnHxSZkZ2QlNJJEfNj06gazhZuUaRJFWVahT6BHiFMqN1RSnWjCJ7hJTMk3JL8FitRfbUSk+mzdVVyndRhTFH4sJqOI61kt8kb3XKsed3xkbfBYCHC/rxc7eNNy2edm+4XdbFS80YdPKi2pODsm1TOn5mrIiCozgihRTeSq1s8CBA0xehahQKOnzG4kjmrTql1foqpbpNqFanYyQxMgeHPGbDcl4iVIqT1Igm3xCSn+E9jHs+HqrhMrT3SRlGo7xO5fEeHb/zKIAuw9HyIA9Tylj5/yd6oiLV6/TsqxibZjbioAY8baWEcGeQuCuIqMqxzOP8//FA8/tpfWasUBIm1SnZdnxSSXQlKZdTc1Fa5/V+j47EF/IYt+m8vxtfuPm28EZeRw3p6EnFqlpV0Ef68gcHj755ZMsM3hPu41yPhTvPO+lFDoVnGiazByqmxUgR7X3iNFw7WRFR++5+6n6S6kdcQ7MQFxc/qWdGL1p8SqpdrZJ40yQhQsnDQq6IL29sTydLdG+Ms73w8MGWGg469z0OWXb6HZ66W021n7NvkXqoUz1B1RlxdF/qTzRmIrjtqz6Wp2rJptm/YzhIWKiyzBMlnEEnbamYEZQgqlbtEdx6G6rPMez+zhjDWYgrbfsZjQ0goq0oxQF45lOyrgii5upqk3BdKXWPJ7QiSBlOTgAeg5DT+faJqZEY7u4afJWMzYbsqk1Yc2BujUsMSZ8xhtECWEaJUGJN12mW/EmOA/NwA9q4GtyRLQ6LHICtiIKISN7ukXnTIPnZT6hV4FFkYkRvlEVJVPkBmt7nQ4tBFt5RqlDAHM+BhYtHUV/lOcsmuBccDw1H+d0oKxYgxAyKb8pK36ePzGinsBwtPqQC71ai97ejSZNfs5P9uCJNuxWqU6OhhvhIxBxlZtAivRR3UVti5HWsAVgsELEUNSt1B2MJBvNQPRdPUzBGN318c/Uh1StEbdciOWiJSdWn9brTv3qCJK5luPjHolLEwelwiHXwZw33pWx/+21RMJ1Tks+0orP3HZUZjkK1wMITqQyqrZwA6Cmlt9u2MALVktM4BQGdUjkOHlG6N0aU/biGjOGS5RF1Bg6AH0DVBgyqBELk5DjYw1tqlIB95aEEzQH2FZDG4mpwlRqBPKILABOegNu33TAi96BaI2ncSrqvp47XxQ+eCd38ItvSVj+9f7zhjbwD78R6DBbnws+mYsmboIoi76hmpCaOfR8jQoFpjJ8kLMDOAO4eUxzpDqqW5UIx1qmRMR8Plqmq233aoE3KN+Wg3JL50DSZqATAGxpjSN5LPuoYStQTj7Gms0wFHmOW5Kw1OOC624DgMVFrMne1bb5wYfikUsRIAUWQfFKdmyZZMZT61OAKBbbNcCXbUsHzLKtSUURCwDVQhCU1eAzWHI0x7DvSZz7D6IDOCfgIlEm6fMO7vQJV+CxIXPimegBwoQ+D1OwyF/GFYnvXpCWzrkIsjHViHYz4oDj+xd/GNDvUhsufwcnJdXhd/jN7D2+cYjy0GoLyrXsrIgK7dd38Znx+3nNPGLxcJT26gaRmw30O4DQBsxmSpt+h7TMfo8+YJDmJe9Am+fYGiSNdRTonsRLucBgsbBfU9jXygQULASsc8jdiY/wJiaEwkvhqkMRZV0OGay2GSdD1oqr3qfRxDbsYQxyVtALxBsZOXujpPJUprcp1Fm0yDuktEesiZC7uhhO4jtG1ucfSaCe7YlVQvmksmOaGyjgwCy7ZcIfDalqnVK+2XcuHAwNnDUKnqVoL/iyigmNvbpVAJDFMPlHItqRYKfcqBoOhoSd0fPzsVsgnl6O3Z4p4FzqS91ij7gI4TIfxYnTazQzz2zJldRYKORkZ8XliKZNElKHCTW/fZQ4sLm/yxGTxfhoAHFftz6JlObD7hxEmBT5kU9m9S7fJLEqJ9olPsQHAtYq8Isj2x6No6iXFRlynlN3LynvjsTm+lnpKM0XksMlciSOGuBsLT8hEny94iovUD2jjfyN5lBziBxmJP0ZUqGVbEnMc/vWDHnEodXEWJmu1mpQyXY01HYA/W8rJthz36UYGM1ufyVDkDvQ4Io5mvan4cvKOHCPqB8c3xY9inR8+Z64jDVJh+ovzPNAcbLrkHoa4wLVYhy88fus5JQiPKN8s64q4dhNgc+FpSBl+55nGAZW+b0pRRHGngK6FwYK8khAjpewRdoifS4UTJSsNJXpFLLrpfiEVBheUb+tSgHFLhZ0GVdHOurZ0msyQpDQOnE0BJRJ+r5novCXH72xkwE359ZLK+AxQEP8QYEXv62oyjibTSFe1bZIaK0lkhoVkfSmYdqlnXzLU7OFIBck6gWaHq6whWQB5PVVXcsNIC3wyldVkkJwnafY9vNjVIlxD2qB5H0qMhIbdzFGSGpLkIjJW5tfjC8UP36xLg9v0LP8/Uo3hzsyqupizbuCD62qYhpQi+VR9dOkMr0JzkAbLuzIhqt2r0iejgs6ZyLIZnVJptGbNllc+8CMi29wvVWdnZON1DCkhmRme3sAZNf3+kNK5fRzQR56SxcFCqeTiYTiLp12MAJ28jqYUysgy7YnzaHqAZB59BrUMIw32EtaNqxeVoD1SjwtWkjSfzU5ifDUd9+DxYGYwO1y5T45crJ2Iy1RQetsTHa5aHC89suVX0zAW7WQAbfpUcjOVK+JbsDCwEoPfPX7gEqPKPnHL5WLv1gcHImsOu5nIVUMQXpWkRO3D5PkMa7g4+ioLzTZ2pdLyJC+mFIkjI/AGp6HWuNi+aG/WV2ki5MTEQxxdbLJcyNWS9nq0FeIIQBGp/cJh2u7vU+cUSeoZ2opbW54Xn3huBPiBSszxT7Uivr7hSOvhF9NvbgZfGK10snDNdi05zhAy/+pVZM6N5OsblYNO+lSLEgWO+1CfWLG4n6Q9eict9n4Zv0Nj2ppig4rDXAfClOqRfEF4ZMZzNnGytuxJATsMkHFEZopIlFSpEWrM8v76lPJ2T0/Nk9U6N7pJSc2u4Jfi++FuPt+OJhfEOztIfsSAKYKoz/ODQRoALCI/gwxJ8Szke5VstlbvctVCZ2dmMQErIrUc6S6rH3c4LC6DIuaUzGtlm/bERqQvRJevKtu2GUMIvSiAhRc8GyQze+HFIsys0sEf0H5I8paRHCfRZhCF8T1swL96akQ4mLv0SRY11nTXMWs4kkDZHWHSsR3Yur0Fied1wnM3Wo+/LBBNg4e5waIj1SNcKVtc7SQm+nKc6nWZWvL7rUgEKWleZ2EYiKQ8y5/efBKt2oa8IOLz4lKCZIYx3EJpjXPhhs2mhgD5ia5qclBHsotPhxdPYmN9J5nLine truncated
|
||||||
|
After Width: | Height: | Size: 213 KiB |
@@ -0,0 +1,18 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: admin-user
|
||||||
|
namespace: kubernetes-dashboard
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: admin-user
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: cluster-admin
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: admin-user
|
||||||
|
namespace: kubernetes-dashboard
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: metallb
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://metallb.github.io/metallb
|
||||||
|
targetRevision: 0.15.3
|
||||||
|
chart: metallb
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: metallb-system
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
apiVersion: metallb.io/v1beta1
|
||||||
|
kind: L2Advertisement
|
||||||
|
metadata:
|
||||||
|
name: default
|
||||||
|
namespace: metallb-system
|
||||||
|
spec:
|
||||||
|
ipAddressPools:
|
||||||
|
- default-pool
|
||||||
|
interfaces:
|
||||||
|
- ens18
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: metallb.io/v1beta1
|
||||||
|
kind: IPAddressPool
|
||||||
|
metadata:
|
||||||
|
name: default-pool
|
||||||
|
namespace: metallb-system
|
||||||
|
spec:
|
||||||
|
addresses:
|
||||||
|
- 10.13.46.0/24
|
||||||
|
avoidBuggyIPs: true
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: ServiceCIDR
|
||||||
|
metadata:
|
||||||
|
name: kubernetes-new
|
||||||
|
spec:
|
||||||
|
cidrs:
|
||||||
|
- 10.245.0.0/16
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
MANIFEST_DIR := env_var_or_default("MANIFEST_DIR", "proxmox/manifests")
|
||||||
|
K8S_VERSION := env_var_or_default("K8S_VERSION", "1.36.1")
|
||||||
|
|
||||||
|
fmt:
|
||||||
|
yamlfmt .
|
||||||
|
|
||||||
|
fmt-check:
|
||||||
|
yamlfmt -lint .
|
||||||
|
|
||||||
|
lint-yaml:
|
||||||
|
yamllint .
|
||||||
|
|
||||||
|
lint-k8s:
|
||||||
|
kube-linter lint --config .kube-linter.yaml {{MANIFEST_DIR}}
|
||||||
|
|
||||||
|
validate:
|
||||||
|
kubeconform -strict -summary -ignore-missing-schemas \
|
||||||
|
-kubernetes-version {{K8S_VERSION}} {{MANIFEST_DIR}}
|
||||||
|
|
||||||
|
lint: lint-yaml lint-k8s validate
|
||||||
|
|
||||||
|
lint-all: fmt-check lint
|
||||||
|
|
||||||
|
install-hooks:
|
||||||
|
pre-commit install
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: networking.karmada.io/v1alpha1
|
||||||
|
kind: MultiClusterService
|
||||||
|
metadata:
|
||||||
|
name: minecraft-global
|
||||||
|
namespace: minecraft
|
||||||
|
spec:
|
||||||
|
consumerClusters:
|
||||||
|
- name: k8s-yandex
|
||||||
|
providerClusters:
|
||||||
|
- name: k8s-proxmox
|
||||||
|
range: {}
|
||||||
|
types:
|
||||||
|
- CrossCluster
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: minecraft-global
|
||||||
|
namespace: minecraft
|
||||||
|
spec:
|
||||||
|
type: LoadBalancer
|
||||||
|
ports:
|
||||||
|
- name: minecraft
|
||||||
|
port: 25565
|
||||||
|
targetPort: 25565
|
||||||
|
protocol: TCP
|
||||||
|
selector:
|
||||||
|
app: minecraft
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: argocd
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://argoproj.github.io/argo-helm
|
||||||
|
targetRevision: 10.4.2
|
||||||
|
chart: argo-cd
|
||||||
|
helm:
|
||||||
|
valuesObject:
|
||||||
|
redis-ha:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image:
|
||||||
|
repository: docker.io/redis
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 20m
|
||||||
|
memory: 32Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 64Mi
|
||||||
|
|
||||||
|
controller:
|
||||||
|
replicas: 1
|
||||||
|
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 512Mi
|
||||||
|
limits:
|
||||||
|
cpu: 150m
|
||||||
|
memory: 1Gi
|
||||||
|
|
||||||
|
env:
|
||||||
|
- name: GOGC
|
||||||
|
value: "50"
|
||||||
|
- name: GOMEMLIMIT
|
||||||
|
value: "800MiB"
|
||||||
|
|
||||||
|
server:
|
||||||
|
autoscaling:
|
||||||
|
enabled: false
|
||||||
|
minReplicas: 1
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 25m
|
||||||
|
memory: 64Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
|
||||||
|
repoServer:
|
||||||
|
autoscaling:
|
||||||
|
enabled: false
|
||||||
|
minReplicas: 1
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 25m
|
||||||
|
memory: 64Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 256Mi
|
||||||
|
|
||||||
|
applicationSet:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 32Mi
|
||||||
|
limits:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 64Mi
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
dex:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
configs:
|
||||||
|
params:
|
||||||
|
server.insecure: "true"
|
||||||
|
|
||||||
|
cm:
|
||||||
|
url: https://argocd.internal.itqdev.xyz
|
||||||
|
|
||||||
|
timeout.reconciliation: "10m"
|
||||||
|
|
||||||
|
resource.exclusions: |
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
kinds:
|
||||||
|
- Event
|
||||||
|
clusters:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
- apiGroups:
|
||||||
|
- "events.k8s.io"
|
||||||
|
kinds:
|
||||||
|
- Event
|
||||||
|
clusters:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
kinds:
|
||||||
|
- Endpoints
|
||||||
|
clusters:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
- apiGroups:
|
||||||
|
- "discovery.k8s.io"
|
||||||
|
kinds:
|
||||||
|
- EndpointSlice
|
||||||
|
clusters:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
- apiGroups:
|
||||||
|
- "metrics.k8s.io"
|
||||||
|
kinds:
|
||||||
|
- "*"
|
||||||
|
clusters:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
- apiGroups:
|
||||||
|
- "coordination.k8s.io"
|
||||||
|
kinds:
|
||||||
|
- Lease
|
||||||
|
clusters:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
oidc.config: |
|
||||||
|
name: Keycloak
|
||||||
|
issuer: https://id.itqdev.xyz/realms/master
|
||||||
|
clientID: argocd
|
||||||
|
clientSecret: $oidc.keycloak.clientSecret
|
||||||
|
refreshTokenThreshold: 2m
|
||||||
|
requestedScopes: ["openid", "profile", "email", "groups"]
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: argocd
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: cert-manager
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: oci://quay.io/jetstack/charts/cert-manager
|
||||||
|
path: .
|
||||||
|
targetRevision: v1.21.1
|
||||||
|
helm:
|
||||||
|
valuesObject:
|
||||||
|
disableAutoApproval: false
|
||||||
|
approveSignerNames:
|
||||||
|
- issuers.cert-manager.io/*
|
||||||
|
- clusterissuers.cert-manager.io/*
|
||||||
|
- clusterissuers.infisical-issuer.infisical.com/infisical
|
||||||
|
|
||||||
|
crds:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
prometheus:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 25m
|
||||||
|
memory: 64Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: cert-manager
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: cloudnative-pg
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://cloudnative-pg.github.io/charts
|
||||||
|
targetRevision: 0.29.0
|
||||||
|
chart: cloudnative-pg
|
||||||
|
helm:
|
||||||
|
valuesObject:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 25m
|
||||||
|
memory: 32Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: cloudnative-pg
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: external-secrets-operator
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://charts.external-secrets.io
|
||||||
|
targetRevision: 2.10.0
|
||||||
|
chart: external-secrets
|
||||||
|
helm:
|
||||||
|
valuesObject:
|
||||||
|
webhook:
|
||||||
|
create: false
|
||||||
|
certController:
|
||||||
|
create: false
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 25m
|
||||||
|
memory: 32Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: external-secrets
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: falco
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://falcosecurity.github.io/charts
|
||||||
|
targetRevision: 9.2.1
|
||||||
|
chart: falco
|
||||||
|
helm:
|
||||||
|
valuesObject:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 200m
|
||||||
|
memory: 512Mi
|
||||||
|
limits:
|
||||||
|
cpu: 200m
|
||||||
|
memory: 512Mi
|
||||||
|
|
||||||
|
tty: true
|
||||||
|
|
||||||
|
services:
|
||||||
|
- name: k8saudit-webhook
|
||||||
|
type: ClusterIP
|
||||||
|
ports:
|
||||||
|
- port: 9765
|
||||||
|
targetPort: 9765
|
||||||
|
protocol: TCP
|
||||||
|
name: http
|
||||||
|
|
||||||
|
driver:
|
||||||
|
enabled: true
|
||||||
|
kind: modern_ebpf
|
||||||
|
|
||||||
|
mounts:
|
||||||
|
volumes:
|
||||||
|
- name: falco-events
|
||||||
|
hostPath:
|
||||||
|
path: /var/log/falco
|
||||||
|
type: DirectoryOrCreate
|
||||||
|
volumeMounts:
|
||||||
|
- name: falco-events
|
||||||
|
mountPath: /var/log/falco
|
||||||
|
|
||||||
|
falcosidekick:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
falcoctl:
|
||||||
|
artifact:
|
||||||
|
install:
|
||||||
|
enabled: true
|
||||||
|
follow:
|
||||||
|
enabled: true
|
||||||
|
config:
|
||||||
|
artifact:
|
||||||
|
install:
|
||||||
|
refs: ["falco-rules:latest", "falco-incubating-rules:latest", "k8saudit-rules:latest"]
|
||||||
|
follow:
|
||||||
|
refs: ["falco-rules:latest", "falco-incubating-rules:latest", "k8saudit-rules:latest"]
|
||||||
|
|
||||||
|
falco:
|
||||||
|
json_output: true
|
||||||
|
append_output:
|
||||||
|
- extra_fields:
|
||||||
|
- wazuh_integration: "falco"
|
||||||
|
file_output:
|
||||||
|
enabled: true
|
||||||
|
keep_alive: false
|
||||||
|
filename: /var/log/falco/events.json
|
||||||
|
rules_files:
|
||||||
|
- /etc/falco/falco_rules.yaml
|
||||||
|
- /etc/falco/falco-incubating_rules.yaml
|
||||||
|
- /etc/falco/k8s_audit_rules.yaml
|
||||||
|
- /etc/falco/rules.d
|
||||||
|
plugins:
|
||||||
|
- name: k8saudit
|
||||||
|
library_path: libk8saudit.so
|
||||||
|
init_config: ""
|
||||||
|
open_params: "http://:9765/k8s-audit"
|
||||||
|
- name: json
|
||||||
|
library_path: libjson.so
|
||||||
|
init_config: ""
|
||||||
|
load_plugins: [k8saudit, json]
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: falco
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: gitlab-runner
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://charts.gitlab.io
|
||||||
|
targetRevision: 0.92.1
|
||||||
|
chart: gitlab-runner
|
||||||
|
helm:
|
||||||
|
parameters:
|
||||||
|
- name: rbac.create
|
||||||
|
value: 'true'
|
||||||
|
- name: concurrent
|
||||||
|
value: '1'
|
||||||
|
- name: securityContext.allowPrivilegeEscalation
|
||||||
|
value: 'true'
|
||||||
|
values: |-
|
||||||
|
gitlabUrl: https://gitlab.itqdev.xyz
|
||||||
|
|
||||||
|
runners:
|
||||||
|
secret: gitlab-runner-credentials
|
||||||
|
config: |
|
||||||
|
[[runners]]
|
||||||
|
[runners.kubernetes]
|
||||||
|
namespace = "{{.Release.Namespace}}"
|
||||||
|
image = "alpine"
|
||||||
|
privileged = true
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: gitlab-runner
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: grafana
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: oci://ghcr.io/grafana-community/helm-charts/grafana
|
||||||
|
path: .
|
||||||
|
targetRevision: 13.2.6
|
||||||
|
helm:
|
||||||
|
valuesObject:
|
||||||
|
replicas: 1
|
||||||
|
envValueFrom:
|
||||||
|
GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET:
|
||||||
|
secretKeyRef:
|
||||||
|
name: grafana-secrets
|
||||||
|
key: client-secret
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
- prometheus
|
||||||
|
|
||||||
|
grafana.ini:
|
||||||
|
plugins:
|
||||||
|
preinstall_auto_update: false
|
||||||
|
|
||||||
|
server:
|
||||||
|
root_url: https://grafana.internal.itqdev.xyz
|
||||||
|
|
||||||
|
auth:
|
||||||
|
disable_login_form: false
|
||||||
|
oauth_auto_login: false
|
||||||
|
|
||||||
|
auth.generic_oauth:
|
||||||
|
enabled: true
|
||||||
|
name: Keycloak
|
||||||
|
allow_sign_up: true
|
||||||
|
client_id: grafana-private
|
||||||
|
client_secret: ${GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET}
|
||||||
|
scopes: openid profile email
|
||||||
|
use_pkce: true
|
||||||
|
|
||||||
|
auth_url: https://id.itqdev.xyz/realms/master/protocol/openid-connect/auth
|
||||||
|
token_url: https://id.itqdev.xyz/realms/master/protocol/openid-connect/token
|
||||||
|
api_url: https://id.itqdev.xyz/realms/master/protocol/openid-connect/userinfo
|
||||||
|
|
||||||
|
role_attribute_path: >
|
||||||
|
contains(groups[*], 'admin') && 'Admin' || contains(groups[*], 'editor') && 'Editor' || 'Viewer'
|
||||||
|
role_attribute_strict: false
|
||||||
|
use_refresh_token: true
|
||||||
|
id_token_attribute_name: preferred_username
|
||||||
|
|
||||||
|
sidecar:
|
||||||
|
dashboards:
|
||||||
|
enabled: true
|
||||||
|
label: grafana_dashboard
|
||||||
|
labelValue: "1"
|
||||||
|
searchNamespace: ALL
|
||||||
|
folderAnnotation: grafana_folder
|
||||||
|
provider:
|
||||||
|
allowUiUpdates: false
|
||||||
|
datasources:
|
||||||
|
enabled: true
|
||||||
|
label: grafana_datasource
|
||||||
|
labelValue: "1"
|
||||||
|
searchNamespace: ALL
|
||||||
|
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 256Mi
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 512Mi
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: grafana
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: headlamp
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://kubernetes-sigs.github.io/headlamp/
|
||||||
|
targetRevision: 0.45.0
|
||||||
|
chart: headlamp
|
||||||
|
helm:
|
||||||
|
valuesObject:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 20m
|
||||||
|
memory: 32Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 64Mi
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: headlamp
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: infisical-pki-issuer
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://dl.cloudsmith.io/public/infisical/helm-charts/helm/charts/
|
||||||
|
chart: infisical-pki-issuer
|
||||||
|
targetRevision: "*"
|
||||||
|
helm:
|
||||||
|
releaseName: infisical-pki-issuer
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: infisical-pki-issuer
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: istio-base
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://istio-release.storage.googleapis.com/charts
|
||||||
|
targetRevision: 1.30.3
|
||||||
|
chart: base
|
||||||
|
|
||||||
|
ignoreDifferences:
|
||||||
|
- group: admissionregistration.k8s.io
|
||||||
|
kind: ValidatingWebhookConfiguration
|
||||||
|
name: istiod-default-validator
|
||||||
|
jqPathExpressions:
|
||||||
|
- .webhooks[]?.failurePolicy
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: istio-system
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: istiod
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://istio-release.storage.googleapis.com/charts
|
||||||
|
targetRevision: 1.30.3
|
||||||
|
chart: istiod
|
||||||
|
helm:
|
||||||
|
valuesObject:
|
||||||
|
replicaCount: 0
|
||||||
|
|
||||||
|
ignoreDifferences:
|
||||||
|
- group: admissionregistration.k8s.io
|
||||||
|
kind: ValidatingWebhookConfiguration
|
||||||
|
name: istio-validator-istio-system
|
||||||
|
jqPathExpressions:
|
||||||
|
- .webhooks[]?.failurePolicy
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: istio-system
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: jellyfin
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://jellyfin.github.io/jellyfin-helm
|
||||||
|
targetRevision: 3.2.0
|
||||||
|
chart: jellyfin
|
||||||
|
helm:
|
||||||
|
valuesObject:
|
||||||
|
replicaCount: 1
|
||||||
|
persistence:
|
||||||
|
config:
|
||||||
|
size: 16Gi
|
||||||
|
media:
|
||||||
|
size: 100Gi
|
||||||
|
metrics:
|
||||||
|
enabled: true
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 1000m
|
||||||
|
memory: 512Mi
|
||||||
|
limits:
|
||||||
|
cpu: 4000m
|
||||||
|
memory: 2Gi
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: jellyfin
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: manifests
|
||||||
|
namespace: argocd
|
||||||
|
annotations:
|
||||||
|
argocd.argoproj.io/compare-options: ServerSideDiff=true,IncludeMutationWebhook=true
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://git.itqdev.xyz/Infrastructure/homelab.git
|
||||||
|
targetRevision: main
|
||||||
|
path: proxmox/manifests
|
||||||
|
|
||||||
|
directory:
|
||||||
|
recurse: true
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: default
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: mediamtx
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://startechnica.github.io/apps
|
||||||
|
chart: mediamtx
|
||||||
|
targetRevision: 0.1.1
|
||||||
|
helm:
|
||||||
|
valuesObject:
|
||||||
|
service:
|
||||||
|
type: LoadBalancer
|
||||||
|
configs:
|
||||||
|
existingConfigMapName: mediamtx-custom
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
limits:
|
||||||
|
cpu: 1000m
|
||||||
|
memory: 1Gi
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: mediamtx
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: metrics-server
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://kubernetes-sigs.github.io/metrics-server/
|
||||||
|
targetRevision: 3.14.0
|
||||||
|
chart: metrics-server
|
||||||
|
helm:
|
||||||
|
valuesObject:
|
||||||
|
args:
|
||||||
|
- --kubelet-insecure-tls
|
||||||
|
metrics:
|
||||||
|
enabled: true
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 100Mi
|
||||||
|
limits:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 100Mi
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: metrics-server
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: minecraft
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://itzg.github.io/minecraft-server-charts/
|
||||||
|
targetRevision: 5.2.0
|
||||||
|
chart: minecraft
|
||||||
|
helm:
|
||||||
|
valuesObject:
|
||||||
|
image:
|
||||||
|
repository: ghcr.io/itzg/minecraft-server
|
||||||
|
serviceAnnotations:
|
||||||
|
lbipam.cilium.io/ips: 10.13.46.11
|
||||||
|
replicaCount: 1
|
||||||
|
minecraftServer:
|
||||||
|
eula: "TRUE"
|
||||||
|
difficulty: hard
|
||||||
|
type: PAPER
|
||||||
|
motd: '§l §r §c§l|\/|1|\|3(r4f7 1|\| |<u83r|\|373z'
|
||||||
|
rcon:
|
||||||
|
enabled: true
|
||||||
|
serviceType: LoadBalancer
|
||||||
|
onlineMode: false
|
||||||
|
pluginUrls:
|
||||||
|
- https://cdn.modrinth.com/data/TsLS8Py5/versions/uhXJCOpc/SkinsRestorer.jar
|
||||||
|
persistence:
|
||||||
|
dataDir:
|
||||||
|
enabled: true
|
||||||
|
Size: 2Gi
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 2000m
|
||||||
|
memory: 2Gi
|
||||||
|
limits:
|
||||||
|
cpu: 8000m
|
||||||
|
memory: 6Gi
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: minecraft
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: proxmox-csi-plugin
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://github.com/sergelogvinov/proxmox-csi-plugin.git
|
||||||
|
path: charts/proxmox-csi-plugin
|
||||||
|
targetRevision: HEAD
|
||||||
|
helm:
|
||||||
|
valuesObject:
|
||||||
|
existingConfigSecret: proxmox-csi-config
|
||||||
|
controller:
|
||||||
|
plugin:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 16Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 64Mi
|
||||||
|
attacher:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 16Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 64Mi
|
||||||
|
provisioner:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 16Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 64Mi
|
||||||
|
resizer:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 16Mi
|
||||||
|
limits:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 64Mi
|
||||||
|
snapshotter:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 16Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 64Mi
|
||||||
|
node:
|
||||||
|
plugin:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 16Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 64Mi
|
||||||
|
driverRegistrar:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 16Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 64Mi
|
||||||
|
livenessprobe:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 16Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 64Mi
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: proxmox-csi-plugin
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: root-app
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://git.itqdev.xyz/Infrastructure/homelab.git
|
||||||
|
targetRevision: main
|
||||||
|
path: proxmox/argocd
|
||||||
|
|
||||||
|
directory:
|
||||||
|
recurse: true
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: argocd
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: submariner-k8s-broker
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://git.itqdev.xyz/api/packages/ITQ/helm
|
||||||
|
chart: submariner-k8s-broker
|
||||||
|
targetRevision: 0.24.1
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: submariner-operator
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: submariner-operator
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://git.itqdev.xyz/api/packages/ITQ/helm
|
||||||
|
chart: submariner-operator
|
||||||
|
targetRevision: 0.24.1
|
||||||
|
helm:
|
||||||
|
valuesObject:
|
||||||
|
broker:
|
||||||
|
server: k8s.nlb.infra.itqdev.xyz:8443
|
||||||
|
namespace: submariner-operator
|
||||||
|
|
||||||
|
submariner:
|
||||||
|
brokerK8sSecret: submariner-k8s-broker-remote-client-token # created manually
|
||||||
|
|
||||||
|
clusterId: k8s-proxmox
|
||||||
|
clusterCidr: 10.244.0.0/16
|
||||||
|
serviceCidr: 10.245.0.0/16
|
||||||
|
|
||||||
|
clustersetIpEnabled: false
|
||||||
|
loadBalancerEnabled: false
|
||||||
|
natEnabled: true
|
||||||
|
|
||||||
|
debug: false
|
||||||
|
serviceDiscovery: false
|
||||||
|
cableDriver: wireguard
|
||||||
|
healthcheckEnabled: true
|
||||||
|
|
||||||
|
ipsec:
|
||||||
|
pskSecret: submariner-ipsec-psk
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: submariner-operator
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
enabled: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,293 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: victoriametrics-k8s-cluster
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://victoriametrics.github.io/helm-charts/
|
||||||
|
chart: victoria-metrics-k8s-stack
|
||||||
|
targetRevision: v0.91.2
|
||||||
|
helm:
|
||||||
|
skipCrds: true
|
||||||
|
valuesObject:
|
||||||
|
fullnameOverride: vm
|
||||||
|
|
||||||
|
serviceAccount:
|
||||||
|
create: false
|
||||||
|
|
||||||
|
victoria-metrics-operator:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
defaultDashboards:
|
||||||
|
# -- Enable dashboard sync via sync-job
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
dashboards:
|
||||||
|
node-exporter-full:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
sources:
|
||||||
|
node-exporter-full:
|
||||||
|
enabled: false
|
||||||
|
kube-prometheus:
|
||||||
|
enabled: false
|
||||||
|
victoriametrics-single-node:
|
||||||
|
enabled: true
|
||||||
|
victoriametrics-vmagent:
|
||||||
|
enabled: true
|
||||||
|
kubernetes-kubelet:
|
||||||
|
enabled: true
|
||||||
|
url: https://grafana.com/api/dashboards/16361/revisions/latest/download
|
||||||
|
kubernetes-controller-manager:
|
||||||
|
enabled: true
|
||||||
|
url: https://grafana.com/api/dashboards/16370/revisions/latest/download
|
||||||
|
kubernetes-scheduler:
|
||||||
|
enabled: true
|
||||||
|
url: https://grafana.com/api/dashboards/16362/revisions/latest/download
|
||||||
|
|
||||||
|
syncJob:
|
||||||
|
# -- Fetch dashboards and rules from upstream sources at deploy time.
|
||||||
|
# Creates ConfigMaps (for Grafana sidecar) or GrafanaDashboard CRDs and VMRules directly in the cluster.
|
||||||
|
# A new Job runs automatically whenever this config changes.
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
vlsingle:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
vlcluster:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
vldistributed:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
vlagent:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
vtsingle:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
vtcluster:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
vmsingle:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
vmdistributed:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
vmcluster:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
alertmanager:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
vmalert:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
vmauth:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
vmagent:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
defaultDatasources:
|
||||||
|
grafanaOperator:
|
||||||
|
# -- Create datasources as CRDs (requires grafana-operator to be installed)
|
||||||
|
enabled: false
|
||||||
|
annotations: {}
|
||||||
|
spec:
|
||||||
|
instanceSelector:
|
||||||
|
matchLabels:
|
||||||
|
dashboards: grafana
|
||||||
|
allowCrossNamespaceImport: false
|
||||||
|
victoriametrics:
|
||||||
|
# -- List of prometheus compatible datasource configurations.
|
||||||
|
# VM `url` will be added to each of them in templates.
|
||||||
|
datasources:
|
||||||
|
- name: VictoriaMetrics
|
||||||
|
type: prometheus
|
||||||
|
access: proxy
|
||||||
|
uid: VictoriaMetrics
|
||||||
|
isDefault: true
|
||||||
|
- name: VictoriaMetrics (DS)
|
||||||
|
isDefault: false
|
||||||
|
access: proxy
|
||||||
|
uid: VictoriaMetricsDS
|
||||||
|
type: victoriametrics-metrics-datasource
|
||||||
|
victorialogs:
|
||||||
|
# -- List of VictoriaLogs datasource configurations.
|
||||||
|
# VL `url` will be added to each of them in templates.
|
||||||
|
datasources:
|
||||||
|
- name: VictoriaLogs (DS)
|
||||||
|
access: proxy
|
||||||
|
uid: VictoriaLogs
|
||||||
|
type: victoriametrics-logs-datasource
|
||||||
|
victoriatraces:
|
||||||
|
# -- List of VictoriaTraces (Jaeger-compatible) datasource configurations.
|
||||||
|
# VT `url` will be added to each of them in templates.
|
||||||
|
datasources:
|
||||||
|
- name: VictoriaTraces
|
||||||
|
access: proxy
|
||||||
|
uid: VictoriaTraces
|
||||||
|
type: jaeger
|
||||||
|
# -- List of alertmanager datasources.
|
||||||
|
# VMAlertmanager generated `url` will be added to each datasource in template if alertmanager is enabled
|
||||||
|
alertmanager:
|
||||||
|
datasources:
|
||||||
|
- name: Alertmanager
|
||||||
|
access: proxy
|
||||||
|
uid: Alertmanager
|
||||||
|
jsonData:
|
||||||
|
implementation: prometheus
|
||||||
|
# -- Configure additional grafana datasources (passed through tpl).
|
||||||
|
# Check [here](https://grafana.com/docs/grafana/latest/administration/provisioning/#data-sources) for details
|
||||||
|
extra: []
|
||||||
|
# - name: prometheus-sample
|
||||||
|
# access: proxy
|
||||||
|
# basicAuth: true
|
||||||
|
# basicAuthPassword: pass
|
||||||
|
# basicAuthUser: daco
|
||||||
|
# editable: false
|
||||||
|
# jsonData:
|
||||||
|
# tlsSkipVerify: true
|
||||||
|
# orgId: 1
|
||||||
|
# type: prometheus
|
||||||
|
# url: https://{{ printf "%s-prometheus.svc" .Release.Name }}:9090
|
||||||
|
# version: 1
|
||||||
|
|
||||||
|
grafana:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
defaultScrapeService:
|
||||||
|
namespace: kube-system
|
||||||
|
|
||||||
|
prometheus-node-exporter:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
# -- kube-state-metrics dependency chart configuration. For possible values check [here](https://github.com/prometheus-community/helm-charts/blob/main/charts/kube-state-metrics/values.yaml)
|
||||||
|
kube-state-metrics:
|
||||||
|
enabled: false
|
||||||
|
# -- [Scrape configuration](https://docs.victoriametrics.com/operator/api/#vmservicescrapespec) for Kube State Metrics
|
||||||
|
vmScrape:
|
||||||
|
enabled: true
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: '{{ include "kube-state-metrics.name" (index .Subcharts "kube-state-metrics") }}'
|
||||||
|
app.kubernetes.io/instance: '{{ include "vm.release" . }}'
|
||||||
|
endpoints:
|
||||||
|
- port: http
|
||||||
|
honorLabels: true
|
||||||
|
metricRelabelConfigs:
|
||||||
|
- action: labeldrop
|
||||||
|
regex: (uid|container_id|image_id)
|
||||||
|
jobLabel: app.kubernetes.io/name
|
||||||
|
|
||||||
|
kubelet:
|
||||||
|
enabled: true
|
||||||
|
vmScrapes:
|
||||||
|
cadvisor:
|
||||||
|
enabled: true
|
||||||
|
probes:
|
||||||
|
enabled: true
|
||||||
|
resources:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
kubeApiServer:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
kubeControllerManager:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
service:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
vmScrape:
|
||||||
|
spec:
|
||||||
|
jobLabel: app.kubernetes.io/component
|
||||||
|
namespaceSelector:
|
||||||
|
matchNames: []
|
||||||
|
endpoints:
|
||||||
|
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
|
||||||
|
port: http-metrics
|
||||||
|
scheme: https
|
||||||
|
tlsConfig:
|
||||||
|
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
||||||
|
serverName: localhost
|
||||||
|
insecureSkipVerify: true
|
||||||
|
|
||||||
|
kubeDns:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
coreDns:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
service:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
vmScrape:
|
||||||
|
spec:
|
||||||
|
jobLabel: app.kubernetes.io/component
|
||||||
|
namespaceSelector:
|
||||||
|
matchNames: []
|
||||||
|
endpoints:
|
||||||
|
- port: http-metrics
|
||||||
|
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
|
||||||
|
|
||||||
|
kubeEtcd:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
kubeScheduler:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
service:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
vmScrape:
|
||||||
|
spec:
|
||||||
|
jobLabel: app.kubernetes.io/component
|
||||||
|
namespaceSelector:
|
||||||
|
matchNames: []
|
||||||
|
endpoints:
|
||||||
|
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
|
||||||
|
port: http-metrics
|
||||||
|
scheme: https
|
||||||
|
tlsConfig:
|
||||||
|
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
||||||
|
serverName: localhost
|
||||||
|
insecureSkipVerify: true
|
||||||
|
|
||||||
|
kubeProxy:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
service:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
vmScrape:
|
||||||
|
spec:
|
||||||
|
jobLabel: app.kubernetes.io/component
|
||||||
|
namespaceSelector:
|
||||||
|
matchNames: []
|
||||||
|
endpoints:
|
||||||
|
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
|
||||||
|
port: http-metrics
|
||||||
|
scheme: https
|
||||||
|
tlsConfig:
|
||||||
|
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
||||||
|
|
||||||
|
internal: {}
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: observability
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: victoriametrics-operator
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://victoriametrics.github.io/helm-charts/
|
||||||
|
chart: victoria-metrics-operator
|
||||||
|
targetRevision: 0.67.3
|
||||||
|
helm:
|
||||||
|
releaseName: victoriametrics-operator
|
||||||
|
valuesObject:
|
||||||
|
replicaCount: 1
|
||||||
|
admissionWebhooks:
|
||||||
|
enabled: false
|
||||||
|
createCRD: true
|
||||||
|
operator:
|
||||||
|
# This enables the operator to watch for CRs in all namespaces
|
||||||
|
# or we can specify namespaces.
|
||||||
|
disableNamespaceRestriction: true
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 64Mi
|
||||||
|
limits:
|
||||||
|
cpu: 1000m
|
||||||
|
memory: 128Mi
|
||||||
|
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: observability
|
||||||
|
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- ServerSideApply=true
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
prometheus:
|
||||||
|
enabled: true
|
||||||
|
port: 9962
|
||||||
|
|
||||||
|
serviceMonitor:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
ipam:
|
||||||
|
mode: kubernetes
|
||||||
|
|
||||||
|
operator:
|
||||||
|
replicas: 1
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 64Mi
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 256Mi
|
||||||
|
prometheus:
|
||||||
|
enabled: true
|
||||||
|
port: 9963
|
||||||
|
metricsService: true
|
||||||
|
serviceMonitor:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 250m
|
||||||
|
memory: 512Mi
|
||||||
|
limits:
|
||||||
|
cpu: 250m
|
||||||
|
memory: 512Mi
|
||||||
|
|
||||||
|
kubeProxyReplacement: true
|
||||||
|
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
ciliumAgent:
|
||||||
|
- CHOWN
|
||||||
|
- KILL
|
||||||
|
- NET_ADMIN
|
||||||
|
- NET_RAW
|
||||||
|
- IPC_LOCK
|
||||||
|
- SYS_ADMIN
|
||||||
|
- SYS_RESOURCE
|
||||||
|
- DAC_OVERRIDE
|
||||||
|
- FOWNER
|
||||||
|
- SETGID
|
||||||
|
- SETUID
|
||||||
|
cleanCiliumState:
|
||||||
|
- NET_ADMIN
|
||||||
|
- SYS_ADMIN
|
||||||
|
- SYS_RESOURCE
|
||||||
|
|
||||||
|
envoy:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
limits:
|
||||||
|
memory: 1Gi
|
||||||
|
prometheus:
|
||||||
|
enabled: true
|
||||||
|
port: "9964"
|
||||||
|
serviceMonitor:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
cgroup:
|
||||||
|
autoMount:
|
||||||
|
enabled: false
|
||||||
|
hostRoot: /sys/fs/cgroup
|
||||||
|
|
||||||
|
k8sServiceHost: localhost
|
||||||
|
k8sServicePort: 7445
|
||||||
|
|
||||||
|
gatewayAPI:
|
||||||
|
enabled: true
|
||||||
|
enableAlpn: true
|
||||||
|
enableAppProtocol: true
|
||||||
|
|
||||||
|
hubble:
|
||||||
|
metrics:
|
||||||
|
enabled:
|
||||||
|
- dns
|
||||||
|
- drop
|
||||||
|
- tcp
|
||||||
|
- flow
|
||||||
|
- icmp
|
||||||
|
|
||||||
|
port: 9965
|
||||||
|
serviceMonitor:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
relay:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
ui:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
peerService:
|
||||||
|
enabled: false
|
||||||
|
clusterDomain: cluster.local
|
||||||
|
|
||||||
|
hostFirewall:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
l2announcements:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
bpf:
|
||||||
|
hostLegacyRouting: false
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
global:
|
||||||
|
image:
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
|
||||||
|
edition: ee
|
||||||
|
gitlabVersion: 17.11.1
|
||||||
|
|
||||||
|
hosts:
|
||||||
|
domain: internal
|
||||||
|
externalIP: 127.0.0.1
|
||||||
|
https: false
|
||||||
|
hostSuffix: dev
|
||||||
|
gitlab:
|
||||||
|
name: gitlab.internal
|
||||||
|
https: false
|
||||||
|
registry:
|
||||||
|
name: gitlab-registry.internal
|
||||||
|
https: false
|
||||||
|
minio:
|
||||||
|
name: gitlab-minio.internal
|
||||||
|
https: false
|
||||||
|
kas:
|
||||||
|
name: gitlab-kas.internal
|
||||||
|
https: false
|
||||||
|
pages:
|
||||||
|
name: gitlab-pages.internal
|
||||||
|
https: false
|
||||||
|
ssh: gitlab.internal
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
configureCertmanager: false
|
||||||
|
tls:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
monitoring:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
minio:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
appConfig:
|
||||||
|
enableUsagePing: true
|
||||||
|
enableSeatLink: false
|
||||||
|
enableImpersonation: true
|
||||||
|
applicationSettingsCacheSeconds: 600
|
||||||
|
usernameChangingEnabled: false
|
||||||
|
defaultTheme: 3 # Neutral
|
||||||
|
defaultColorMode: 3 # gl-system
|
||||||
|
defaultSyntaxHighlightingTheme: 5 # monokai
|
||||||
|
webhookTimeout: 60
|
||||||
|
graphQlTimeout: 30
|
||||||
|
|
||||||
|
sentry:
|
||||||
|
enabled: true
|
||||||
|
dsn: https://cde7d107f667aa4dda7650a40aaaebfb@o4508946895863808.ingest.de.sentry.io/4508946910412880
|
||||||
|
clientside_dsn: https://5d1073900c413a0361dee72fe9a3cc38@o4508946895863808.ingest.de.sentry.io/4508946925224016
|
||||||
|
environment: production
|
||||||
|
|
||||||
|
object_store:
|
||||||
|
enabled: true
|
||||||
|
proxy_download: false
|
||||||
|
connection:
|
||||||
|
secret: gitlab-rails-storage
|
||||||
|
key: connection
|
||||||
|
|
||||||
|
gitlab_docs:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
kas:
|
||||||
|
enabled: true
|
||||||
|
tls:
|
||||||
|
enabled: false
|
||||||
|
verify: false
|
||||||
|
|
||||||
|
spamcheck:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
registry:
|
||||||
|
enabled: true
|
||||||
|
bucket: gitlab-registry
|
||||||
|
|
||||||
|
tls:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
pages:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
runner:
|
||||||
|
registrationToken:
|
||||||
|
secret: prod-gitlab-runner-secret
|
||||||
|
|
||||||
|
smtp:
|
||||||
|
enabled: true
|
||||||
|
address: smtp.office365.com
|
||||||
|
port: 587
|
||||||
|
authentication: login
|
||||||
|
starttls_auto: true
|
||||||
|
openssl_verify_mode: peer
|
||||||
|
open_timeout: 30
|
||||||
|
read_timeout: 60
|
||||||
|
user_name: gitlab@itqdev.xyz
|
||||||
|
password:
|
||||||
|
secret: smtp-password
|
||||||
|
key: password
|
||||||
|
|
||||||
|
email:
|
||||||
|
displayName: GitLab
|
||||||
|
from: gitlab@itqdev.xyz
|
||||||
|
subject_suffix: GitLab
|
||||||
|
|
||||||
|
time_zone: UTC
|
||||||
|
|
||||||
|
webservice:
|
||||||
|
workerTimeout: 60
|
||||||
|
|
||||||
|
extraEnv:
|
||||||
|
GITLAB_RAILS_CACHE_DEFAULT_TTL_SECONDS: 43200
|
||||||
|
GITLAB_CI_CONFIG_FETCH_TIMEOUT_SECONDS: 60
|
||||||
|
GITLAB_DISABLE_MARKDOWN_TIMEOUT: false
|
||||||
|
GITLAB_LFS_LINK_BATCH_SIZE: 1000
|
||||||
|
GITLAB_LFS_MAX_OID_TO_FETCH: 100000
|
||||||
|
|
||||||
|
upgradeCheck:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
certmanager:
|
||||||
|
install: false
|
||||||
|
|
||||||
|
# TODO: Configure nginx-ingress
|
||||||
|
|
||||||
|
prometheus:
|
||||||
|
install: false
|
||||||
|
|
||||||
|
redis:
|
||||||
|
install: true
|
||||||
|
architecture: standalone
|
||||||
|
cluster:
|
||||||
|
enabled: false
|
||||||
|
metrics:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
postgresql:
|
||||||
|
install: true
|
||||||
|
metrics:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
sidekiq:
|
||||||
|
metrics:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
registry:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
gitlab-runner:
|
||||||
|
install: false
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: wazuh-indexer
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: wazuh-indexer
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 1.3G
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 1.3G
|
||||||
|
env:
|
||||||
|
- name: OPENSEARCH_JAVA_OPTS
|
||||||
|
value: "-Xms384m -Xmx384m"
|
||||||
|
- name: discovery.seed_hosts
|
||||||
|
value: "wazuh-indexer-0.wazuh-indexer"
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ../wazuh
|
||||||
|
- ../wazuh/wazuh_agents
|
||||||
|
- storage-class.yaml
|
||||||
|
|
||||||
|
patches:
|
||||||
|
- path: indexer-resources.yaml
|
||||||
|
- path: wazuh-master-resources.yaml
|
||||||
|
- path: wazuh-resources.yaml
|
||||||
|
|
||||||
|
replacements:
|
||||||
|
- source:
|
||||||
|
kind: ConfigMap
|
||||||
|
name: wazuh-storage-settings
|
||||||
|
fieldPath: data.storageClassName
|
||||||
|
targets:
|
||||||
|
- select:
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
fieldPaths:
|
||||||
|
- spec.storageClassName
|
||||||
|
options:
|
||||||
|
create: true
|
||||||
|
- select:
|
||||||
|
kind: StatefulSet
|
||||||
|
fieldPaths:
|
||||||
|
- spec.volumeClaimTemplates.*.spec.storageClassName
|
||||||
|
options:
|
||||||
|
create: true
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: wazuh-storage-settings
|
||||||
|
data:
|
||||||
|
storageClassName: proxmox-hdd
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: wazuh-manager-master
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: wazuh-manager
|
||||||
|
env:
|
||||||
|
- name: WAZUH_INDEXER_HOSTS
|
||||||
|
value: "wazuh-indexer-0.wazuh-indexer:9200"
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: wazuh-manager-worker
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: wazuh-manager
|
||||||
|
env:
|
||||||
|
- name: WAZUH_INDEXER_HOSTS
|
||||||
|
value: 'wazuh-indexer-0.wazuh-indexer:9200'
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: allow-dns
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
podSelector: {}
|
||||||
|
policyTypes:
|
||||||
|
- Egress
|
||||||
|
egress:
|
||||||
|
- to:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: kube-system
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
k8s-app: kube-dns
|
||||||
|
ports:
|
||||||
|
- protocol: UDP
|
||||||
|
port: 53
|
||||||
|
- protocol: TCP
|
||||||
|
port: 53
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: default-deny-all
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
podSelector: {}
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
- Egress
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Copyright (C) 2019, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
# Wazuh namespace
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: wazuh
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
nodes:
|
||||||
|
indexer:
|
||||||
|
- name: indexer
|
||||||
|
dns:
|
||||||
|
- "wazuh-indexer"
|
||||||
|
- "wazuh-indexer.wazuh.svc.cluster.local"
|
||||||
|
- "wazuh-indexer-0.wazuh-indexer"
|
||||||
|
- "wazuh-indexer-0.wazuh-indexer.wazuh.svc.cluster.local"
|
||||||
|
|
||||||
|
manager:
|
||||||
|
- name: manager
|
||||||
|
dns:
|
||||||
|
- "wazuh-api"
|
||||||
|
- "wazuh-api.wazuh.svc.cluster.local"
|
||||||
|
- "wazuh-agents"
|
||||||
|
- "wazuh-agents.wazuh.svc.cluster.local"
|
||||||
|
|
||||||
|
dashboard:
|
||||||
|
- name: dashboard
|
||||||
|
dns:
|
||||||
|
- "dashboard"
|
||||||
|
- "dashboard.wazuh.svc.cluster.local"
|
||||||
|
- "wazuh.internal.itqdev.xyz"
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
# Copyright (C) 2019, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
# Dashboard Deployment
|
||||||
|
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: wazuh-dashboard
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-dashboard
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: wazuh-dashboard
|
||||||
|
name: wazuh-dashboard
|
||||||
|
spec:
|
||||||
|
# No workload talks to the Kubernetes API.
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
volumes:
|
||||||
|
# The Secret gets the pod's fsGroup and group read, so the service user
|
||||||
|
# could read it: an init container copies it to a root-only file.
|
||||||
|
- name: wazuh-credentials
|
||||||
|
emptyDir:
|
||||||
|
medium: Memory
|
||||||
|
sizeLimit: 1Mi
|
||||||
|
- name: wazuh-credentials-secret
|
||||||
|
secret:
|
||||||
|
secretName: dashboard-credentials
|
||||||
|
defaultMode: 0400
|
||||||
|
- name: dashboard-config
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: wazuh-dashboard-config
|
||||||
|
- name: dashboard-certs
|
||||||
|
secret:
|
||||||
|
secretName: dashboard-certs
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 101
|
||||||
|
initContainers:
|
||||||
|
- name: install-credentials
|
||||||
|
image: 'wazuh/wazuh-dashboard:5.0.0-rc1'
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- 'umask 077 && cp /credentials-secret/wazuh-credentials /run/secrets/wazuh-credentials && chmod 0400 /run/secrets/wazuh-credentials'
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
capabilities:
|
||||||
|
drop: ["ALL"]
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 64Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
volumeMounts:
|
||||||
|
- name: wazuh-credentials-secret
|
||||||
|
mountPath: /credentials-secret
|
||||||
|
readOnly: true
|
||||||
|
- name: wazuh-credentials
|
||||||
|
mountPath: /run/secrets
|
||||||
|
- name: init-dashboard-config
|
||||||
|
image: 'wazuh/wazuh-dashboard:5.0.0-rc1'
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
if [ ! -f /pvc-config/opensearch_dashboards.yml ]; then
|
||||||
|
cp -a /usr/share/wazuh-dashboard/config/. /pvc-config/
|
||||||
|
fi
|
||||||
|
volumeMounts:
|
||||||
|
- name: dashboard-config
|
||||||
|
mountPath: /pvc-config
|
||||||
|
subPath: config
|
||||||
|
containers:
|
||||||
|
- name: wazuh-dashboard
|
||||||
|
image: 'wazuh/wazuh-dashboard:5.0.0-rc1'
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 1Gi
|
||||||
|
volumeMounts:
|
||||||
|
- name: wazuh-credentials
|
||||||
|
mountPath: /run/secrets
|
||||||
|
readOnly: true
|
||||||
|
- name: dashboard-config
|
||||||
|
mountPath: /usr/share/wazuh-dashboard/config
|
||||||
|
subPath: config
|
||||||
|
- name: dashboard-certs
|
||||||
|
mountPath: /usr/share/wazuh-dashboard/config/certs/dashboard.pem
|
||||||
|
readOnly: true
|
||||||
|
subPath: dashboard.pem
|
||||||
|
- name: dashboard-certs
|
||||||
|
mountPath: /usr/share/wazuh-dashboard/config/certs/dashboard-key.pem
|
||||||
|
readOnly: true
|
||||||
|
subPath: dashboard-key.pem
|
||||||
|
- name: dashboard-certs
|
||||||
|
mountPath: /usr/share/wazuh-dashboard/config/certs/root-ca.pem
|
||||||
|
subPath: root-ca.pem
|
||||||
|
readOnly: true
|
||||||
|
ports:
|
||||||
|
- containerPort: 443
|
||||||
|
name: dashboard
|
||||||
|
startupProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- curl -k -s -o /dev/null https://localhost:443/app/login
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 10
|
||||||
|
failureThreshold: 12
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- curl -kfsS -o /dev/null https://localhost:443/app/login
|
||||||
|
periodSeconds: 30
|
||||||
|
timeoutSeconds: 10
|
||||||
|
failureThreshold: 3
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- curl -k -s -o /dev/null https://localhost:443/app/login
|
||||||
|
periodSeconds: 30
|
||||||
|
timeoutSeconds: 10
|
||||||
|
failureThreshold: 3
|
||||||
|
env:
|
||||||
|
- name: OPENSEARCH_HOSTS
|
||||||
|
value: 'https://wazuh-indexer:9200'
|
||||||
|
- name: SERVER_SSL_ENABLED
|
||||||
|
value: "true"
|
||||||
|
- name: SERVER_SSL_CERTIFICATE
|
||||||
|
value: /usr/share/wazuh-dashboard/config/certs/dashboard.pem
|
||||||
|
- name: SERVER_SSL_KEY
|
||||||
|
value: /usr/share/wazuh-dashboard/config/certs/dashboard-key.pem
|
||||||
|
- name: OPENSEARCH_SSL_CERTIFICATE_AUTHORITIES
|
||||||
|
value: /usr/share/wazuh-dashboard/config/certs/root-ca.pem
|
||||||
|
- name: WAZUH_API_URL
|
||||||
|
value: https://wazuh-api
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: dashboard-egress
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-dashboard
|
||||||
|
policyTypes:
|
||||||
|
- Egress
|
||||||
|
egress:
|
||||||
|
- to:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-indexer
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 9200
|
||||||
|
- to:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-manager
|
||||||
|
node-type: master
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 55000
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# Copyright (C) 2019, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
# Wazuh dashboard configuration claim
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: wazuh-dashboard-config
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Gi
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Copyright (C) 2019, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
# Dashboard service
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: dashboard
|
||||||
|
namespace: wazuh
|
||||||
|
labels:
|
||||||
|
app: wazuh-dashboard
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: wazuh-dashboard
|
||||||
|
ports:
|
||||||
|
- name: dashboard
|
||||||
|
port: 443
|
||||||
|
targetPort: 443
|
||||||
@@ -0,0 +1,214 @@
|
|||||||
|
# Copyright (C) 2019, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
# Indexer StatefulSet: 3 master nodes.
|
||||||
|
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: wazuh-indexer
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
replicas: 3
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-indexer
|
||||||
|
serviceName: wazuh-indexer
|
||||||
|
# The indexer nodes form a quorum and have to be recreated together.
|
||||||
|
podManagementPolicy: Parallel
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: wazuh-indexer
|
||||||
|
name: wazuh-indexer
|
||||||
|
spec:
|
||||||
|
# No workload talks to the Kubernetes API.
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 101
|
||||||
|
# Set the wazuh-indexer volume permissions so the wazuh-indexer user can use it
|
||||||
|
volumes:
|
||||||
|
# The Secret gets the pod's fsGroup and group read, so the service user
|
||||||
|
# could read it: an init container copies it to a root-only file.
|
||||||
|
- name: wazuh-credentials
|
||||||
|
emptyDir:
|
||||||
|
medium: Memory
|
||||||
|
sizeLimit: 1Mi
|
||||||
|
- name: wazuh-credentials-secret
|
||||||
|
secret:
|
||||||
|
secretName: indexer-credentials
|
||||||
|
defaultMode: 0400
|
||||||
|
- name: indexer-certs
|
||||||
|
secret:
|
||||||
|
secretName: indexer-certs
|
||||||
|
defaultMode: 0600
|
||||||
|
initContainers:
|
||||||
|
- name: install-credentials
|
||||||
|
image: 'wazuh/wazuh-indexer:5.0.0-rc1'
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- 'umask 077 && cp /credentials-secret/wazuh-credentials /run/secrets/wazuh-credentials && chmod 0400 /run/secrets/wazuh-credentials'
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
capabilities:
|
||||||
|
drop: ["ALL"]
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 64Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
volumeMounts:
|
||||||
|
- name: wazuh-credentials-secret
|
||||||
|
mountPath: /credentials-secret
|
||||||
|
readOnly: true
|
||||||
|
- name: wazuh-credentials
|
||||||
|
mountPath: /run/secrets
|
||||||
|
- name: volume-mount-hack
|
||||||
|
image: busybox
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 128Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 256Mi
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- '-c'
|
||||||
|
- 'chown -R 101:101 /var/lib/wazuh-indexer'
|
||||||
|
volumeMounts:
|
||||||
|
- name: wazuh-indexer
|
||||||
|
mountPath: /var/lib/wazuh-indexer
|
||||||
|
# - name: increase-the-vm-max-map-count
|
||||||
|
# image: busybox
|
||||||
|
# command:
|
||||||
|
# - sysctl
|
||||||
|
# - -w
|
||||||
|
# - vm.max_map_count=262144
|
||||||
|
# securityContext:
|
||||||
|
# privileged: true
|
||||||
|
containers:
|
||||||
|
- name: wazuh-indexer
|
||||||
|
image: 'wazuh/wazuh-indexer:5.0.0-rc1'
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 1564Mi
|
||||||
|
env:
|
||||||
|
- name: bootstrap.memory_lock
|
||||||
|
value: "false"
|
||||||
|
- name: network.host
|
||||||
|
value: "0.0.0.0"
|
||||||
|
- name: POD_NAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.name
|
||||||
|
- name: POD_NAMESPACE
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.namespace
|
||||||
|
# Keep below POD_NAME and POD_NAMESPACE: $(VAR) expands backwards only.
|
||||||
|
- name: network.publish_host
|
||||||
|
value: "$(POD_NAME).wazuh-indexer.$(POD_NAMESPACE).svc.cluster.local"
|
||||||
|
- name: node.name
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.name
|
||||||
|
- name: cluster.initial_cluster_manager_nodes
|
||||||
|
value: wazuh-indexer-0
|
||||||
|
# For a 3-node cluster, all nodes should be listed here, if another node is added, it should be included as well
|
||||||
|
- name: discovery.seed_hosts
|
||||||
|
value: "wazuh-indexer-0.wazuh-indexer,wazuh-indexer-1.wazuh-indexer,wazuh-indexer-2.wazuh-indexer"
|
||||||
|
- name: node.max_local_storage_nodes
|
||||||
|
value: "3"
|
||||||
|
- name: plugins.security.allow_default_init_securityindex
|
||||||
|
value: "true"
|
||||||
|
- name: NODES_DN
|
||||||
|
value: CN=indexer,OU=Wazuh,O=Wazuh,L=California,C=US
|
||||||
|
- name: OPENSEARCH_JAVA_OPTS
|
||||||
|
value: '-Xms1g -Xmx1g -Dlog4j2.formatMsgNoLookups=true'
|
||||||
|
- name: DISCOVERY_SERVICE
|
||||||
|
value: wazuh-indexer
|
||||||
|
- name: KUBERNETES_NAMESPACE
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.namespace
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add: ["SYS_CHROOT"]
|
||||||
|
volumeMounts:
|
||||||
|
- name: wazuh-credentials
|
||||||
|
mountPath: /run/secrets
|
||||||
|
readOnly: true
|
||||||
|
- name: wazuh-indexer
|
||||||
|
mountPath: /var/lib/wazuh-indexer
|
||||||
|
- name: indexer-certs
|
||||||
|
mountPath: /usr/share/wazuh-indexer/config/certs/indexer-key.pem
|
||||||
|
subPath: indexer-key.pem
|
||||||
|
readOnly: true
|
||||||
|
- name: indexer-certs
|
||||||
|
mountPath: /usr/share/wazuh-indexer/config/certs/indexer.pem
|
||||||
|
subPath: indexer.pem
|
||||||
|
readOnly: true
|
||||||
|
- name: indexer-certs
|
||||||
|
mountPath: /usr/share/wazuh-indexer/config/certs/root-ca.pem
|
||||||
|
subPath: root-ca.pem
|
||||||
|
readOnly: true
|
||||||
|
- name: indexer-certs
|
||||||
|
mountPath: /usr/share/wazuh-indexer/config/certs/admin.pem
|
||||||
|
subPath: admin.pem
|
||||||
|
readOnly: true
|
||||||
|
- name: indexer-certs
|
||||||
|
mountPath: /usr/share/wazuh-indexer/config/certs/admin-key.pem
|
||||||
|
subPath: admin-key.pem
|
||||||
|
readOnly: true
|
||||||
|
ports:
|
||||||
|
- containerPort: 9200
|
||||||
|
name: indexer-rest
|
||||||
|
- containerPort: 9300
|
||||||
|
name: indexer-nodes
|
||||||
|
startupProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- curl -fks https://localhost:9200/_plugins/_security/health | grep -q '"status":"UP"'
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 10
|
||||||
|
failureThreshold: 30
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- curl -fks https://localhost:9200/_plugins/_security/health | grep -q '"status":"UP"'
|
||||||
|
periodSeconds: 30
|
||||||
|
timeoutSeconds: 10
|
||||||
|
failureThreshold: 5
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- curl -fks https://localhost:9200/_plugins/_security/health | grep -q '"status":"UP"'
|
||||||
|
periodSeconds: 30
|
||||||
|
timeoutSeconds: 10
|
||||||
|
failureThreshold: 5
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- metadata:
|
||||||
|
name: wazuh-indexer
|
||||||
|
namespace: indexer-cluster
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 10Gi
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: indexer-egress
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-indexer
|
||||||
|
policyTypes:
|
||||||
|
- Egress
|
||||||
|
egress:
|
||||||
|
- to:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-indexer
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 9300
|
||||||
|
- to:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-indexer
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 9200
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: indexer-ingress
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-indexer
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-dashboard
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 9200
|
||||||
|
- from:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-manager
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 9200
|
||||||
|
- from:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-indexer
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 9300
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# Copyright (C) 2019, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
# Indexer service: Communications
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: wazuh-indexer
|
||||||
|
namespace: wazuh
|
||||||
|
labels:
|
||||||
|
app: wazuh-indexer
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: wazuh-indexer
|
||||||
|
ports:
|
||||||
|
- name: indexer-nodes
|
||||||
|
port: 9300
|
||||||
|
targetPort: 9300
|
||||||
|
- name: indexer-rest
|
||||||
|
port: 9200
|
||||||
|
targetPort: 9200
|
||||||
|
clusterIP: None
|
||||||
|
# The indexer nodes resolve each other before any of them is ready.
|
||||||
|
publishNotReadyAddresses: true
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# Copyright (C) 2019, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
|
||||||
|
# Adds wazuh namespace to all resources.
|
||||||
|
namespace: wazuh
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- base/wazuh-ns.yaml
|
||||||
|
- base/Allow-DNS-np.yaml
|
||||||
|
- base/default-deny-all.yaml
|
||||||
|
|
||||||
|
- wazuh_managers/wazuh-cluster-svc.yaml
|
||||||
|
- wazuh_managers/wazuh-agents-svc.yaml
|
||||||
|
- wazuh_managers/wazuh-events-svc.yaml
|
||||||
|
- wazuh_managers/wazuh-registration-svc.yaml
|
||||||
|
- wazuh_managers/wazuh-api-svc.yaml
|
||||||
|
- wazuh_managers/wazuh-master-sts.yaml
|
||||||
|
- wazuh_managers/wazuh-worker-sts.yaml
|
||||||
|
- wazuh_managers/network-policies/manager-egress.yaml
|
||||||
|
- wazuh_managers/network-policies/manager-egress-external.yaml
|
||||||
|
- wazuh_managers/network-policies/wazuh-master-ingress.yaml
|
||||||
|
- wazuh_managers/network-policies/wazuh-worker-egress.yaml
|
||||||
|
- wazuh_managers/network-policies/falco-agent-ingress.yaml
|
||||||
|
|
||||||
|
- indexer_stack/wazuh-indexer/indexer-svc.yaml
|
||||||
|
- indexer_stack/wazuh-indexer/indexer-egress.yaml
|
||||||
|
- indexer_stack/wazuh-indexer/indexer-ingress.yaml
|
||||||
|
- indexer_stack/wazuh-indexer/cluster/indexer-sts.yaml
|
||||||
|
|
||||||
|
- indexer_stack/wazuh-dashboard/dashboard-pvc.yaml
|
||||||
|
- indexer_stack/wazuh-dashboard/dashboard-deploy.yaml
|
||||||
|
- indexer_stack/wazuh-dashboard/dashboard-svc.yaml
|
||||||
|
- indexer_stack/wazuh-dashboard/dashboard-egress.yaml
|
||||||
+341
@@ -0,0 +1,341 @@
|
|||||||
|
# Certificate tool - Main functions
|
||||||
|
# Copyright (C) 2015, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
function getHelp() {
|
||||||
|
|
||||||
|
echo -e ""
|
||||||
|
echo -e "NAME"
|
||||||
|
echo -e " wazuh-certs-tool.sh - Manages the creation of certificates of the Wazuh components."
|
||||||
|
echo -e ""
|
||||||
|
echo -e "SYNOPSIS"
|
||||||
|
echo -e " wazuh-certs-tool.sh [OPTIONS]"
|
||||||
|
echo -e ""
|
||||||
|
echo -e "DESCRIPTION"
|
||||||
|
echo -e " -a, --admin-certificates"
|
||||||
|
echo -e " Creates the admin certificates."
|
||||||
|
echo -e ""
|
||||||
|
echo -e " -as, --agent-san <ip|dns>"
|
||||||
|
echo -e " Adds an extra address to the subject alternative name of every"
|
||||||
|
echo -e " agent listener certificate, on top of the ip and dns entries of"
|
||||||
|
echo -e " each manager node in config.yml. Repeat it for more than one."
|
||||||
|
echo -e " It is how to name an address agents dial that no single node"
|
||||||
|
echo -e " owns, such as a load balancer shared by every node of a cluster."
|
||||||
|
echo -e " Must be used along with one of these options: -A, -wm"
|
||||||
|
echo -e ""
|
||||||
|
echo -e " -ap, --api-san <ip|dns>"
|
||||||
|
echo -e " Adds an extra address to the subject alternative name of every"
|
||||||
|
echo -e " Server API certificate, on top of the ip and dns entries of each"
|
||||||
|
echo -e " manager node in config.yml and loopback. Repeat it for more than"
|
||||||
|
echo -e " one. Use it for the address API clients dial, such as a published"
|
||||||
|
echo -e " name or a load balancer in front of the Server API."
|
||||||
|
echo -e " Must be used along with one of these options: -A, -wm"
|
||||||
|
echo -e ""
|
||||||
|
echo -e " -A, --all"
|
||||||
|
echo -e " Creates certificates specified in config.yml and admin certificates."
|
||||||
|
echo -e " If there is no root CA in the CA directory, a new one is created there."
|
||||||
|
echo -e ""
|
||||||
|
echo -e " -ca, --root-ca-certificates"
|
||||||
|
echo -e " Creates the root CA in the CA directory, if it does not exist yet."
|
||||||
|
echo -e ""
|
||||||
|
echo -e " -lb, --load-balancer-certificates"
|
||||||
|
echo -e " Creates the certificates of the load_balancer entries of config.yml."
|
||||||
|
echo -e " Only needed by a proxy that terminates"
|
||||||
|
echo -e " TLS: it is then the certificate agents validate, signed by the same"
|
||||||
|
echo -e " root-ca they pin. A layer 4 passthrough load balancer terminates"
|
||||||
|
echo -e " nothing and needs -as|--agent-san instead."
|
||||||
|
echo -e ""
|
||||||
|
echo -e " -v, --verbose"
|
||||||
|
echo -e " Enables verbose mode."
|
||||||
|
echo -e ""
|
||||||
|
echo -e " -wd, --wazuh-dashboard-certificates"
|
||||||
|
echo -e " Creates the Wazuh dashboard certificates."
|
||||||
|
echo -e ""
|
||||||
|
echo -e " -wi, --wazuh-indexer-certificates"
|
||||||
|
echo -e " Creates the Wazuh indexer certificates."
|
||||||
|
echo -e ""
|
||||||
|
echo -e " -wm, --wazuh-manager-certificates"
|
||||||
|
echo -e " Creates the Wazuh manager certificates."
|
||||||
|
echo -e " Each manager node also gets <name>-remoted.pem and <name>-remoted-key.pem,"
|
||||||
|
echo -e " the certificate of the agent listener (remoted and authd), and"
|
||||||
|
echo -e " <name>-apid.pem and <name>-apid-key.pem, the certificate of the Server API."
|
||||||
|
echo -e ""
|
||||||
|
echo -e " -tmp, --cert_tmp_path </path/to/tmp_dir>"
|
||||||
|
echo -e " Uses this directory to create the certificates, instead of a new one in /tmp."
|
||||||
|
echo -e " The directory must not exist, or must be an empty directory owned by root."
|
||||||
|
echo -e " Must be used along with one of these options: -a, -A, -ca, -wi, -wd, -wm, -lb"
|
||||||
|
echo -e ""
|
||||||
|
echo -e "ROOT CA"
|
||||||
|
echo -e " The root CA is read from $(wazuh_ca_get_dir 2>/dev/null), or from the directory set in WAZUH_CA_DIR."
|
||||||
|
echo -e " Its private key, root-ca.key, stays there and is never copied to the wazuh-certificates directory."
|
||||||
|
echo -e " The tool must be run as root."
|
||||||
|
echo -e ""
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
|
||||||
|
# Set a restrictive umask so new regular files default to 600 and directories to 700,
|
||||||
|
# limiting access to the current user.
|
||||||
|
umask 0077
|
||||||
|
|
||||||
|
# The shared credentials library only creates and reads the root CA as root.
|
||||||
|
common_checkRoot
|
||||||
|
cert_checkOpenSSL
|
||||||
|
|
||||||
|
declare -a agent_san=()
|
||||||
|
declare -a api_san=()
|
||||||
|
|
||||||
|
if [ -n "${1}" ]; then
|
||||||
|
while [ -n "${1}" ]
|
||||||
|
do
|
||||||
|
case "${1}" in
|
||||||
|
"-a"|"--admin-certificates")
|
||||||
|
cert_rejectCAPaths "-a|--admin-certificates" "${2}"
|
||||||
|
cadmin=1
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
"-A"|"--all")
|
||||||
|
cert_rejectCAPaths "-A|--all" "${2}"
|
||||||
|
all=1
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
"-as"|"--agent-san")
|
||||||
|
if [[ -z "${2}" || "${2}" == -* ]]; then
|
||||||
|
common_logger -e "Error on arguments. Probably missing <ip|dns> after -as|--agent-san"
|
||||||
|
getHelp
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
agent_san+=("${2}")
|
||||||
|
shift 2
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"-ap"|"--api-san")
|
||||||
|
if [[ -z "${2}" || "${2}" == -* ]]; then
|
||||||
|
common_logger -e "Error on arguments. Probably missing <ip|dns> after -ap|--api-san"
|
||||||
|
getHelp
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
api_san+=("${2}")
|
||||||
|
shift 2
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"-ca"|"--root-ca-certificates"|"--root-ca-certificate")
|
||||||
|
ca=1
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
"-lb"|"--load-balancer-certificates")
|
||||||
|
cert_rejectCAPaths "-lb|--load-balancer-certificates" "${2}"
|
||||||
|
clb=1
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
"-h"|"--help")
|
||||||
|
getHelp
|
||||||
|
;;
|
||||||
|
"-v"|"--verbose")
|
||||||
|
debugEnabled=1
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
"-wd"|"--wazuh-dashboard-certificates")
|
||||||
|
cert_rejectCAPaths "-wd|--wazuh-dashboard-certificates" "${2}"
|
||||||
|
cdashboard=1
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
"-wi"|"--wazuh-indexer-certificates")
|
||||||
|
cert_rejectCAPaths "-wi|--wazuh-indexer-certificates" "${2}"
|
||||||
|
cindexer=1
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
"-wm"|"--wazuh-manager-certificates")
|
||||||
|
cert_rejectCAPaths "-wm|--wazuh-manager-certificates" "${2}"
|
||||||
|
cmanager=1
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
"-tmp"|"--cert_tmp_path")
|
||||||
|
if [[ -n "${3}" || ( "${cadmin}" == 1 || "${all}" == 1 || "${ca}" == 1 || "${cdashboard}" == 1 || "${cindexer}" == 1 || "${cmanager}" == 1 || "${clb}" == 1 ) ]]; then
|
||||||
|
if [[ -z "${2}" || ! "${2}" == /* ]]; then
|
||||||
|
common_logger -e "Error on arguments. Probably missing </path/to/tmp_dir> or path does not start with '/'."
|
||||||
|
getHelp
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
cert_tmp_path="${2}"
|
||||||
|
shift 2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
common_logger -e "Error: -tmp must be used along with one of these options: -a, -A, -ca, -wi, -wd, -wm, -lb"
|
||||||
|
getHelp
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown option: ${1}"
|
||||||
|
getHelp
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
common_logger "Verbose logging redirected to ${logfile}"
|
||||||
|
|
||||||
|
cert_validateAgentSan
|
||||||
|
cert_validateApiSan
|
||||||
|
|
||||||
|
if [[ -d "${base_path}"/wazuh-certificates ]]; then
|
||||||
|
if [ -n "$(ls -A "${base_path}"/wazuh-certificates)" ]; then
|
||||||
|
common_logger -e "Directory wazuh-certificates already exists in the same path as the script. Please, remove the certs directory to create new certificates."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# Removed so the temporary directory is moved to this name and not inside it.
|
||||||
|
rmdir "${base_path}"/wazuh-certificates
|
||||||
|
fi
|
||||||
|
|
||||||
|
cert_createTmpDir
|
||||||
|
|
||||||
|
cert_readConfig
|
||||||
|
|
||||||
|
if [[ -n "${all}" || -n "${cmanager}" ]]; then
|
||||||
|
cert_checkListenerReachability "warning"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${debugEnabled}" ]; then
|
||||||
|
debug="2>&1 | tee -a ${logfile}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${cadmin}" ]]; then
|
||||||
|
cert_checkRootCA
|
||||||
|
cert_generateAdmincertificate
|
||||||
|
common_logger "Admin certificates created."
|
||||||
|
cert_cleanFiles
|
||||||
|
cert_setpermisions
|
||||||
|
if [ -n "${debugEnabled}" ]; then
|
||||||
|
mv "${cert_tmp_path}" "${base_path}/wazuh-certificates"
|
||||||
|
else
|
||||||
|
mv "${cert_tmp_path}" "${base_path}/wazuh-certificates" > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${all}" ]]; then
|
||||||
|
cert_checkRootCA "create"
|
||||||
|
cert_generateAdmincertificate
|
||||||
|
common_logger "Admin certificates created."
|
||||||
|
if cert_generateIndexercertificates; then
|
||||||
|
common_logger "Wazuh indexer certificates created."
|
||||||
|
fi
|
||||||
|
if cert_generateManagercertificates; then
|
||||||
|
common_logger "Wazuh manager certificates created."
|
||||||
|
fi
|
||||||
|
if cert_generateDashboardcertificates; then
|
||||||
|
common_logger "Wazuh dashboard certificates created."
|
||||||
|
fi
|
||||||
|
# Only when config.yml carries a load_balancer section: it is optional and
|
||||||
|
# its absence is not an error.
|
||||||
|
if cert_generateLoadbalancercertificates; then
|
||||||
|
common_logger "Load balancer certificates created."
|
||||||
|
fi
|
||||||
|
cert_cleanFiles
|
||||||
|
cert_setpermisions
|
||||||
|
if [ -n "${debugEnabled}" ]; then
|
||||||
|
mv "${cert_tmp_path}" "${base_path}/wazuh-certificates"
|
||||||
|
else
|
||||||
|
mv "${cert_tmp_path}" "${base_path}/wazuh-certificates" > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
cert_verifyRemotedcertificates "${base_path}/wazuh-certificates"
|
||||||
|
cert_verifyLoadbalancercertificates "${base_path}/wazuh-certificates"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${ca}" ]]; then
|
||||||
|
cert_generateRootCAcertificate
|
||||||
|
cp "${cert_ca_dir}/root-ca.pem" "${cert_tmp_path}/root-ca.pem"
|
||||||
|
common_logger "The root CA is in ${cert_ca_dir}. Its private key, root-ca.key, stays there."
|
||||||
|
cert_cleanFiles
|
||||||
|
cert_setpermisions
|
||||||
|
if [ -n "${debugEnabled}" ]; then
|
||||||
|
mv "${cert_tmp_path}" "${base_path}/wazuh-certificates"
|
||||||
|
else
|
||||||
|
mv "${cert_tmp_path}" "${base_path}/wazuh-certificates" > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${cindexer}" ]]; then
|
||||||
|
if [ ${#indexer_node_names[@]} -gt 0 ]; then
|
||||||
|
cert_checkRootCA
|
||||||
|
cert_generateIndexercertificates
|
||||||
|
common_logger "Wazuh indexer certificates created."
|
||||||
|
cert_cleanFiles
|
||||||
|
cert_setpermisions
|
||||||
|
if [ -n "${debugEnabled}" ]; then
|
||||||
|
mv "${cert_tmp_path}" "${base_path}/wazuh-certificates"
|
||||||
|
else
|
||||||
|
mv "${cert_tmp_path}" "${base_path}/wazuh-certificates" > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
common_logger -e "Indexer node not present in config.yml."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${cmanager}" ]]; then
|
||||||
|
if [ ${#manager_node_names[@]} -gt 0 ]; then
|
||||||
|
cert_checkRootCA
|
||||||
|
cert_generateManagercertificates
|
||||||
|
common_logger "Wazuh manager certificates created."
|
||||||
|
cert_cleanFiles
|
||||||
|
cert_setpermisions
|
||||||
|
if [ -n "${debugEnabled}" ]; then
|
||||||
|
mv "${cert_tmp_path}" "${base_path}/wazuh-certificates"
|
||||||
|
else
|
||||||
|
mv "${cert_tmp_path}" "${base_path}/wazuh-certificates" > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
cert_verifyRemotedcertificates "${base_path}/wazuh-certificates"
|
||||||
|
else
|
||||||
|
common_logger -e "Manager node not present in config.yml."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${clb}" ]]; then
|
||||||
|
if [ ${#lb_node_names[@]} -gt 0 ]; then
|
||||||
|
cert_checkRootCA
|
||||||
|
cert_generateLoadbalancercertificates
|
||||||
|
common_logger "Load balancer certificates created."
|
||||||
|
cert_cleanFiles
|
||||||
|
cert_setpermisions
|
||||||
|
if [ -n "${debugEnabled}" ]; then
|
||||||
|
mv "${cert_tmp_path}" "${base_path}/wazuh-certificates"
|
||||||
|
else
|
||||||
|
mv "${cert_tmp_path}" "${base_path}/wazuh-certificates" > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
cert_verifyLoadbalancercertificates "${base_path}/wazuh-certificates"
|
||||||
|
else
|
||||||
|
common_logger -e "Load balancer section not present in config.yml."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${cdashboard}" ]]; then
|
||||||
|
if [ ${#dashboard_node_names[@]} -gt 0 ]; then
|
||||||
|
cert_checkRootCA
|
||||||
|
cert_generateDashboardcertificates
|
||||||
|
common_logger "Wazuh dashboard certificates created."
|
||||||
|
cert_cleanFiles
|
||||||
|
cert_setpermisions
|
||||||
|
if [ -n "${debugEnabled}" ]; then
|
||||||
|
mv "${cert_tmp_path}" "${base_path}/wazuh-certificates"
|
||||||
|
else
|
||||||
|
mv "${cert_tmp_path}" "${base_path}/wazuh-certificates" > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
common_logger -e "Dashboard node not present in config.yml."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
getHelp
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,957 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Shared credential helpers for Wazuh package scripts.
|
||||||
|
#
|
||||||
|
# This file is a library. Source it with:
|
||||||
|
#
|
||||||
|
# . /usr/share/wazuh-<component>/lib/wazuh-credentials.sh
|
||||||
|
#
|
||||||
|
# Importing it performs no action and does not change the caller's shell
|
||||||
|
# options, umask, IFS, working directory, or traps.
|
||||||
|
#
|
||||||
|
# Public functions and return values
|
||||||
|
# ----------------------------------
|
||||||
|
# wazuh_base_get_dir / wazuh_env_get_file
|
||||||
|
# Base: process WAZUH_BASE_DIR or /etc/wazuh. ENV: <base>/credentials.env.
|
||||||
|
# The base cannot come from that file (circular lookup). Empty is invalid.
|
||||||
|
# Getters do not create anything; writers create missing parents safely.
|
||||||
|
# All helpers on a host MUST use the same base to share the same lock.
|
||||||
|
# wazuh_ca_get_dir
|
||||||
|
# Prints the resolved CA directory. Resolution order is the value in
|
||||||
|
# <base>/credentials.env, then WAZUH_CA_DIR from the process
|
||||||
|
# environment, with <base>/ca as default. Empty is invalid.
|
||||||
|
# WAZUH_CA_DIR moves only the CA, never the ENV or the lock.
|
||||||
|
#
|
||||||
|
# wazuh_ca_validate
|
||||||
|
# Returns 0 for a valid anchor, with or without its matching private key.
|
||||||
|
# Returns non-zero for an absent, partial, invalid, or insecure CA.
|
||||||
|
#
|
||||||
|
# wazuh_ca_ensure
|
||||||
|
# Creates root-ca.pem and root-ca.key only when both are absent. Existing
|
||||||
|
# material is validated and never regenerated. An anchor without a key is
|
||||||
|
# a valid external CA; a key without an anchor is an error.
|
||||||
|
#
|
||||||
|
# wazuh_env_get NAME
|
||||||
|
# Reads data only; unquoted values or single/double quoted single lines.
|
||||||
|
# Writes require a newline-terminated file; multiline values are rejected.
|
||||||
|
# Prints the last value assigned to NAME in credentials.env without
|
||||||
|
# sourcing the file. Returns 0 when found, 1 when absent, and 2 when the
|
||||||
|
# file or request is invalid.
|
||||||
|
#
|
||||||
|
# wazuh_env_set NAME VALUE
|
||||||
|
# Adds or replaces NAME inside the Wazuh-managed block only.
|
||||||
|
#
|
||||||
|
# wazuh_env_unset NAME
|
||||||
|
# Removes NAME from the Wazuh-managed block only.
|
||||||
|
#
|
||||||
|
# wazuh_password_generate
|
||||||
|
# Prints a 32-character password generated from /dev/urandom, drawn from
|
||||||
|
# the password character set below, with at least one character of each
|
||||||
|
# of its four classes.
|
||||||
|
#
|
||||||
|
# wazuh_password_validate VALUE
|
||||||
|
# Enforces 12-64 characters drawn only from the password character set
|
||||||
|
# A-Z a-z 0-9 . , _ + : @ % ^ = ~ -, with at least one uppercase letter,
|
||||||
|
# one lowercase letter, one digit and one symbol. The rejected value is
|
||||||
|
# never included in diagnostics.
|
||||||
|
#
|
||||||
|
# The library deliberately uses flock(1), GNU stat(1), OpenSSL, awk, and the
|
||||||
|
# usual Linux userland (including ln -T) on Debian- and RPM-based systems.
|
||||||
|
# Capture password output; do not use shell xtrace around secret operations.
|
||||||
|
# Pin BOTH helper files to matching versions: the manager uses private helpers.
|
||||||
|
|
||||||
|
_wazuh_error() (
|
||||||
|
printf '%s\n' "wazuh-credentials: $*" >&2
|
||||||
|
)
|
||||||
|
|
||||||
|
# Notices go to stderr too, so they never mix with the values callers capture.
|
||||||
|
_wazuh_info() (
|
||||||
|
printf '%s\n' "wazuh-credentials: $*" >&2
|
||||||
|
)
|
||||||
|
|
||||||
|
wazuh_base_get_dir() (
|
||||||
|
_wazuh_base=${WAZUH_BASE_DIR-/etc/wazuh}
|
||||||
|
_wazuh_validate_absolute_path "$_wazuh_base" || return 1
|
||||||
|
printf '%s\n' "$_wazuh_base"
|
||||||
|
)
|
||||||
|
|
||||||
|
wazuh_env_get_file() (
|
||||||
|
_wazuh_base=$(wazuh_base_get_dir) || return 1
|
||||||
|
printf '%s/credentials.env\n' "$_wazuh_base"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Validate from the root down; never traverse an unchecked symlink first.
|
||||||
|
# Missing components are allowed by this read-only helper.
|
||||||
|
_wazuh_check_existing_tree() (
|
||||||
|
[ "$1" = / ] && { _wazuh_validate_directory_node / ''; return $?; }
|
||||||
|
_wazuh_parent=${1%/*}
|
||||||
|
[ -n "$_wazuh_parent" ] || _wazuh_parent=/
|
||||||
|
_wazuh_check_existing_tree "$_wazuh_parent" || return 1
|
||||||
|
if [ -e "$1" ] || [ -L "$1" ]; then
|
||||||
|
_wazuh_validate_directory_node "$1" '' || return 1
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create one component at a time, never chmod/chown an existing directory.
|
||||||
|
# Parent validation excludes group/world writers, including sticky /tmp.
|
||||||
|
_wazuh_make_secure_tree() (
|
||||||
|
[ "$(id -u)" = 0 ] || { _wazuh_error 'root is required'; return 1; }
|
||||||
|
[ "$1" = / ] && { _wazuh_validate_directory_node / ''; return $?; }
|
||||||
|
_wazuh_parent=${1%/*}
|
||||||
|
[ -n "$_wazuh_parent" ] || _wazuh_parent=/
|
||||||
|
_wazuh_make_secure_tree "$_wazuh_parent" || return 1
|
||||||
|
if [ ! -e "$1" ] && [ ! -L "$1" ]; then
|
||||||
|
# Another cooperating process may create it first; always revalidate.
|
||||||
|
(umask 077; mkdir -m 0700 -- "$1") 2>/dev/null || {
|
||||||
|
[ -d "$1" ] || { _wazuh_error "cannot create directory: $1"; return 1; }
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
_wazuh_validate_directory_node "$1" ''
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_validate_name() (
|
||||||
|
case ${1-} in
|
||||||
|
''|[0-9]*|*[!ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_]*)
|
||||||
|
_wazuh_error "invalid environment variable name"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_validate_absolute_path() (
|
||||||
|
_wazuh_path=${1-}
|
||||||
|
|
||||||
|
case $_wazuh_path in
|
||||||
|
''|/)
|
||||||
|
_wazuh_error "directory must be a non-empty absolute path other than /"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
/*) ;;
|
||||||
|
*)
|
||||||
|
_wazuh_error "directory must be an absolute path"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $_wazuh_path in
|
||||||
|
*'//'*)
|
||||||
|
_wazuh_error "directory must not contain repeated slashes"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
*/./*|*/.|*/../*|*/..)
|
||||||
|
_wazuh_error "directory must not contain . or .. path components"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
*/)
|
||||||
|
_wazuh_error "directory must not end with a slash"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $_wazuh_path in
|
||||||
|
*"
|
||||||
|
"*)
|
||||||
|
_wazuh_error "directory must not contain a newline"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
_wazuh_cr=$(printf '\r')
|
||||||
|
case $_wazuh_path in
|
||||||
|
*"$_wazuh_cr"*)
|
||||||
|
_wazuh_error "directory must not contain a carriage return"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_validate_directory_node() (
|
||||||
|
_wazuh_path=${1-}
|
||||||
|
_wazuh_exact_mode=${2-}
|
||||||
|
|
||||||
|
if [ -L "$_wazuh_path" ]; then
|
||||||
|
_wazuh_error "refusing symbolic-link directory: $_wazuh_path"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ ! -d "$_wazuh_path" ]; then
|
||||||
|
_wazuh_error "not a directory: $_wazuh_path"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_wazuh_owner=$(stat -c '%u:%g' -- "$_wazuh_path" 2>/dev/null) || {
|
||||||
|
_wazuh_error "cannot inspect directory: $_wazuh_path"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
if [ "$_wazuh_owner" != '0:0' ]; then
|
||||||
|
_wazuh_error "directory must be owned by root:root: $_wazuh_path"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_wazuh_mode=$(stat -c '%a' -- "$_wazuh_path" 2>/dev/null) || return 1
|
||||||
|
if [ -n "$_wazuh_exact_mode" ]; then
|
||||||
|
if [ "$_wazuh_mode" != "$_wazuh_exact_mode" ]; then
|
||||||
|
_wazuh_error "directory $_wazuh_path must have mode $_wazuh_exact_mode (found $_wazuh_mode)"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
_wazuh_world=${_wazuh_mode#${_wazuh_mode%?}}
|
||||||
|
_wazuh_prefix=${_wazuh_mode%?}
|
||||||
|
_wazuh_group=${_wazuh_prefix#${_wazuh_prefix%?}}
|
||||||
|
case $_wazuh_group$_wazuh_world in
|
||||||
|
*[2367]*)
|
||||||
|
_wazuh_error "directory must not be group- or world-writable: $_wazuh_path"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_validate_ancestors() (
|
||||||
|
_wazuh_parent=${1%/*}
|
||||||
|
[ -n "$_wazuh_parent" ] || _wazuh_parent=/
|
||||||
|
_wazuh_check_existing_tree "$_wazuh_parent" || return 1
|
||||||
|
_wazuh_validate_directory_node "$_wazuh_parent" ''
|
||||||
|
)
|
||||||
|
_wazuh_validate_regular_file() (
|
||||||
|
_wazuh_path=${1-}
|
||||||
|
_wazuh_required_mode=${2-}
|
||||||
|
|
||||||
|
if [ -L "$_wazuh_path" ]; then
|
||||||
|
_wazuh_error "refusing symbolic-link file: $_wazuh_path"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ ! -f "$_wazuh_path" ]; then
|
||||||
|
_wazuh_error "not a regular file: $_wazuh_path"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_wazuh_owner=$(stat -c '%u:%g' -- "$_wazuh_path" 2>/dev/null) || {
|
||||||
|
_wazuh_error "cannot inspect file: $_wazuh_path"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
if [ "$_wazuh_owner" != '0:0' ]; then
|
||||||
|
_wazuh_error "file must be owned by root:root: $_wazuh_path"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_wazuh_mode=$(stat -c '%a' -- "$_wazuh_path" 2>/dev/null) || return 1
|
||||||
|
if [ "$_wazuh_mode" != "$_wazuh_required_mode" ]; then
|
||||||
|
_wazuh_error "file $_wazuh_path must have mode $_wazuh_required_mode (found $_wazuh_mode)"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_restorecon() (
|
||||||
|
_wazuh_path=${1-}
|
||||||
|
if command -v restorecon >/dev/null 2>&1; then
|
||||||
|
restorecon "$_wazuh_path" >/dev/null 2>&1 || {
|
||||||
|
_wazuh_error "failed to restore the SELinux context of $_wazuh_path"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_validate_base_dir_if_present() (
|
||||||
|
_wazuh_base=$(wazuh_base_get_dir) || return 1
|
||||||
|
_wazuh_check_existing_tree "$_wazuh_base" || return 1
|
||||||
|
if [ -e "$_wazuh_base" ] || [ -L "$_wazuh_base" ]; then
|
||||||
|
_wazuh_validate_directory_node "$_wazuh_base" 700 || return 1
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_ensure_base_dir() (
|
||||||
|
_wazuh_base=$(wazuh_base_get_dir) || return 1
|
||||||
|
_wazuh_make_secure_tree "$_wazuh_base" || return 1
|
||||||
|
_wazuh_validate_directory_node "$_wazuh_base" 700 || return 1
|
||||||
|
_wazuh_restorecon "$_wazuh_base"
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_validate_credentials_file() (
|
||||||
|
_wazuh_validate_base_dir_if_present || return 1
|
||||||
|
_wazuh_file=$(wazuh_env_get_file) || return 1
|
||||||
|
_wazuh_validate_regular_file "$_wazuh_file" 600
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_with_lock() (
|
||||||
|
_wazuh_ensure_base_dir || return 1
|
||||||
|
_wazuh_base=$(wazuh_base_get_dir) || return 1
|
||||||
|
_wazuh_lock=$_wazuh_base/.credentials.lock
|
||||||
|
|
||||||
|
if [ -L "$_wazuh_lock" ]; then
|
||||||
|
_wazuh_error "refusing symbolic-link lock file: $_wazuh_lock"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ ! -e "$_wazuh_lock" ]; then
|
||||||
|
(umask 077; set -C; : >"$_wazuh_lock") 2>/dev/null || {
|
||||||
|
[ -e "$_wazuh_lock" ] || return 1
|
||||||
|
}
|
||||||
|
_wazuh_restorecon "$_wazuh_lock" || return 1
|
||||||
|
fi
|
||||||
|
_wazuh_validate_regular_file "$_wazuh_lock" 600 || return 1
|
||||||
|
|
||||||
|
exec 9<>"$_wazuh_lock" || {
|
||||||
|
_wazuh_error "cannot open lock file: $_wazuh_lock"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
flock -x 9 || {
|
||||||
|
_wazuh_error "cannot acquire lock: $_wazuh_lock"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
"$@"
|
||||||
|
)
|
||||||
|
|
||||||
|
wazuh_env_get() (
|
||||||
|
[ "$#" -eq 1 ] || { _wazuh_error 'usage: wazuh_env_get NAME'; return 2; }
|
||||||
|
_wazuh_name=${1-}
|
||||||
|
_wazuh_validate_name "$_wazuh_name" || return 2
|
||||||
|
_wazuh_file=$(wazuh_env_get_file) || return 2
|
||||||
|
if [ ! -e "$_wazuh_file" ] && [ ! -L "$_wazuh_file" ]; then
|
||||||
|
_wazuh_validate_base_dir_if_present || return 2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_wazuh_validate_credentials_file || return 2
|
||||||
|
|
||||||
|
awk -v wanted="$_wazuh_name" '
|
||||||
|
function trim_left(s) { sub(/^[[:space:]]+/, "", s); return s }
|
||||||
|
function trim_right(s) { sub(/[[:space:]]+$/, "", s); return s }
|
||||||
|
function decode_double(s, out, i, c, n) {
|
||||||
|
out = ""
|
||||||
|
for (i = 1; i <= length(s); i++) {
|
||||||
|
c = substr(s, i, 1)
|
||||||
|
if (c == "\\" && i < length(s)) {
|
||||||
|
n = substr(s, i + 1, 1)
|
||||||
|
if (n == "\\" || n == "\"" || n == "$" || n == "`") {
|
||||||
|
out = out n
|
||||||
|
i++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out = out c
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
{
|
||||||
|
line = trim_left($0)
|
||||||
|
if (line == "" || substr(line, 1, 1) == "#")
|
||||||
|
next
|
||||||
|
|
||||||
|
equal = index(line, "=")
|
||||||
|
if (!equal)
|
||||||
|
next
|
||||||
|
|
||||||
|
name = trim_right(substr(line, 1, equal - 1))
|
||||||
|
if (name != wanted)
|
||||||
|
next
|
||||||
|
|
||||||
|
value = trim_left(substr(line, equal + 1))
|
||||||
|
value = trim_right(value)
|
||||||
|
if ((substr(value, 1, 1) == "\047" && substr(value, length(value), 1) != "\047") ||
|
||||||
|
(substr(value, 1, 1) == "\"" && substr(value, length(value), 1) != "\"")) {
|
||||||
|
bad = 1
|
||||||
|
next
|
||||||
|
}
|
||||||
|
if (length(value) >= 2 && substr(value, 1, 1) == "\047" &&
|
||||||
|
substr(value, length(value), 1) == "\047") {
|
||||||
|
value = substr(value, 2, length(value) - 2)
|
||||||
|
} else if (length(value) >= 2 && substr(value, 1, 1) == "\"" &&
|
||||||
|
substr(value, length(value), 1) == "\"") {
|
||||||
|
value = decode_double(substr(value, 2, length(value) - 2))
|
||||||
|
}
|
||||||
|
result = value
|
||||||
|
found = 1
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
if (!found)
|
||||||
|
exit (bad ? 2 : 1)
|
||||||
|
if (bad) exit 2
|
||||||
|
print result
|
||||||
|
}
|
||||||
|
' "$_wazuh_file"
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_env_mutate_locked() (
|
||||||
|
_wazuh_action=${1-}
|
||||||
|
_wazuh_name=${2-}
|
||||||
|
_wazuh_value_file=${3-}
|
||||||
|
_wazuh_file=$(wazuh_env_get_file) || return 1
|
||||||
|
_wazuh_base=$(wazuh_base_get_dir) || return 1
|
||||||
|
|
||||||
|
if [ -e "$_wazuh_file" ] || [ -L "$_wazuh_file" ]; then
|
||||||
|
_wazuh_validate_credentials_file || return 1
|
||||||
|
if [ -s "$_wazuh_file" ] && [ "$(tail -c 1 -- "$_wazuh_file" | od -An -tu1 | tr -d '[:space:]')" != 10 ]; then
|
||||||
|
_wazuh_error 'credentials.env must end with a newline; refusing to alter operator bytes'
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_wazuh_source=$_wazuh_file
|
||||||
|
else
|
||||||
|
if [ "$_wazuh_action" = unset ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
_wazuh_source=/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
_wazuh_tmp=$(mktemp "$_wazuh_base/.credentials.env.XXXXXX") || {
|
||||||
|
_wazuh_error 'cannot create a temporary credentials file'
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
trap 'rm -f -- "$_wazuh_tmp"' 0
|
||||||
|
trap 'return 130' 1 2 3 15
|
||||||
|
|
||||||
|
if ! awk -v action="$_wazuh_action" -v wanted="$_wazuh_name" \
|
||||||
|
-v value_file="$_wazuh_value_file" '
|
||||||
|
function lhs_name(line, equal, lhs) {
|
||||||
|
sub(/^[[:space:]]+/, "", line)
|
||||||
|
if (substr(line, 1, 1) == "#")
|
||||||
|
return ""
|
||||||
|
equal = index(line, "=")
|
||||||
|
if (!equal)
|
||||||
|
return ""
|
||||||
|
lhs = substr(line, 1, equal - 1)
|
||||||
|
sub(/[[:space:]]+$/, "", lhs)
|
||||||
|
return lhs
|
||||||
|
}
|
||||||
|
function quote_value(s, out, i, c) {
|
||||||
|
# The password alphabet needs no quoting; anything else is still escaped.
|
||||||
|
if (s ~ /^[A-Za-z0-9.,_+:@%^=~-]*$/)
|
||||||
|
return s
|
||||||
|
out = "\""
|
||||||
|
for (i = 1; i <= length(s); i++) {
|
||||||
|
c = substr(s, i, 1)
|
||||||
|
if (c == "\\" || c == "\"" || c == "$" || c == "`")
|
||||||
|
out = out "\\"
|
||||||
|
out = out c
|
||||||
|
}
|
||||||
|
return out "\""
|
||||||
|
}
|
||||||
|
function print_header( i) {
|
||||||
|
for (i = 1; i <= header_lines; i++)
|
||||||
|
print header[i]
|
||||||
|
}
|
||||||
|
BEGIN {
|
||||||
|
begin_marker = "# >>> wazuh generated — do not edit <<<"
|
||||||
|
end_marker = "# >>> end wazuh generated <<<"
|
||||||
|
# The header follows the begin marker. Every header line, and the ones of earlier
|
||||||
|
# versions, is dropped from the block and printed again, so it is never duplicated.
|
||||||
|
header_lines = split("" \
|
||||||
|
"# Written by the Wazuh packages and tools. Editing a value here changes nothing.\n" \
|
||||||
|
"# To change a password: wazuh-passwords-tool.sh -u <user>\n" \
|
||||||
|
"# A host only holds the keys of the components installed on it.\n" \
|
||||||
|
"#\n" \
|
||||||
|
"# User Key Used for\n" \
|
||||||
|
"# Logins:\n" \
|
||||||
|
"# admin WAZUH_INDEXER_ADMIN_PASSWORD Wazuh dashboard (web UI) and Wazuh indexer API\n" \
|
||||||
|
"# wazuh WAZUH_MANAGER_API_PASSWORD Wazuh server API (curl, scripts)\n" \
|
||||||
|
"# Service accounts the components connect with, not logins:\n" \
|
||||||
|
"# kibanaserver WAZUH_INDEXER_KIBANASERVER_PASSWORD dashboard to indexer\n" \
|
||||||
|
"# wazuh-manager WAZUH_INDEXER_MANAGER_PASSWORD manager to indexer\n" \
|
||||||
|
"# wazuh-internal-client WAZUH_MANAGER_WUI_PASSWORD dashboard to server API\n" \
|
||||||
|
"#", header, "\n")
|
||||||
|
for (i = 1; i <= header_lines; i++)
|
||||||
|
known_header[header[i]] = 1
|
||||||
|
# Header lines of earlier versions.
|
||||||
|
old_header_lines = split("" \
|
||||||
|
"# Editing a value here does not change the deployment.\n" \
|
||||||
|
"# To rotate, use wazuh-passwords-tool.sh.\n" \
|
||||||
|
"# admin: login of the Wazuh dashboard and administrator of the indexer\n" \
|
||||||
|
"# User Key Used for\n" \
|
||||||
|
"# admin WAZUH_INDEXER_ADMIN_PASSWORD Wazuh dashboard (web UI) and Wazuh indexer API\n" \
|
||||||
|
"# wazuh WAZUH_MANAGER_API_PASSWORD Wazuh server API (curl, scripts)\n" \
|
||||||
|
"# kibanaserver WAZUH_INDEXER_KIBANASERVER_PASSWORD dashboard to indexer\n" \
|
||||||
|
"# wazuh-manager WAZUH_INDEXER_MANAGER_PASSWORD manager to indexer\n" \
|
||||||
|
"# wazuh-wui WAZUH_MANAGER_WUI_PASSWORD dashboard to server API", old_header, "\n")
|
||||||
|
for (i = 1; i <= old_header_lines; i++)
|
||||||
|
known_header[old_header[i]] = 1
|
||||||
|
value = ""
|
||||||
|
if (action == "set") {
|
||||||
|
read_status = (getline value < value_file)
|
||||||
|
close(value_file)
|
||||||
|
if (read_status < 0) {
|
||||||
|
print "wazuh-credentials: cannot read temporary value" > "/dev/stderr"
|
||||||
|
exit 42
|
||||||
|
}
|
||||||
|
assignment = wanted "=" quote_value(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$0 == begin_marker {
|
||||||
|
if (inside || begin_count > 0) {
|
||||||
|
bad = 1
|
||||||
|
next
|
||||||
|
}
|
||||||
|
begin_count++
|
||||||
|
inside = 1
|
||||||
|
print
|
||||||
|
print_header()
|
||||||
|
next
|
||||||
|
}
|
||||||
|
$0 == end_marker {
|
||||||
|
if (!inside || end_count > 0) {
|
||||||
|
bad = 1
|
||||||
|
next
|
||||||
|
}
|
||||||
|
if (action == "set" && !written) {
|
||||||
|
print assignment
|
||||||
|
written = 1
|
||||||
|
}
|
||||||
|
end_count++
|
||||||
|
inside = 0
|
||||||
|
print
|
||||||
|
next
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if (inside && ($0 in known_header))
|
||||||
|
next
|
||||||
|
if (inside && lhs_name($0) == wanted) {
|
||||||
|
if (action == "set" && !written) {
|
||||||
|
print assignment
|
||||||
|
written = 1
|
||||||
|
}
|
||||||
|
next
|
||||||
|
}
|
||||||
|
print
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
if (inside || begin_count != end_count || begin_count > 1 || bad) {
|
||||||
|
print "wazuh-credentials: malformed Wazuh-managed block" > "/dev/stderr"
|
||||||
|
exit 42
|
||||||
|
}
|
||||||
|
if (begin_count == 0 && action == "set") {
|
||||||
|
if (NR > 0)
|
||||||
|
print ""
|
||||||
|
print begin_marker
|
||||||
|
print_header()
|
||||||
|
print assignment
|
||||||
|
print end_marker
|
||||||
|
}
|
||||||
|
}
|
||||||
|
' "$_wazuh_source" >"$_wazuh_tmp"; then
|
||||||
|
_wazuh_error 'credentials file was not modified'
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
chown root:root "$_wazuh_tmp" || return 1
|
||||||
|
chmod 0600 "$_wazuh_tmp" || return 1
|
||||||
|
mv -f -- "$_wazuh_tmp" "$_wazuh_file" || {
|
||||||
|
_wazuh_error 'cannot replace credentials.env atomically'
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
trap - 0 1 2 3 15
|
||||||
|
_wazuh_restorecon "$_wazuh_file" || return 1
|
||||||
|
_wazuh_validate_credentials_file
|
||||||
|
)
|
||||||
|
|
||||||
|
wazuh_env_set() (
|
||||||
|
if [ "$#" -ne 2 ]; then
|
||||||
|
_wazuh_error 'usage: wazuh_env_set NAME VALUE'
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_wazuh_name=$1
|
||||||
|
_wazuh_value=$2
|
||||||
|
_wazuh_validate_name "$_wazuh_name" || return 1
|
||||||
|
|
||||||
|
case $_wazuh_value in
|
||||||
|
*"
|
||||||
|
"*)
|
||||||
|
_wazuh_error "value for $_wazuh_name must not contain a newline"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
_wazuh_cr=$(printf '\r')
|
||||||
|
case $_wazuh_value in
|
||||||
|
*"$_wazuh_cr"*)
|
||||||
|
_wazuh_error "value for $_wazuh_name must not contain a carriage return"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
_wazuh_ensure_base_dir || return 1
|
||||||
|
_wazuh_base=$(wazuh_base_get_dir) || return 1
|
||||||
|
_wazuh_value_file=$(mktemp "$_wazuh_base/.credential-value.XXXXXX") || {
|
||||||
|
_wazuh_error 'cannot create a temporary value file'
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
trap 'rm -f -- "$_wazuh_value_file"' 0
|
||||||
|
trap 'return 130' 1 2 3 15
|
||||||
|
chmod 0600 "$_wazuh_value_file" || return 1
|
||||||
|
printf '%s' "$_wazuh_value" >"$_wazuh_value_file" || return 1
|
||||||
|
|
||||||
|
_wazuh_with_lock _wazuh_env_mutate_locked set "$_wazuh_name" "$_wazuh_value_file"
|
||||||
|
)
|
||||||
|
|
||||||
|
wazuh_env_unset() (
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
_wazuh_error 'usage: wazuh_env_unset NAME'
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_wazuh_validate_name "$1" || return 1
|
||||||
|
_wazuh_with_lock _wazuh_env_mutate_locked unset "$1" ''
|
||||||
|
)
|
||||||
|
|
||||||
|
wazuh_ca_get_dir() (
|
||||||
|
_wazuh_ca_dir=
|
||||||
|
_wazuh_ca_dir_is_set=0
|
||||||
|
|
||||||
|
_wazuh_status=0
|
||||||
|
_wazuh_file_value=$(wazuh_env_get WAZUH_CA_DIR) || _wazuh_status=$?
|
||||||
|
case $_wazuh_status in
|
||||||
|
0)
|
||||||
|
_wazuh_ca_dir=$_wazuh_file_value
|
||||||
|
_wazuh_ca_dir_is_set=1
|
||||||
|
;;
|
||||||
|
1) ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ "${WAZUH_CA_DIR+x}" = x ]; then
|
||||||
|
_wazuh_ca_dir=${WAZUH_CA_DIR-}
|
||||||
|
_wazuh_ca_dir_is_set=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$_wazuh_ca_dir_is_set" -eq 0 ]; then
|
||||||
|
_wazuh_base=$(wazuh_base_get_dir) || return 1
|
||||||
|
_wazuh_ca_dir=$_wazuh_base/ca
|
||||||
|
fi
|
||||||
|
|
||||||
|
_wazuh_validate_absolute_path "$_wazuh_ca_dir" || return 1
|
||||||
|
printf '%s\n' "$_wazuh_ca_dir"
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_validate_ca_files() (
|
||||||
|
_wazuh_ca_dir=${1-}
|
||||||
|
_wazuh_cert=$_wazuh_ca_dir/root-ca.pem
|
||||||
|
_wazuh_key=$_wazuh_ca_dir/root-ca.key
|
||||||
|
|
||||||
|
_wazuh_validate_ancestors "$_wazuh_ca_dir" || return 1
|
||||||
|
_wazuh_validate_directory_node "$_wazuh_ca_dir" 700 || return 1
|
||||||
|
|
||||||
|
_wazuh_cert_exists=0
|
||||||
|
_wazuh_key_exists=0
|
||||||
|
if [ -e "$_wazuh_cert" ] || [ -L "$_wazuh_cert" ]; then
|
||||||
|
_wazuh_cert_exists=1
|
||||||
|
fi
|
||||||
|
if [ -e "$_wazuh_key" ] || [ -L "$_wazuh_key" ]; then
|
||||||
|
_wazuh_key_exists=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$_wazuh_cert_exists" -eq 0 ] && [ "$_wazuh_key_exists" -eq 0 ]; then
|
||||||
|
_wazuh_error "CA material is absent from $_wazuh_ca_dir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ "$_wazuh_cert_exists" -eq 0 ]; then
|
||||||
|
_wazuh_error "root-ca.key exists without root-ca.pem in $_wazuh_ca_dir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_wazuh_validate_regular_file "$_wazuh_cert" 644 || return 1
|
||||||
|
if ! openssl x509 -in "$_wazuh_cert" -noout >/dev/null 2>&1; then
|
||||||
|
_wazuh_error "invalid X.509 certificate: $_wazuh_cert"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if ! openssl x509 -in "$_wazuh_cert" -checkend 0 -noout >/dev/null 2>&1; then
|
||||||
|
_wazuh_error "expired X.509 certificate: $_wazuh_cert"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_wazuh_text=$(LC_ALL=C openssl x509 -in "$_wazuh_cert" -noout -text 2>/dev/null) || return 1
|
||||||
|
case $_wazuh_text in
|
||||||
|
*'CA:TRUE'*) ;;
|
||||||
|
*) _wazuh_error "certificate is not a CA: $_wazuh_cert"; return 1 ;;
|
||||||
|
esac
|
||||||
|
openssl verify -CAfile "$_wazuh_cert" "$_wazuh_cert" >/dev/null 2>&1 || {
|
||||||
|
_wazuh_error "CA certificate is not currently valid: $_wazuh_cert"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Anchor-only is the expected state for an externally managed CA.
|
||||||
|
if [ "$_wazuh_key_exists" -eq 0 ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
_wazuh_validate_regular_file "$_wazuh_key" 400 || return 1
|
||||||
|
if ! openssl pkey -in "$_wazuh_key" -passin pass: -check -noout </dev/null >/dev/null 2>&1; then
|
||||||
|
_wazuh_error "invalid private key: $_wazuh_key"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_wazuh_cert_pub=$(mktemp "$_wazuh_ca_dir/.cert-pub.XXXXXX") || return 1
|
||||||
|
_wazuh_key_pub=$(mktemp "$_wazuh_ca_dir/.key-pub.XXXXXX") || {
|
||||||
|
rm -f -- "$_wazuh_cert_pub"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
trap 'rm -f -- "$_wazuh_cert_pub" "$_wazuh_key_pub"' 0
|
||||||
|
trap 'return 130' 1 2 3 15
|
||||||
|
chmod 0600 "$_wazuh_cert_pub" "$_wazuh_key_pub" || return 1
|
||||||
|
|
||||||
|
openssl x509 -in "$_wazuh_cert" -pubkey -noout >"$_wazuh_cert_pub" 2>/dev/null || return 1
|
||||||
|
openssl pkey -in "$_wazuh_key" -passin pass: -pubout </dev/null >"$_wazuh_key_pub" 2>/dev/null || return 1
|
||||||
|
if ! cmp -s -- "$_wazuh_cert_pub" "$_wazuh_key_pub"; then
|
||||||
|
_wazuh_error 'root-ca.key does not match root-ca.pem'
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f -- "$_wazuh_cert_pub" "$_wazuh_key_pub"
|
||||||
|
trap - 0 1 2 3 15
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_ensure_ca_directory() (
|
||||||
|
_wazuh_ca_dir=${1-}
|
||||||
|
_wazuh_validate_absolute_path "$_wazuh_ca_dir" || return 1
|
||||||
|
|
||||||
|
if [ -L "$_wazuh_ca_dir" ]; then
|
||||||
|
_wazuh_error "refusing symbolic-link CA directory: $_wazuh_ca_dir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ ! -e "$_wazuh_ca_dir" ]; then
|
||||||
|
_wazuh_make_secure_tree "$_wazuh_ca_dir" || {
|
||||||
|
_wazuh_error "cannot create CA directory: $_wazuh_ca_dir"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
_wazuh_restorecon "$_wazuh_ca_dir" || return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_wazuh_validate_ancestors "$_wazuh_ca_dir" || return 1
|
||||||
|
_wazuh_validate_directory_node "$_wazuh_ca_dir" 700
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_ca_validate_locked() (
|
||||||
|
_wazuh_ca_dir=$(wazuh_ca_get_dir) || return 1
|
||||||
|
_wazuh_validate_ca_files "$_wazuh_ca_dir"
|
||||||
|
)
|
||||||
|
|
||||||
|
wazuh_ca_validate() (
|
||||||
|
_wazuh_with_lock _wazuh_ca_validate_locked
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_ca_ensure_locked() (
|
||||||
|
_wazuh_ca_dir=$(wazuh_ca_get_dir) || return 1
|
||||||
|
_wazuh_ensure_ca_directory "$_wazuh_ca_dir" || return 1
|
||||||
|
|
||||||
|
_wazuh_cert=$_wazuh_ca_dir/root-ca.pem
|
||||||
|
_wazuh_key=$_wazuh_ca_dir/root-ca.key
|
||||||
|
|
||||||
|
_wazuh_cert_exists=0
|
||||||
|
_wazuh_key_exists=0
|
||||||
|
if [ -e "$_wazuh_cert" ] || [ -L "$_wazuh_cert" ]; then
|
||||||
|
_wazuh_cert_exists=1
|
||||||
|
fi
|
||||||
|
if [ -e "$_wazuh_key" ] || [ -L "$_wazuh_key" ]; then
|
||||||
|
_wazuh_key_exists=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$_wazuh_cert_exists" -eq 1 ] || [ "$_wazuh_key_exists" -eq 1 ]; then
|
||||||
|
_wazuh_validate_ca_files "$_wazuh_ca_dir"
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
command -v openssl >/dev/null 2>&1 || {
|
||||||
|
_wazuh_error 'openssl is required to generate the root CA'
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_wazuh_tmp_dir=$(mktemp -d "$_wazuh_ca_dir/.root-ca.XXXXXX") || {
|
||||||
|
_wazuh_error "cannot create a temporary directory in $_wazuh_ca_dir"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
trap 'rm -rf -- "$_wazuh_tmp_dir"' 0
|
||||||
|
trap 'return 130' 1 2 3 15
|
||||||
|
chmod 0700 "$_wazuh_tmp_dir" || return 1
|
||||||
|
_wazuh_config=$_wazuh_tmp_dir/openssl.cnf
|
||||||
|
|
||||||
|
(umask 077; printf '%s\n' \
|
||||||
|
'[req]' \
|
||||||
|
'distinguished_name = dn' \
|
||||||
|
'x509_extensions = v3_ca' \
|
||||||
|
'prompt = no' \
|
||||||
|
'[dn]' \
|
||||||
|
'OU = Wazuh' \
|
||||||
|
'O = Wazuh' \
|
||||||
|
'L = California' \
|
||||||
|
'[v3_ca]' \
|
||||||
|
'basicConstraints = critical, CA:TRUE' \
|
||||||
|
'keyUsage = critical, keyCertSign, cRLSign' \
|
||||||
|
'subjectKeyIdentifier = hash' \
|
||||||
|
'authorityKeyIdentifier = keyid:always' \
|
||||||
|
>"$_wazuh_config") || return 1
|
||||||
|
|
||||||
|
if ! (umask 077; openssl req -x509 -new -nodes -newkey rsa:2048 \
|
||||||
|
-sha256 -days 3650 -batch -config "$_wazuh_config" \
|
||||||
|
-keyout "$_wazuh_tmp_dir/root-ca.key" \
|
||||||
|
-out "$_wazuh_tmp_dir/root-ca.pem" >/dev/null 2>&1); then
|
||||||
|
_wazuh_error 'OpenSSL failed to generate the root CA'
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
chown root:root "$_wazuh_tmp_dir/root-ca.key" "$_wazuh_tmp_dir/root-ca.pem" || return 1
|
||||||
|
chmod 0400 "$_wazuh_tmp_dir/root-ca.key" || return 1
|
||||||
|
chmod 0644 "$_wazuh_tmp_dir/root-ca.pem" || return 1
|
||||||
|
|
||||||
|
# Publishing the key first (hard links refuse existing targets) makes an interrupted installation fail closed as an
|
||||||
|
# explicit key-without-certificate state instead of silently looking like
|
||||||
|
# an externally managed anchor.
|
||||||
|
ln -T -- "$_wazuh_tmp_dir/root-ca.key" "$_wazuh_key" || return 1
|
||||||
|
ln -T -- "$_wazuh_tmp_dir/root-ca.pem" "$_wazuh_cert" || return 1
|
||||||
|
_wazuh_restorecon "$_wazuh_key" || return 1
|
||||||
|
_wazuh_restorecon "$_wazuh_cert" || return 1
|
||||||
|
|
||||||
|
rm -rf -- "$_wazuh_tmp_dir"
|
||||||
|
trap - 0 1 2 3 15
|
||||||
|
_wazuh_validate_ca_files "$_wazuh_ca_dir" || return 1
|
||||||
|
_wazuh_info "created a new CA in $_wazuh_ca_dir. Hosts of the same deployment must share one CA: use the installation assistant, or place this CA in $_wazuh_ca_dir on the other hosts before installing their packages."
|
||||||
|
)
|
||||||
|
|
||||||
|
wazuh_ca_ensure() (
|
||||||
|
_wazuh_with_lock _wazuh_ca_ensure_locked
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_random_below() (
|
||||||
|
_wazuh_limit=${1-}
|
||||||
|
case $_wazuh_limit in
|
||||||
|
''|*[!0-9]*|0) return 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
_wazuh_ceiling=$((65536 - (65536 % _wazuh_limit)))
|
||||||
|
while :; do
|
||||||
|
_wazuh_number=$(od -An -N2 -tu2 /dev/urandom 2>/dev/null) || return 1
|
||||||
|
_wazuh_number=$(printf '%s' "$_wazuh_number" | tr -d '[:space:]')
|
||||||
|
case $_wazuh_number in
|
||||||
|
''|*[!0-9]*) return 1 ;;
|
||||||
|
esac
|
||||||
|
if [ "$_wazuh_number" -lt "$_wazuh_ceiling" ]; then
|
||||||
|
printf '%s\n' $((_wazuh_number % _wazuh_limit))
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_random_char() (
|
||||||
|
_wazuh_alphabet=${1-}
|
||||||
|
_wazuh_length=${#_wazuh_alphabet}
|
||||||
|
[ "$_wazuh_length" -gt 0 ] || return 1
|
||||||
|
_wazuh_index=$(_wazuh_random_below "$_wazuh_length") || return 1
|
||||||
|
_wazuh_position=$((_wazuh_index + 1))
|
||||||
|
printf '%s' "$_wazuh_alphabet" | cut -c "$_wazuh_position"
|
||||||
|
)
|
||||||
|
|
||||||
|
_wazuh_replace_char() (
|
||||||
|
_wazuh_text=${1-}
|
||||||
|
_wazuh_position=${2-}
|
||||||
|
_wazuh_character=${3-}
|
||||||
|
|
||||||
|
if [ "$_wazuh_position" -le 1 ]; then
|
||||||
|
_wazuh_prefix=
|
||||||
|
else
|
||||||
|
_wazuh_prefix=$(printf '%s' "$_wazuh_text" | cut -c "1-$((_wazuh_position - 1))")
|
||||||
|
fi
|
||||||
|
_wazuh_suffix=$(printf '%s' "$_wazuh_text" | cut -c "$((_wazuh_position + 1))-" )
|
||||||
|
printf '%s%s%s' "$_wazuh_prefix" "$_wazuh_character" "$_wazuh_suffix"
|
||||||
|
)
|
||||||
|
|
||||||
|
wazuh_password_generate() (
|
||||||
|
# The password character set; wazuh_password_validate accepts exactly this.
|
||||||
|
_wazuh_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,_+:@%^=~-'
|
||||||
|
|
||||||
|
# Finite entropy reads avoid SIGPIPE under a caller's pipefail. Rejection
|
||||||
|
# sampling (bytes < 219 for a 73-character alphabet) avoids modulo bias.
|
||||||
|
_wazuh_password=
|
||||||
|
while [ "${#_wazuh_password}" -lt 32 ]; do
|
||||||
|
_wazuh_bytes=$(od -An -v -N128 -tu1 /dev/urandom) || return 1
|
||||||
|
[ -n "$_wazuh_bytes" ] || return 1
|
||||||
|
_wazuh_chunk=$(printf '%s\n' "$_wazuh_bytes" | awk -v a="$_wazuh_alphabet" '
|
||||||
|
{ for (i=1; i<=NF; i++) if ($i < 219) printf "%s", substr(a, ($i % 73)+1, 1) }
|
||||||
|
') || return 1
|
||||||
|
_wazuh_password=$_wazuh_password$_wazuh_chunk
|
||||||
|
done
|
||||||
|
_wazuh_password=$(printf '%s' "$_wazuh_password" | cut -c 1-32) || return 1
|
||||||
|
|
||||||
|
_wazuh_index=$(_wazuh_random_below 32) || return 1
|
||||||
|
_wazuh_pos_lower=$((_wazuh_index + 1))
|
||||||
|
while :; do
|
||||||
|
_wazuh_index=$(_wazuh_random_below 32) || return 1
|
||||||
|
_wazuh_pos_upper=$((_wazuh_index + 1))
|
||||||
|
[ "$_wazuh_pos_upper" -ne "$_wazuh_pos_lower" ] && break
|
||||||
|
done
|
||||||
|
while :; do
|
||||||
|
_wazuh_index=$(_wazuh_random_below 32) || return 1
|
||||||
|
_wazuh_pos_digit=$((_wazuh_index + 1))
|
||||||
|
if [ "$_wazuh_pos_digit" -ne "$_wazuh_pos_lower" ] &&
|
||||||
|
[ "$_wazuh_pos_digit" -ne "$_wazuh_pos_upper" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
while :; do
|
||||||
|
_wazuh_index=$(_wazuh_random_below 32) || return 1
|
||||||
|
_wazuh_pos_symbol=$((_wazuh_index + 1))
|
||||||
|
if [ "$_wazuh_pos_symbol" -ne "$_wazuh_pos_lower" ] &&
|
||||||
|
[ "$_wazuh_pos_symbol" -ne "$_wazuh_pos_upper" ] &&
|
||||||
|
[ "$_wazuh_pos_symbol" -ne "$_wazuh_pos_digit" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
_wazuh_char=$(_wazuh_random_char 'abcdefghijklmnopqrstuvwxyz') || return 1
|
||||||
|
_wazuh_password=$(_wazuh_replace_char "$_wazuh_password" "$_wazuh_pos_lower" "$_wazuh_char") || return 1
|
||||||
|
_wazuh_char=$(_wazuh_random_char 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') || return 1
|
||||||
|
_wazuh_password=$(_wazuh_replace_char "$_wazuh_password" "$_wazuh_pos_upper" "$_wazuh_char") || return 1
|
||||||
|
_wazuh_char=$(_wazuh_random_char '0123456789') || return 1
|
||||||
|
_wazuh_password=$(_wazuh_replace_char "$_wazuh_password" "$_wazuh_pos_digit" "$_wazuh_char") || return 1
|
||||||
|
_wazuh_char=$(_wazuh_random_char '.,_+:@%^=~-') || return 1
|
||||||
|
_wazuh_password=$(_wazuh_replace_char "$_wazuh_password" "$_wazuh_pos_symbol" "$_wazuh_char") || return 1
|
||||||
|
|
||||||
|
wazuh_password_validate "$_wazuh_password" >/dev/null || return 1
|
||||||
|
printf '%s\n' "$_wazuh_password"
|
||||||
|
)
|
||||||
|
|
||||||
|
wazuh_password_validate() (
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
_wazuh_error 'usage: wazuh_password_validate VALUE'
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_wazuh_password=$1
|
||||||
|
|
||||||
|
# Only the generator's character set, spelled out rather than as ranges so
|
||||||
|
# the match does not depend on the locale. It is checked first because it
|
||||||
|
# makes every accepted value ASCII: the length below then means the same
|
||||||
|
# under dash (bytes) as under bash and the consumers (characters). It also
|
||||||
|
# excludes whitespace, control characters (newline and carriage return
|
||||||
|
# included), quotes and the characters that need escaping in the file, in
|
||||||
|
# a shell or in an HTTP Basic credential.
|
||||||
|
case $_wazuh_password in
|
||||||
|
*[!ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,_+:@%^=~-]*)
|
||||||
|
_wazuh_error 'password must only contain characters from A-Z a-z 0-9 . , _ + : @ % ^ = ~ -'
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
_wazuh_length=${#_wazuh_password}
|
||||||
|
if [ "$_wazuh_length" -lt 12 ] || [ "$_wazuh_length" -gt 64 ]; then
|
||||||
|
_wazuh_error 'password must contain between 12 and 64 characters'
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
case $_wazuh_password in
|
||||||
|
*[abcdefghijklmnopqrstuvwxyz]*) ;;
|
||||||
|
*)
|
||||||
|
_wazuh_error 'password must contain at least one lowercase letter'
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
case $_wazuh_password in
|
||||||
|
*[ABCDEFGHIJKLMNOPQRSTUVWXYZ]*) ;;
|
||||||
|
*)
|
||||||
|
_wazuh_error 'password must contain at least one uppercase letter'
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
case $_wazuh_password in
|
||||||
|
*[0123456789]*) ;;
|
||||||
|
*)
|
||||||
|
_wazuh_error 'password must contain at least one digit'
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
case $_wazuh_password in
|
||||||
|
*[.,_+:@%^=~-]*) ;;
|
||||||
|
*)
|
||||||
|
_wazuh_error 'password must contain at least one symbol from . , _ + : @ % ^ = ~ -'
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
)
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: DaemonSet
|
||||||
|
metadata:
|
||||||
|
name: wazuh-falco-agent
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-falco-agent
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: wazuh-falco-agent
|
||||||
|
spec:
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
securityContext:
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
|
volumes:
|
||||||
|
- name: agent-etc
|
||||||
|
hostPath:
|
||||||
|
path: /var/lib/wazuh-falco-agent/etc
|
||||||
|
type: DirectoryOrCreate
|
||||||
|
- name: falco-events
|
||||||
|
hostPath:
|
||||||
|
path: /var/log/falco
|
||||||
|
type: Directory
|
||||||
|
initContainers:
|
||||||
|
- name: initialize-agent-etc
|
||||||
|
image: wazuh/wazuh-agent:5.0.0-rc1
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -eu
|
||||||
|
if [ ! -f /agent-etc/ossec.conf ]; then
|
||||||
|
cp -a /var/ossec/etc/. /agent-etc/
|
||||||
|
fi
|
||||||
|
if ! grep -Fq '<location>/var/log/falco/events.json</location>' /agent-etc/ossec.conf; then
|
||||||
|
cat >> /agent-etc/ossec.conf <<'EOF'
|
||||||
|
|
||||||
|
<ossec_config>
|
||||||
|
<localfile>
|
||||||
|
<location>/var/log/falco/events.json</location>
|
||||||
|
<log_format>json</log_format>
|
||||||
|
</localfile>
|
||||||
|
</ossec_config>
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
chown root:101 /agent-etc
|
||||||
|
chmod 0750 /agent-etc
|
||||||
|
for config in ossec.conf internal_options.conf local_internal_options.conf; do
|
||||||
|
if [ -f "/agent-etc/$config" ]; then
|
||||||
|
chown root:101 "/agent-etc/$config"
|
||||||
|
chmod 0640 "/agent-etc/$config"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# The unprivileged agent writes downloaded shared configuration here.
|
||||||
|
chown 101:101 /agent-etc/shared
|
||||||
|
chmod 0750 /agent-etc/shared
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
capabilities:
|
||||||
|
drop: ["ALL"]
|
||||||
|
add: ["CHOWN", "DAC_OVERRIDE", "FOWNER"]
|
||||||
|
volumeMounts:
|
||||||
|
- name: agent-etc
|
||||||
|
mountPath: /agent-etc
|
||||||
|
containers:
|
||||||
|
- name: wazuh-agent
|
||||||
|
image: wazuh/wazuh-agent:5.0.0-rc1
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 64Mi
|
||||||
|
limits:
|
||||||
|
cpu: 300m
|
||||||
|
memory: 512Mi
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
capabilities:
|
||||||
|
drop: ["ALL"]
|
||||||
|
# The packaged agent drops privileges to its wazuh user.
|
||||||
|
add: ["CHOWN", "DAC_OVERRIDE", "FOWNER", "KILL", "SETGID", "SETUID", "SYS_CHROOT"]
|
||||||
|
startupProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- 'status=$(/var/ossec/bin/wazuh-control status) && ! printf "%s\n" "$status" | grep -q "not running"'
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 10
|
||||||
|
failureThreshold: 24
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- 'status=$(/var/ossec/bin/wazuh-control status) && ! printf "%s\n" "$status" | grep -q "not running"'
|
||||||
|
periodSeconds: 30
|
||||||
|
timeoutSeconds: 10
|
||||||
|
env:
|
||||||
|
- name: WAZUH_AGENT_NAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: spec.nodeName
|
||||||
|
- name: WAZUH_ENROLLMENT_TOKEN
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: falco-agent-enrollment
|
||||||
|
key: token
|
||||||
|
volumeMounts:
|
||||||
|
- name: agent-etc
|
||||||
|
mountPath: /var/ossec/etc
|
||||||
|
- name: falco-events
|
||||||
|
mountPath: /var/log/falco
|
||||||
|
readOnly: true
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "Falco Runtime Detections",
|
||||||
|
"type": "detector",
|
||||||
|
"detector_type": "falco",
|
||||||
|
"enabled": true,
|
||||||
|
"schedule": {
|
||||||
|
"period": {
|
||||||
|
"interval": 1,
|
||||||
|
"unit": "MINUTES"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"detector_input": {
|
||||||
|
"description": "Falco Warning and higher events from Wazuh 5",
|
||||||
|
"indices": ["wazuh-events-v5-security"],
|
||||||
|
"custom_rules": [
|
||||||
|
{"id": "a9088c4a-748e-4622-8c28-f2d1b43aee9c"},
|
||||||
|
{"id": "7dce0e18-b662-45c7-a08f-4248378a92b2"}
|
||||||
|
],
|
||||||
|
"pre_packaged_rules": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"triggers": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "decoder/falco-json/0",
|
||||||
|
"enabled": true,
|
||||||
|
"parents": ["decoder/core-wazuh-message/0"],
|
||||||
|
"metadata": {
|
||||||
|
"title": "Falco JSON event",
|
||||||
|
"author": "Homelab",
|
||||||
|
"description": "Normalize Falco detections and their Kubernetes, container, process and user context."
|
||||||
|
},
|
||||||
|
"check": "exists($_tmp_json.rule) AND exists($_tmp_json.priority) AND exists($_tmp_json.output_fields)",
|
||||||
|
"normalize": [
|
||||||
|
{
|
||||||
|
"map": [
|
||||||
|
{"@timestamp": "get_date()"},
|
||||||
|
{"event.kind": "event"},
|
||||||
|
{"event.dataset": "falco"},
|
||||||
|
{"event.module": "falco"},
|
||||||
|
{"event.action": "$_tmp_json.rule"},
|
||||||
|
{"log.level": "$_tmp_json.priority"},
|
||||||
|
{"message": "$_tmp_json.output"},
|
||||||
|
{"host.name": "$_tmp_json.hostname"},
|
||||||
|
{"orchestrator.namespace": "$_tmp_json.output_fields.k8s\\.ns\\.name"},
|
||||||
|
{"orchestrator.resource.name": "$_tmp_json.output_fields.k8s\\.pod\\.name"},
|
||||||
|
{"container.id": "$_tmp_json.output_fields.container\\.id"},
|
||||||
|
{"container.name": "$_tmp_json.output_fields.container\\.name"},
|
||||||
|
{"container.image.name": "$_tmp_json.output_fields.container\\.image\\.repository"},
|
||||||
|
{"process.name": "$_tmp_json.output_fields.proc\\.name"},
|
||||||
|
{"process.executable": "$_tmp_json.output_fields.proc\\.exepath"},
|
||||||
|
{"process.command_line": "$_tmp_json.output_fields.proc\\.cmdline"},
|
||||||
|
{"user.name": "$_tmp_json.output_fields.user\\.name"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"category": "security",
|
||||||
|
"enabled": true,
|
||||||
|
"metadata": {
|
||||||
|
"title": "falco",
|
||||||
|
"author": "Homelab",
|
||||||
|
"description": "Falco runtime detections collected by the Wazuh agent.",
|
||||||
|
"references": ["https://falco.org/docs/concepts/alerts/"]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "decoder/core-wazuh-message/0",
|
||||||
|
"enabled": true,
|
||||||
|
"metadata": {
|
||||||
|
"title": "Wazuh message decoder for Falco",
|
||||||
|
"author": "Homelab",
|
||||||
|
"description": "Parse the agent's JSON log before Falco normalization."
|
||||||
|
},
|
||||||
|
"normalize": [
|
||||||
|
{
|
||||||
|
"map": [
|
||||||
|
{"_tmp_json": "parse_json($event.original)"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"title": "Falco critical: {{event.action}} on {{host.name}}",
|
||||||
|
"author": "Homelab",
|
||||||
|
"description": "A Falco runtime detection with Critical, Alert, or Emergency priority."
|
||||||
|
},
|
||||||
|
"enabled": true,
|
||||||
|
"status": "experimental",
|
||||||
|
"level": "critical",
|
||||||
|
"logsource": {"product": "falco"},
|
||||||
|
"detection": {
|
||||||
|
"condition": "selection",
|
||||||
|
"selection": {
|
||||||
|
"event.dataset": "falco",
|
||||||
|
"log.level": ["Critical", "Alert", "Emergency"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"title": "Falco: {{event.action}} on {{host.name}}",
|
||||||
|
"author": "Homelab",
|
||||||
|
"description": "A Falco runtime detection with Warning or Error priority."
|
||||||
|
},
|
||||||
|
"enabled": true,
|
||||||
|
"status": "experimental",
|
||||||
|
"level": "medium",
|
||||||
|
"logsource": {"product": "falco"},
|
||||||
|
"detection": {
|
||||||
|
"condition": "selection",
|
||||||
|
"selection": {
|
||||||
|
"event.dataset": "falco",
|
||||||
|
"log.level": ["Warning", "Error"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
namespace: wazuh-agent
|
||||||
|
resources:
|
||||||
|
- namespace.yaml
|
||||||
|
- falco-agent-ds.yaml
|
||||||
|
- network-policy.yaml
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: wazuh-agent
|
||||||
|
labels:
|
||||||
|
# Required for the node-local Falco log and the agent's persistent identity.
|
||||||
|
pod-security.kubernetes.io/enforce: privileged
|
||||||
|
pod-security.kubernetes.io/warn: baseline
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: default-deny-all
|
||||||
|
spec:
|
||||||
|
podSelector: {}
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
- Egress
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: falco-agent-traffic
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-falco-agent
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
- Egress
|
||||||
|
egress:
|
||||||
|
- to:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: wazuh
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-manager
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 1517
|
||||||
|
- to:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: kube-system
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
k8s-app: kube-dns
|
||||||
|
ports:
|
||||||
|
- protocol: UDP
|
||||||
|
port: 53
|
||||||
|
- protocol: TCP
|
||||||
|
port: 53
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: falco-agent-manager-ingress
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-manager
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: wazuh-agent
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-falco-agent
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 1517
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: manager-egress-external
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-manager
|
||||||
|
policyTypes:
|
||||||
|
- Egress
|
||||||
|
egress:
|
||||||
|
- to:
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 0.0.0.0/0
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 443
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: manager-egress
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-manager
|
||||||
|
policyTypes:
|
||||||
|
- Egress
|
||||||
|
egress:
|
||||||
|
- to:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-indexer
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 9200
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: wazuh-api-ingress
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-manager
|
||||||
|
node-type: master
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-dashboard
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 55000
|
||||||
|
- from:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-manager
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 1516
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: wazuh-worker-egress
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-manager
|
||||||
|
node-type: worker
|
||||||
|
policyTypes:
|
||||||
|
- Egress
|
||||||
|
egress:
|
||||||
|
- to:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-manager
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 1516
|
||||||
|
- to:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-manager
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 55000
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# Copyright (C) 2019, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
# Wazuh manager Service: Wazuh 5.x agent communication and enrollment
|
||||||
|
#
|
||||||
|
# Since 5.0.0 remoted serves a single HTTPS channel that carries both the agent
|
||||||
|
# traffic and the enrollment, so this port replaces the 1514/1515 pair for 5.x
|
||||||
|
# agents. Every manager node answers it, master included, mirroring the way the
|
||||||
|
# Docker multi-node deployment balances 1517 across the whole cluster.
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: wazuh-agents
|
||||||
|
namespace: wazuh
|
||||||
|
labels:
|
||||||
|
app: wazuh-manager
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: wazuh-manager
|
||||||
|
ports:
|
||||||
|
- name: agents-https
|
||||||
|
port: 1517
|
||||||
|
targetPort: 1517
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (C) 2019, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
# Wazuh master Service: API and registration (authd)
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: wazuh-api
|
||||||
|
namespace: wazuh
|
||||||
|
labels:
|
||||||
|
app: wazuh-manager
|
||||||
|
annotations:
|
||||||
|
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: wazuh-manager
|
||||||
|
node-type: master
|
||||||
|
ports:
|
||||||
|
- name: api
|
||||||
|
port: 55000
|
||||||
|
targetPort: 55000
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# Copyright (C) 2019, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
# Wazuh cluster Service: Manager nodes communication
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: wazuh-cluster
|
||||||
|
namespace: wazuh
|
||||||
|
labels:
|
||||||
|
app: wazuh-manager
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: wazuh-manager
|
||||||
|
ports:
|
||||||
|
- name: cluster
|
||||||
|
port: 1516
|
||||||
|
targetPort: 1516
|
||||||
|
clusterIP: None
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# Copyright (C) 2019, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
# Wazuh workers service: Agent reporting
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: wazuh-events
|
||||||
|
namespace: wazuh
|
||||||
|
labels:
|
||||||
|
app: wazuh-manager
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: wazuh-manager
|
||||||
|
node-type: worker
|
||||||
|
ports:
|
||||||
|
- name: agents-events
|
||||||
|
port: 1514
|
||||||
|
targetPort: 1514
|
||||||
@@ -0,0 +1,237 @@
|
|||||||
|
# Copyright (C) 2019, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
# Wazuh master StatefulSet
|
||||||
|
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: wazuh-manager-master
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-manager
|
||||||
|
node-type: master
|
||||||
|
serviceName: wazuh-cluster
|
||||||
|
podManagementPolicy: Parallel
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: wazuh-manager
|
||||||
|
node-type: master
|
||||||
|
name: wazuh-manager-master
|
||||||
|
spec:
|
||||||
|
# No workload talks to the Kubernetes API.
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
volumes:
|
||||||
|
# The Secret gets the pod's fsGroup and group read, so the service user
|
||||||
|
# could read it: an init container copies it to a root-only file.
|
||||||
|
- name: wazuh-credentials
|
||||||
|
emptyDir:
|
||||||
|
medium: Memory
|
||||||
|
sizeLimit: 1Mi
|
||||||
|
- name: wazuh-credentials-secret
|
||||||
|
secret:
|
||||||
|
secretName: manager-credentials
|
||||||
|
defaultMode: 0400
|
||||||
|
- name: wazuh-manager-certs-raw
|
||||||
|
secret:
|
||||||
|
secretName: manager-certs
|
||||||
|
defaultMode: 0400
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
emptyDir: {}
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 101
|
||||||
|
initContainers:
|
||||||
|
- name: install-credentials
|
||||||
|
image: 'wazuh/wazuh-manager:5.0.0-rc1'
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- 'umask 077 && cp /credentials-secret/wazuh-credentials /run/secrets/wazuh-credentials && chmod 0400 /run/secrets/wazuh-credentials'
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
capabilities:
|
||||||
|
drop: ["ALL"]
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 64Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
volumeMounts:
|
||||||
|
- name: wazuh-credentials-secret
|
||||||
|
mountPath: /credentials-secret
|
||||||
|
readOnly: true
|
||||||
|
- name: wazuh-credentials
|
||||||
|
mountPath: /run/secrets
|
||||||
|
- name: init-wazuh-etc
|
||||||
|
image: 'wazuh/wazuh-manager:5.0.0-rc1'
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -eu
|
||||||
|
if [ -z "$(ls -A /pvc-etc)" ]; then
|
||||||
|
cp -a /var/wazuh-manager/etc/* /pvc-etc/
|
||||||
|
chown root:101 /pvc-etc/certs
|
||||||
|
chmod 1770 /pvc-etc/certs
|
||||||
|
fi
|
||||||
|
# data/ is not in the image's permanent-data snapshot.
|
||||||
|
if [ -z "$(ls -A /pvc-data)" ]; then
|
||||||
|
cp -a /var/wazuh-manager/data/. /pvc-data/
|
||||||
|
fi
|
||||||
|
cp /tmp/certs-raw/root-ca.pem /etc/wazuh-certs-final/root-ca.pem
|
||||||
|
cp /tmp/certs-raw/manager.pem /etc/wazuh-certs-final/indexer-connector.pem
|
||||||
|
cp /tmp/certs-raw/manager-key.pem /etc/wazuh-certs-final/indexer-connector-key.pem
|
||||||
|
chown root:101 /etc/wazuh-certs-final/root-ca.pem /etc/wazuh-certs-final/indexer-connector.pem /etc/wazuh-certs-final/indexer-connector-key.pem
|
||||||
|
chmod 0640 /etc/wazuh-certs-final/root-ca.pem /etc/wazuh-certs-final/indexer-connector.pem /etc/wazuh-certs-final/indexer-connector-key.pem
|
||||||
|
# The agent listener pair is read by remoted after the manager drops
|
||||||
|
# privileges, so it is owned by the manager user (101:101) instead of
|
||||||
|
# root:101 like the files above.
|
||||||
|
cp /tmp/certs-raw/manager-remoted.pem /etc/wazuh-certs-final/remoted.pem
|
||||||
|
cp /tmp/certs-raw/manager-remoted-key.pem /etc/wazuh-certs-final/remoted-key.pem
|
||||||
|
chown 101:101 /etc/wazuh-certs-final/remoted.pem /etc/wazuh-certs-final/remoted-key.pem
|
||||||
|
chmod 0640 /etc/wazuh-certs-final/remoted.pem /etc/wazuh-certs-final/remoted-key.pem
|
||||||
|
# The Server API pair, read by the API after it drops privileges.
|
||||||
|
# Only the master runs the API.
|
||||||
|
cp /tmp/certs-raw/manager-apid.pem /etc/wazuh-certs-final/apid.pem
|
||||||
|
cp /tmp/certs-raw/manager-apid-key.pem /etc/wazuh-certs-final/apid-key.pem
|
||||||
|
chown 101:101 /etc/wazuh-certs-final/apid.pem /etc/wazuh-certs-final/apid-key.pem
|
||||||
|
chmod 0640 /etc/wazuh-certs-final/apid.pem /etc/wazuh-certs-final/apid-key.pem
|
||||||
|
volumeMounts:
|
||||||
|
- name: wazuh-manager-master
|
||||||
|
mountPath: /pvc-etc
|
||||||
|
subPath: wazuh/var/wazuh-manager/etc
|
||||||
|
- name: wazuh-manager-master
|
||||||
|
mountPath: /pvc-data
|
||||||
|
subPath: wazuh/var/wazuh-manager/data
|
||||||
|
- name: wazuh-manager-certs-raw
|
||||||
|
mountPath: /tmp/certs-raw
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
mountPath: /etc/wazuh-certs-final
|
||||||
|
containers:
|
||||||
|
- name: wazuh-manager
|
||||||
|
image: 'wazuh/wazuh-manager:5.0.0-rc1'
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 400m
|
||||||
|
memory: 1280Mi
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add: ["SYS_CHROOT"]
|
||||||
|
volumeMounts:
|
||||||
|
- name: wazuh-credentials
|
||||||
|
mountPath: /run/secrets
|
||||||
|
readOnly: true
|
||||||
|
- name: wazuh-manager-master
|
||||||
|
mountPath: /var/wazuh-manager/api/configuration
|
||||||
|
subPath: wazuh/var/wazuh-manager/api/configuration
|
||||||
|
- name: wazuh-manager-master
|
||||||
|
mountPath: /var/wazuh-manager/etc
|
||||||
|
subPath: wazuh/var/wazuh-manager/etc
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
mountPath: /var/wazuh-manager/etc/certs/root-ca.pem
|
||||||
|
subPath: root-ca.pem
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
mountPath: /var/wazuh-manager/etc/certs/indexer-connector.pem
|
||||||
|
subPath: indexer-connector.pem
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
mountPath: /var/wazuh-manager/etc/certs/indexer-connector-key.pem
|
||||||
|
subPath: indexer-connector-key.pem
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
mountPath: /var/wazuh-manager/etc/certs/remoted.pem
|
||||||
|
subPath: remoted.pem
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
mountPath: /var/wazuh-manager/etc/certs/remoted-key.pem
|
||||||
|
subPath: remoted-key.pem
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
mountPath: /var/wazuh-manager/etc/certs/apid.pem
|
||||||
|
subPath: apid.pem
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
mountPath: /var/wazuh-manager/etc/certs/apid-key.pem
|
||||||
|
subPath: apid-key.pem
|
||||||
|
- name: wazuh-manager-master
|
||||||
|
mountPath: /var/wazuh-manager/logs
|
||||||
|
subPath: wazuh/var/wazuh-manager/logs
|
||||||
|
- name: wazuh-manager-master
|
||||||
|
mountPath: /var/wazuh-manager/queue
|
||||||
|
subPath: wazuh/var/wazuh-manager/queue
|
||||||
|
- name: wazuh-manager-master
|
||||||
|
mountPath: /var/wazuh-manager/var/multigroups
|
||||||
|
subPath: wazuh/var/wazuh-manager/var/multigroups
|
||||||
|
- name: wazuh-manager-master
|
||||||
|
mountPath: /var/wazuh-manager/data
|
||||||
|
subPath: wazuh/var/wazuh-manager/data
|
||||||
|
ports:
|
||||||
|
- containerPort: 1517
|
||||||
|
name: agents-https
|
||||||
|
- containerPort: 1515
|
||||||
|
name: registration
|
||||||
|
- containerPort: 1516
|
||||||
|
name: cluster
|
||||||
|
- containerPort: 55000
|
||||||
|
name: api
|
||||||
|
startupProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- /var/wazuh-manager/bin/wazuh-manager-control status 2>/dev/null | grep -qE 'not running|failed to start|refused its configuration' && exit 1 || exit 0
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 12
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- /var/wazuh-manager/bin/wazuh-manager-control status 2>/dev/null | grep -qE 'not running|failed to start|refused its configuration' && exit 1 || exit 0
|
||||||
|
periodSeconds: 15
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 5
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- /var/wazuh-manager/bin/wazuh-manager-control status 2>/dev/null | grep -qE 'not running|failed to start|refused its configuration' && exit 1 || exit 0
|
||||||
|
periodSeconds: 15
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 5
|
||||||
|
env:
|
||||||
|
- name: WAZUH_INDEXER_HOSTS
|
||||||
|
value: 'wazuh-indexer-0.wazuh-indexer:9200,wazuh-indexer-1.wazuh-indexer:9200,wazuh-indexer-2.wazuh-indexer:9200'
|
||||||
|
- name: WAZUH_NODE_NAME
|
||||||
|
value: 'master'
|
||||||
|
- name: WAZUH_NODE_TYPE
|
||||||
|
value: 'master'
|
||||||
|
- name: WAZUH_REMOTE_BIND_ADDR
|
||||||
|
value: '0.0.0.0'
|
||||||
|
- name: WAZUH_CLUSTER_BIND_ADDR
|
||||||
|
value: '0.0.0.0'
|
||||||
|
- name: WAZUH_CLUSTER_NODES
|
||||||
|
value: 'wazuh-manager-master-0.wazuh-cluster'
|
||||||
|
- name: WAZUH_CLUSTER_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: wazuh-cluster-key
|
||||||
|
key: key
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- metadata:
|
||||||
|
name: wazuh-manager-master
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# Copyright (C) 2019, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
# Wazuh master Service: API and registration (authd)
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: wazuh-registration
|
||||||
|
namespace: wazuh
|
||||||
|
labels:
|
||||||
|
app: wazuh-manager
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: wazuh-manager
|
||||||
|
node-type: master
|
||||||
|
ports:
|
||||||
|
- name: registration
|
||||||
|
port: 1515
|
||||||
|
targetPort: 1515
|
||||||
@@ -0,0 +1,234 @@
|
|||||||
|
# Copyright (C) 2019, Wazuh Inc.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it
|
||||||
|
# and/or modify it under the terms of the GNU General Public
|
||||||
|
# License (version 2) as published by the FSF - Free Software
|
||||||
|
# Foundation.
|
||||||
|
|
||||||
|
# Wazuh workers StatefulSet
|
||||||
|
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: wazuh-manager-worker
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
replicas: 2
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-manager
|
||||||
|
node-type: worker
|
||||||
|
serviceName: wazuh-cluster
|
||||||
|
podManagementPolicy: Parallel
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: wazuh-manager
|
||||||
|
node-type: worker
|
||||||
|
name: wazuh-manager-worker
|
||||||
|
spec:
|
||||||
|
# No workload talks to the Kubernetes API.
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
affinity:
|
||||||
|
podAntiAffinity:
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- weight: 100
|
||||||
|
podAffinityTerm:
|
||||||
|
topologyKey: kubernetes.io/hostname
|
||||||
|
labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: wazuh-manager
|
||||||
|
node-type: worker
|
||||||
|
volumes:
|
||||||
|
# The Secret gets the pod's fsGroup and group read, so the service user
|
||||||
|
# could read it: an init container copies it to a root-only file.
|
||||||
|
- name: wazuh-credentials
|
||||||
|
emptyDir:
|
||||||
|
medium: Memory
|
||||||
|
sizeLimit: 1Mi
|
||||||
|
- name: wazuh-credentials-secret
|
||||||
|
secret:
|
||||||
|
secretName: manager-credentials
|
||||||
|
defaultMode: 0400
|
||||||
|
- name: wazuh-manager-certs-raw
|
||||||
|
secret:
|
||||||
|
secretName: manager-certs
|
||||||
|
defaultMode: 0400
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
emptyDir: {}
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 101
|
||||||
|
initContainers:
|
||||||
|
- name: install-credentials
|
||||||
|
image: 'wazuh/wazuh-manager:5.0.0-rc1'
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- 'umask 077 && cp /credentials-secret/wazuh-credentials /run/secrets/wazuh-credentials && chmod 0400 /run/secrets/wazuh-credentials'
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
capabilities:
|
||||||
|
drop: ["ALL"]
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 64Mi
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
volumeMounts:
|
||||||
|
- name: wazuh-credentials-secret
|
||||||
|
mountPath: /credentials-secret
|
||||||
|
readOnly: true
|
||||||
|
- name: wazuh-credentials
|
||||||
|
mountPath: /run/secrets
|
||||||
|
- name: init-wazuh-etc
|
||||||
|
image: 'wazuh/wazuh-manager:5.0.0-rc1'
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
if [ -z "$(ls -A /pvc-etc)" ]; then
|
||||||
|
cp -a /var/wazuh-manager/etc/* /pvc-etc/
|
||||||
|
chown root:101 /pvc-etc/certs
|
||||||
|
chmod 1770 /pvc-etc/certs
|
||||||
|
fi
|
||||||
|
# data/ is not in the image's permanent-data snapshot.
|
||||||
|
if [ -z "$(ls -A /pvc-data)" ]; then
|
||||||
|
cp -a /var/wazuh-manager/data/. /pvc-data/
|
||||||
|
fi
|
||||||
|
cp /tmp/certs-raw/root-ca.pem /etc/wazuh-certs-final/root-ca.pem
|
||||||
|
cp /tmp/certs-raw/manager.pem /etc/wazuh-certs-final/indexer-connector.pem
|
||||||
|
cp /tmp/certs-raw/manager-key.pem /etc/wazuh-certs-final/indexer-connector-key.pem
|
||||||
|
chown root:101 /etc/wazuh-certs-final/root-ca.pem /etc/wazuh-certs-final/indexer-connector.pem /etc/wazuh-certs-final/indexer-connector-key.pem
|
||||||
|
chmod 0640 /etc/wazuh-certs-final/root-ca.pem /etc/wazuh-certs-final/indexer-connector.pem /etc/wazuh-certs-final/indexer-connector-key.pem
|
||||||
|
# The agent listener pair is read by remoted after the manager drops
|
||||||
|
# privileges, so it is owned by the manager user (101:101) instead of
|
||||||
|
# root:101 like the files above.
|
||||||
|
cp /tmp/certs-raw/manager-remoted.pem /etc/wazuh-certs-final/remoted.pem
|
||||||
|
cp /tmp/certs-raw/manager-remoted-key.pem /etc/wazuh-certs-final/remoted-key.pem
|
||||||
|
chown 101:101 /etc/wazuh-certs-final/remoted.pem /etc/wazuh-certs-final/remoted-key.pem
|
||||||
|
chmod 0640 /etc/wazuh-certs-final/remoted.pem /etc/wazuh-certs-final/remoted-key.pem
|
||||||
|
volumeMounts:
|
||||||
|
- name: wazuh-manager-worker
|
||||||
|
mountPath: /pvc-etc
|
||||||
|
subPath: wazuh/var/wazuh-manager/etc
|
||||||
|
- name: wazuh-manager-worker
|
||||||
|
mountPath: /pvc-data
|
||||||
|
subPath: wazuh/var/wazuh-manager/data
|
||||||
|
- name: wazuh-manager-certs-raw
|
||||||
|
mountPath: /tmp/certs-raw
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
mountPath: /etc/wazuh-certs-final
|
||||||
|
containers:
|
||||||
|
- name: wazuh-manager
|
||||||
|
image: 'wazuh/wazuh-manager:5.0.0-rc1'
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 400m
|
||||||
|
memory: 1280Mi
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add: ["SYS_CHROOT"]
|
||||||
|
volumeMounts:
|
||||||
|
- name: wazuh-credentials
|
||||||
|
mountPath: /run/secrets
|
||||||
|
readOnly: true
|
||||||
|
- name: wazuh-manager-worker
|
||||||
|
mountPath: /var/wazuh-manager/api/configuration
|
||||||
|
subPath: wazuh/var/wazuh-manager/api/configuration
|
||||||
|
- name: wazuh-manager-worker
|
||||||
|
mountPath: /var/wazuh-manager/etc
|
||||||
|
subPath: wazuh/var/wazuh-manager/etc
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
mountPath: /var/wazuh-manager/etc/certs/root-ca.pem
|
||||||
|
subPath: root-ca.pem
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
mountPath: /var/wazuh-manager/etc/certs/indexer-connector.pem
|
||||||
|
subPath: indexer-connector.pem
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
mountPath: /var/wazuh-manager/etc/certs/indexer-connector-key.pem
|
||||||
|
subPath: indexer-connector-key.pem
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
mountPath: /var/wazuh-manager/etc/certs/remoted.pem
|
||||||
|
subPath: remoted.pem
|
||||||
|
- name: wazuh-manager-certs
|
||||||
|
mountPath: /var/wazuh-manager/etc/certs/remoted-key.pem
|
||||||
|
subPath: remoted-key.pem
|
||||||
|
- name: wazuh-manager-worker
|
||||||
|
mountPath: /var/wazuh-manager/logs
|
||||||
|
subPath: wazuh/var/wazuh-manager/logs
|
||||||
|
- name: wazuh-manager-worker
|
||||||
|
mountPath: /var/wazuh-manager/queue
|
||||||
|
subPath: wazuh/var/wazuh-manager/queue
|
||||||
|
- name: wazuh-manager-worker
|
||||||
|
mountPath: /var/wazuh-manager/var/multigroups
|
||||||
|
subPath: wazuh/var/wazuh-manager/var/multigroups
|
||||||
|
- name: wazuh-manager-worker
|
||||||
|
mountPath: /var/wazuh-manager/data
|
||||||
|
subPath: wazuh/var/wazuh-manager/data
|
||||||
|
ports:
|
||||||
|
- containerPort: 1517
|
||||||
|
name: agents-https
|
||||||
|
- containerPort: 1514
|
||||||
|
name: agents-events
|
||||||
|
- containerPort: 1516
|
||||||
|
name: cluster
|
||||||
|
startupProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- /var/wazuh-manager/bin/wazuh-manager-control status 2>/dev/null | grep -v apid | grep -qE 'not running|failed to start|refused its configuration' && exit 1 || exit 0
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 12
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- /var/wazuh-manager/bin/wazuh-manager-control status 2>/dev/null | grep -v apid | grep -qE 'not running|failed to start|refused its configuration' && exit 1 || exit 0
|
||||||
|
periodSeconds: 15
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 5
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- /var/wazuh-manager/bin/wazuh-manager-control status 2>/dev/null | grep -v apid | grep -qE 'not running|failed to start|refused its configuration' && exit 1 || exit 0
|
||||||
|
periodSeconds: 15
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 5
|
||||||
|
env:
|
||||||
|
- name: WAZUH_INDEXER_HOSTS
|
||||||
|
value: 'wazuh-indexer-0.wazuh-indexer:9200,wazuh-indexer-1.wazuh-indexer:9200,wazuh-indexer-2.wazuh-indexer:9200'
|
||||||
|
- name: WAZUH_NODE_NAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.name
|
||||||
|
- name: WAZUH_NODE_TYPE
|
||||||
|
value: 'worker'
|
||||||
|
- name: WAZUH_REMOTE_BIND_ADDR
|
||||||
|
value: '0.0.0.0'
|
||||||
|
- name: WAZUH_CLUSTER_BIND_ADDR
|
||||||
|
value: '0.0.0.0'
|
||||||
|
- name: WAZUH_CLUSTER_NODES
|
||||||
|
value: 'wazuh-manager-master-0.wazuh-cluster'
|
||||||
|
- name: WAZUH_CLUSTER_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: wazuh-cluster-key
|
||||||
|
key: key
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- metadata:
|
||||||
|
name: wazuh-manager-worker
|
||||||
|
namespace: wazuh
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 500Mi
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
apiVersion: external-secrets.io/v1
|
||||||
|
kind: ExternalSecret
|
||||||
|
metadata:
|
||||||
|
name: homelab-repo-password
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
refreshInterval: 1h
|
||||||
|
secretStoreRef:
|
||||||
|
name: infisical
|
||||||
|
kind: ClusterSecretStore
|
||||||
|
target:
|
||||||
|
name: homelab-repo
|
||||||
|
creationPolicy: Merge
|
||||||
|
deletionPolicy: Retain
|
||||||
|
data:
|
||||||
|
- secretKey: password
|
||||||
|
remoteRef:
|
||||||
|
key: /argocd/ARGOCD_REPO_PASSWORD
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: homelab-repo
|
||||||
|
namespace: argocd
|
||||||
|
labels:
|
||||||
|
argocd.argoproj.io/secret-type: repository
|
||||||
|
stringData:
|
||||||
|
type: git
|
||||||
|
url: https://git.itqdev.xyz/Infrastructure/homelab.git
|
||||||
|
username: ITQ
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
apiVersion: external-secrets.io/v1
|
||||||
|
kind: ExternalSecret
|
||||||
|
metadata:
|
||||||
|
name: argocd-oidc-client-secret
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
refreshInterval: 1h
|
||||||
|
secretStoreRef:
|
||||||
|
name: infisical
|
||||||
|
kind: ClusterSecretStore
|
||||||
|
target:
|
||||||
|
name: argocd-secret
|
||||||
|
creationPolicy: Merge
|
||||||
|
deletionPolicy: Retain
|
||||||
|
data:
|
||||||
|
- secretKey: oidc.keycloak.clientSecret
|
||||||
|
remoteRef:
|
||||||
|
key: /argocd/ARGOCD_OIDC_CLIENT_SECRET
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: AppProject
|
||||||
|
metadata:
|
||||||
|
name: default
|
||||||
|
namespace: argocd
|
||||||
|
|
||||||
|
spec:
|
||||||
|
description: Default project with maintenance sync window
|
||||||
|
|
||||||
|
sourceRepos:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
destinations:
|
||||||
|
- namespace: "*"
|
||||||
|
server: "*"
|
||||||
|
|
||||||
|
syncWindows:
|
||||||
|
- kind: allow
|
||||||
|
schedule: "0 3 * * *"
|
||||||
|
duration: 1h
|
||||||
|
applications:
|
||||||
|
- "*"
|
||||||
|
manualSync: true
|
||||||
|
|
||||||
|
- kind: allow
|
||||||
|
schedule: "* * * * *"
|
||||||
|
duration: 24h
|
||||||
|
applications:
|
||||||
|
- "root-app"
|
||||||
|
- "manifests"
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
apiVersion: talos.dev/v1alpha1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: talos-backup-secrets
|
||||||
|
namespace: backup-system
|
||||||
|
spec:
|
||||||
|
roles:
|
||||||
|
- os:etcd:backup
|
||||||
|
---
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: talos-backup
|
||||||
|
namespace: backup-system
|
||||||
|
spec:
|
||||||
|
schedule: "0 0 */7 * *" # At 00:00 on every 7th day-of-month
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: talos-backup
|
||||||
|
image: ghcr.io/siderolabs/talos-backup:latest
|
||||||
|
workingDir: /tmp
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
env:
|
||||||
|
- name: AWS_ACCESS_KEY_ID
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: etcd-backup-secrets
|
||||||
|
key: AWS_ACCESS_KEY_ID
|
||||||
|
- name: AWS_SECRET_ACCESS_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: etcd-backup-secrets
|
||||||
|
key: AWS_SECRET_ACCESS_KEY
|
||||||
|
- name: AWS_REGION
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: etcd-backup-secrets
|
||||||
|
key: AWS_REGION
|
||||||
|
- name: CUSTOM_S3_ENDPOINT
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: etcd-backup-secrets
|
||||||
|
key: CUSTOM_S3_ENDPOINT
|
||||||
|
- name: BUCKET
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: etcd-backup-secrets
|
||||||
|
key: BUCKET
|
||||||
|
- name: USE_PATH_STYLE
|
||||||
|
value: "true"
|
||||||
|
- name: CLUSTER_NAME
|
||||||
|
value: "prod"
|
||||||
|
- name: S3_PREFIX
|
||||||
|
value: ""
|
||||||
|
- name: AGE_RECIPIENT_PUBLIC_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: etcd-backup-secrets
|
||||||
|
key: AGE_RECIPIENT_PUBLIC_KEY
|
||||||
|
- name: ENABLE_COMPRESSION
|
||||||
|
value: "false"
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 1000
|
||||||
|
runAsGroup: 1000
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
runAsNonRoot: true
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
|
command:
|
||||||
|
- /talos-backup
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /tmp
|
||||||
|
name: tmp
|
||||||
|
- mountPath: /.talos
|
||||||
|
name: talos
|
||||||
|
- mountPath: /var/run/secrets/talos.dev
|
||||||
|
name: talos-secrets
|
||||||
|
restartPolicy: OnFailure
|
||||||
|
volumes:
|
||||||
|
- emptyDir: {}
|
||||||
|
name: tmp
|
||||||
|
- emptyDir: {}
|
||||||
|
name: talos
|
||||||
|
- name: talos-secrets
|
||||||
|
secret:
|
||||||
|
secretName: talos-backup-secrets
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
apiVersion: external-secrets.io/v1
|
||||||
|
kind: ExternalSecret
|
||||||
|
metadata:
|
||||||
|
name: etcd-backup-secrets
|
||||||
|
namespace: backup-system
|
||||||
|
spec:
|
||||||
|
secretStoreRef:
|
||||||
|
name: infisical
|
||||||
|
kind: ClusterSecretStore
|
||||||
|
|
||||||
|
target:
|
||||||
|
name: etcd-backup-secrets
|
||||||
|
creationPolicy: Owner
|
||||||
|
template:
|
||||||
|
engineVersion: v2
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
AWS_ACCESS_KEY_ID: "{{ .awsAccessKeyId }}"
|
||||||
|
AWS_SECRET_ACCESS_KEY: "{{ .awsSecretAccessKey }}"
|
||||||
|
AWS_REGION: "{{ .awsRegion }}"
|
||||||
|
CUSTOM_S3_ENDPOINT: "{{ .customS3Endpoint }}"
|
||||||
|
BUCKET: "{{ .bucket }}"
|
||||||
|
AGE_RECIPIENT_PUBLIC_KEY: "{{ .ageRecipientPublicKey }}"
|
||||||
|
|
||||||
|
data:
|
||||||
|
- secretKey: awsAccessKeyId
|
||||||
|
remoteRef:
|
||||||
|
key: /etcd-backup/AWS_ACCESS_KEY_ID
|
||||||
|
|
||||||
|
- secretKey: awsSecretAccessKey
|
||||||
|
remoteRef:
|
||||||
|
key: /etcd-backup/AWS_SECRET_ACCESS_KEY
|
||||||
|
|
||||||
|
- secretKey: awsRegion
|
||||||
|
remoteRef:
|
||||||
|
key: /etcd-backup/AWS_REGION
|
||||||
|
|
||||||
|
- secretKey: customS3Endpoint
|
||||||
|
remoteRef:
|
||||||
|
key: /etcd-backup/CUSTOM_S3_ENDPOINT
|
||||||
|
|
||||||
|
- secretKey: bucket
|
||||||
|
remoteRef:
|
||||||
|
key: /etcd-backup/BUCKET
|
||||||
|
|
||||||
|
- secretKey: ageRecipientPublicKey
|
||||||
|
remoteRef:
|
||||||
|
key: /etcd-backup/AGE_RECIPIENT_PUBLIC_KEY
|
||||||
|
|
||||||
|
refreshInterval: 1h
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
apiVersion: external-secrets.io/v1
|
||||||
|
kind: ClusterSecretStore
|
||||||
|
metadata:
|
||||||
|
name: infisical
|
||||||
|
annotations:
|
||||||
|
argocd.argoproj.io/sync-wave: "-1"
|
||||||
|
spec:
|
||||||
|
provider:
|
||||||
|
infisical:
|
||||||
|
hostAPI: https://vault.itqdev.xyz
|
||||||
|
auth:
|
||||||
|
kubernetesAuthCredentials:
|
||||||
|
identityId:
|
||||||
|
name: infisical-kubernetes-auth
|
||||||
|
key: identityId
|
||||||
|
namespace: external-secrets
|
||||||
|
secretsScope:
|
||||||
|
projectSlug: k8s-homelab
|
||||||
|
environmentSlug: prod
|
||||||
|
secretsPath: /
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: infisical-kubernetes-auth
|
||||||
|
namespace: external-secrets
|
||||||
|
annotations:
|
||||||
|
argocd.argoproj.io/sync-wave: "-2"
|
||||||
|
type: Opaque
|
||||||
|
stringData:
|
||||||
|
identityId: 306b967d-5f24-4b78-bbb1-0b49d20c64b0
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: external-secrets-infisical-token-reviewer
|
||||||
|
annotations:
|
||||||
|
argocd.argoproj.io/sync-wave: "-2"
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- authentication.k8s.io
|
||||||
|
resources:
|
||||||
|
- tokenreviews
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: external-secrets-infisical-token-reviewer
|
||||||
|
annotations:
|
||||||
|
argocd.argoproj.io/sync-wave: "-2"
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: external-secrets-infisical-token-reviewer
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: external-secrets-operator
|
||||||
|
namespace: external-secrets
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
|
kind: HTTPRoute
|
||||||
|
metadata:
|
||||||
|
name: global-http-redirect
|
||||||
|
namespace: gateway-system
|
||||||
|
spec:
|
||||||
|
parentRefs:
|
||||||
|
- name: shared-gateway
|
||||||
|
namespace: gateway-system
|
||||||
|
sectionName: http-redirect
|
||||||
|
|
||||||
|
rules:
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /
|
||||||
|
filters:
|
||||||
|
- type: RequestRedirect
|
||||||
|
requestRedirect:
|
||||||
|
scheme: https
|
||||||
|
statusCode: 301
|
||||||
|
port: 443
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: gateway-system
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
|
kind: HTTPRoute
|
||||||
|
metadata:
|
||||||
|
name: argocd
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
parentRefs:
|
||||||
|
- name: shared-gateway
|
||||||
|
namespace: gateway-system
|
||||||
|
sectionName: argocd-https
|
||||||
|
|
||||||
|
hostnames:
|
||||||
|
- "argocd.internal.itqdev.xyz"
|
||||||
|
|
||||||
|
rules:
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /
|
||||||
|
backendRefs:
|
||||||
|
- name: argocd-server
|
||||||
|
port: 80
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: external-secrets.io/v1
|
||||||
|
kind: ExternalSecret
|
||||||
|
metadata:
|
||||||
|
name: argocd-tls
|
||||||
|
namespace: gateway-system
|
||||||
|
spec:
|
||||||
|
refreshInterval: 1h
|
||||||
|
secretStoreRef:
|
||||||
|
name: infisical
|
||||||
|
kind: ClusterSecretStore
|
||||||
|
target:
|
||||||
|
name: argocd-tls
|
||||||
|
creationPolicy: Owner
|
||||||
|
template:
|
||||||
|
type: kubernetes.io/tls
|
||||||
|
data:
|
||||||
|
- secretKey: tls.crt
|
||||||
|
remoteRef:
|
||||||
|
key: /gateway/ARGOCD_TLS_CERT
|
||||||
|
- secretKey: tls.key
|
||||||
|
remoteRef:
|
||||||
|
key: /gateway/ARGOCD_TLS_KEY
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
|
kind: HTTPRoute
|
||||||
|
metadata:
|
||||||
|
name: grafana
|
||||||
|
namespace: grafana
|
||||||
|
spec:
|
||||||
|
parentRefs:
|
||||||
|
- name: shared-gateway
|
||||||
|
namespace: gateway-system
|
||||||
|
sectionName: grafana-https
|
||||||
|
|
||||||
|
hostnames:
|
||||||
|
- "grafana.internal.itqdev.xyz"
|
||||||
|
|
||||||
|
rules:
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /
|
||||||
|
backendRefs:
|
||||||
|
- name: grafana
|
||||||
|
port: 80
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: external-secrets.io/v1
|
||||||
|
kind: ExternalSecret
|
||||||
|
metadata:
|
||||||
|
name: grafana-tls
|
||||||
|
namespace: gateway-system
|
||||||
|
spec:
|
||||||
|
refreshInterval: 1h
|
||||||
|
secretStoreRef:
|
||||||
|
name: infisical
|
||||||
|
kind: ClusterSecretStore
|
||||||
|
target:
|
||||||
|
name: grafana-tls
|
||||||
|
creationPolicy: Owner
|
||||||
|
template:
|
||||||
|
type: kubernetes.io/tls
|
||||||
|
data:
|
||||||
|
- secretKey: tls.crt
|
||||||
|
remoteRef:
|
||||||
|
key: /gateway/GRAFANA_TLS_CERT
|
||||||
|
- secretKey: tls.key
|
||||||
|
remoteRef:
|
||||||
|
key: /gateway/GRAFANA_TLS_KEY
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
|
kind: HTTPRoute
|
||||||
|
metadata:
|
||||||
|
name: headlamp
|
||||||
|
namespace: headlamp
|
||||||
|
spec:
|
||||||
|
parentRefs:
|
||||||
|
- name: shared-gateway
|
||||||
|
namespace: gateway-system
|
||||||
|
sectionName: headlamp-https
|
||||||
|
|
||||||
|
hostnames:
|
||||||
|
- "k8s.internal.itqdev.xyz"
|
||||||
|
|
||||||
|
rules:
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /
|
||||||
|
backendRefs:
|
||||||
|
- name: headlamp
|
||||||
|
port: 80
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: external-secrets.io/v1
|
||||||
|
kind: ExternalSecret
|
||||||
|
metadata:
|
||||||
|
name: headlamp-tls
|
||||||
|
namespace: gateway-system
|
||||||
|
spec:
|
||||||
|
refreshInterval: 1h
|
||||||
|
secretStoreRef:
|
||||||
|
name: infisical
|
||||||
|
kind: ClusterSecretStore
|
||||||
|
target:
|
||||||
|
name: headlamp-tls
|
||||||
|
creationPolicy: Owner
|
||||||
|
template:
|
||||||
|
type: kubernetes.io/tls
|
||||||
|
data:
|
||||||
|
- secretKey: tls.crt
|
||||||
|
remoteRef:
|
||||||
|
key: /gateway/HEADLAMP_TLS_CERT
|
||||||
|
- secretKey: tls.key
|
||||||
|
remoteRef:
|
||||||
|
key: /gateway/HEADLAMP_TLS_KEY
|
||||||
Loaded 100 of 216 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user