mirror of
https://github.com/wahyd4/home-docker.git
synced 2026-08-08 20:15:03 +10:00
42 lines
1.1 KiB
Bash
42 lines
1.1 KiB
Bash
#! /bin/bash -eu
|
|
|
|
|
|
# For fixing the following dns issue in k8s
|
|
# Nameserver limits were exceeded, some nameservers have been omitted, the applied nameserver line is: 127.0.0.1 1.1.1.1 1.1.1.1
|
|
|
|
# Update dns
|
|
|
|
sudo vim /etc/systemd/resolved.conf
|
|
sudo systemctl restart systemd-resolved
|
|
|
|
# Update ip
|
|
|
|
sudo vim /etc/netplan/01-netcfg.yaml
|
|
sudo netplan apply
|
|
|
|
# Check DNS servers
|
|
resolvectl status
|
|
|
|
## Block IP
|
|
|
|
# Ban a single IP for 1 year
|
|
kubectl exec -n crowdsec deployment/crowdsec-lapi -- \
|
|
cscli decisions add --ip 1.2.3.4 --duration 8760h --reason "manual-ban"
|
|
|
|
# Ban a subnet
|
|
kubectl exec -n crowdsec deployment/crowdsec-lapi -- \
|
|
cscli decisions add --range 1.2.3.0/24 --duration 8760h --reason "manual-ban"
|
|
|
|
# List all active decisions (including manual ones)
|
|
kubectl exec -n crowdsec deployment/crowdsec-lapi -- cscli decisions list
|
|
|
|
# Remove a manual ban
|
|
kubectl exec -n crowdsec deployment/crowdsec-lapi -- \
|
|
cscli decisions delete --ip 1.2.3.4
|
|
|
|
|
|
# # Add IPs (comma-separated, supports CIDRs)
|
|
kubectl patch configmap ingress-nginx-controller -n ingress-nginx \
|
|
--type merge \
|
|
-p '{"data":{"block-cidrs-manual":"1.2.3.4,5.6.7.0/24"}}'
|