Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoC of managing certificates with cert-manager #577

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions envs/docker-desktop/indexer-resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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: apps/v1
kind: StatefulSet
metadata:
name: wazuh-indexer
namespace: wazuh
spec:
replicas: 1
template:
spec:
containers:
- name: wazuh-indexer
resources:
requests:
cpu: 500m
memory: 1Gi
limits:
cpu: 1
memory: 2Gi
15 changes: 15 additions & 0 deletions envs/docker-desktop/kustomization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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
resources:
- ../../wazuh
patches:
- path: storage-class.yaml
- path: indexer-resources.yaml
- path: wazuh-resources.yaml
16 changes: 16 additions & 0 deletions envs/docker-desktop/storage-class.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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 StorageClass

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: wazuh-storage

provisioner: docker.io/hostpath

14 changes: 14 additions & 0 deletions envs/docker-desktop/wazuh-resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 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: apps/v1
kind: StatefulSet
metadata:
name: wazuh-manager-worker
namespace: wazuh
spec:
replicas: 1
29 changes: 29 additions & 0 deletions wazuh/certs/admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
# Source: api/templates/virtual_service.yaml
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: admin
namespace: wazuh
spec:
issuerRef:
group: cert-manager.io
kind: Issuer
name: wazuh-issuer
secretName: admin-tls
commonName: admin
dnsNames:
- "admin"
usages:
- "signing"
- "key encipherment"
- "server auth"
- "client auth"
duration: 2160h
renewBefore: 360h
isCA: false
privateKey:
algorithm: RSA
encoding: PKCS1
size: 2048
rotationPolicy: Always
30 changes: 30 additions & 0 deletions wazuh/certs/dashboard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# Source: api/templates/virtual_service.yaml
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: dashboard
namespace: wazuh
spec:
issuerRef:
group: cert-manager.io
kind: Issuer
name: wazuh-issuer
secretName: dashboard-tls
commonName: dashboard
dnsNames:
- "dashboard"
usages:
- "signing"
- "key encipherment"
- "server auth"
- "client auth"
- digital signature
duration: 2160h
renewBefore: 360h
isCA: false
privateKey:
algorithm: RSA
encoding: PKCS1
size: 2048
rotationPolicy: Always
6 changes: 0 additions & 6 deletions wazuh/certs/dashboard_http/generate_certs.sh

This file was deleted.

30 changes: 30 additions & 0 deletions wazuh/certs/filebeat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# Source: api/templates/virtual_service.yaml
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: filebeat
namespace: wazuh
spec:
issuerRef:
group: cert-manager.io
kind: Issuer
name: wazuh-issuer
secretName: filebeat-tls
commonName: filebeat
dnsNames:
- "filebeat"
usages:
- "signing"
- "key encipherment"
- "server auth"
- "client auth"
- digital signature
duration: 2160h
renewBefore: 360h
isCA: false
privateKey:
algorithm: RSA
encoding: PKCS1
size: 2048
rotationPolicy: Always
85 changes: 0 additions & 85 deletions wazuh/certs/indexer_cluster/generate_certs.sh

This file was deleted.

31 changes: 31 additions & 0 deletions wazuh/certs/node.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# Source: api/templates/virtual_service.yaml
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: node
namespace: wazuh
spec:
issuerRef:
group: cert-manager.io
kind: Issuer
name: wazuh-issuer
secretName: node-tls
commonName: "*.wazuh-indexer"
dnsNames:
- "*.wazuh-indexer"
- "indexer"
usages:
- "signing"
- "key encipherment"
- "server auth"
- "client auth"
- digital signature
duration: 2160h
renewBefore: 360h
isCA: false
privateKey:
algorithm: RSA
encoding: PKCS1
size: 2048
rotationPolicy: Always
40 changes: 40 additions & 0 deletions wazuh/certs/wazuh-ca.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: selfsigning-issuer
namespace: wazuh
spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: wazuh-pki-ca
namespace: wazuh
spec:
issuerRef:
group: cert-manager.io
kind: Issuer
name: selfsigning-issuer
secretName: wazuh-pki-ca
commonName: "wazuh-ca"
subject:
organizations:
- "Wazuh, Inc."
usages:
- "signing"
- "key encipherment"
- "cert sign"
duration: 87600h # 3650d
renewBefore: 8760h # 365d
isCA: true
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: wazuh-issuer
namespace: wazuh
spec:
ca:
secretName: "wazuh-pki-ca"
14 changes: 7 additions & 7 deletions wazuh/indexer_stack/wazuh-dashboard/dashboard-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
name: dashboard-conf
- name: dashboard-certs
secret:
secretName: dashboard-certs
secretName: dashboard-tls
containers:
- name: wazuh-dashboard
image: 'wazuh/wazuh-dashboard:5.0.0'
Expand All @@ -43,16 +43,16 @@ spec:
subPath: opensearch_dashboards.yml
readOnly: false
- name: dashboard-certs
mountPath: /usr/share/wazuh-dashboard/certs/cert.pem
mountPath: /usr/share/wazuh-dashboard/certs/tls.crt
readOnly: true
subPath: cert.pem
subPath: tls.crt
- name: dashboard-certs
mountPath: /usr/share/wazuh-dashboard/certs/key.pem
mountPath: /usr/share/wazuh-dashboard/certs/tls.key
readOnly: true
subPath: key.pem
subPath: tls.key
- name: dashboard-certs
mountPath: /usr/share/wazuh-dashboard/certs/root-ca.pem
subPath: root-ca.pem
mountPath: /usr/share/wazuh-dashboard/certs/ca.crt
subPath: ca.crt
readOnly: true
ports:
- containerPort: 5601
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ opensearch.requestHeadersWhitelist: [ authorization,securitytenant ]
opensearch_security.multitenancy.enabled: false
opensearch_security.readonly_mode.roles: ["kibana_read_only"]
server.ssl.enabled: true
server.ssl.key: "/usr/share/wazuh-dashboard/certs/key.pem"
server.ssl.certificate: "/usr/share/wazuh-dashboard/certs/cert.pem"
opensearch.ssl.certificateAuthorities: ["/usr/share/wazuh-dashboard/certs/root-ca.pem"]
server.ssl.key: "/usr/share/wazuh-dashboard/certs/tls.key"
server.ssl.certificate: "/usr/share/wazuh-dashboard/certs/tls.crt"
opensearch.ssl.certificateAuthorities: ["/usr/share/wazuh-dashboard/certs/ca.crt"]
uiSettings.overrides.defaultRoute: /app/wz-home
Loading