Skip to content

Instantly share code, notes, and snippets.

@amimof
amimof / pfelk-config.sh
Last active February 4, 2021 13:49
pfelk configuration script
echo "Enter elasticsearch username"
read ELASTIC_USERNAME
echo "Enter elasticsearch password"
read ELASTIC_PASSWORD
echo "→ PUT _component_template/pfelk-settings"
curl http://$ELASTIC_USERNAME:$ELASTIC_PASSWORD@localhost:9200/_component_template/pfelk-settings -X PUT -H "Content-Type: application/json" -d '{
"version": 8,
"template": {
"settings": {
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: home-assistant
labels:
name: home-assistant
spec:
accessModes:
- "ReadWriteOnce"
@amimof
amimof / root-and-intermediate-ca-chain.md
Last active June 2, 2020 07:25
How to create an intermediate certificate authority to issue server certificates using OpenSSL

OpenSSL Configuration

Use this configuration with OpenSSL. You may add real IP and DNS SAN´s (Subject Alternative Name) below under [ alt_names ].

cat <<EOF > openssl.conf 
[ req ]
distinguished_name = req_distinguished_name
[req_distinguished_name]

[ v3_ca ]
basicConstraints = critical, CA:TRUE
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: node-problem-detector
namespace: node-problem-detector
---
apiVersion: v1
kind: ConfigMap
metadata:
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: ingressroutes.traefik.containo.us
spec:
group: traefik.containo.us
version: v1alpha1
names:
kind: IngressRoute
---
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
labels:
k8s-app: coredns
data:
Corefile: |-
@amimof
amimof / enable-apparmor.sh
Last active April 2, 2019 11:21
Installs and enables AppArmor on debian
#!/bin/bash
apt-get update
apt-get install apparmor apparmor-utils
mkdir -p /etc/default/grub.d
echo 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT apparmor=1 security=apparmor"' | sudo tee /etc/default/grub.d/apparmor.cfg
update-grub
echo 'Reboot required for the changes to take effect. After reboot, verify AppArmor status by issuing `aa-status`'
@amimof
amimof / podsecuritypolicy.yaml
Last active February 20, 2019 18:12
A Kubernetes manifest for PodSecurityPolicy. Creates two policies; restricted and privileged where restricted is applied to system:authenticated. AppArmor required on the node hosts.
---
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: restricted
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'docker/default'
apparmor.security.beta.kubernetes.io/allowedProfileNames: 'runtime/default'
seccomp.security.alpha.kubernetes.io/defaultProfileName: 'docker/default'
apparmor.security.beta.kubernetes.io/defaultProfileName: 'runtime/default'
@amimof
amimof / prometheus.yaml
Last active April 10, 2020 16:39
Prometheus Kubernetes Deployment
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: prometheus
component: kube-state-metrics
name: kube-state-metrics
namespace: prometheus
---