Sachin Chaurasiya

Toolbox · Security

Security Commands

Scanners, secrets checks, hashes, keys and quick posture checks you can run from any terminal.

Last reviewed
2026-09-18
On this page

Scanning

CommandPurpose
trivy image --severity HIGH,CRITICAL --ignore-unfixed --exit-code 1 img:tagImage gate
trivy fs --scanners vuln,secret,misconfig .Repo scan
trivy k8s --report summaryCluster posture
grype sbom:app.cdx.json --only-fixed --fail-on highSBOM scan
syft img:tag -o cyclonedx-json=app.cdx.jsonGenerate SBOM
gitleaks git --redact --exit-code 1 .Secrets in history
semgrep scan --config p/default --errorSAST
kube-bench run --targets nodeCIS checks
docker run --rm -t ghcr.io/zaproxy/zaproxy:stable zap-baseline.py -t https://staging.example.comDAST baseline

Hashes, keys, certificates

CommandPurpose
sha256sum file / shasum -a 256 fileChecksum
openssl rand -base64 32Random secret
ssh-keygen -t ed25519 -C "ci@example.com"SSH key
ssh-keygen -lf key.pubFingerprint
gpg --verify file.sig fileVerify signature
cosign verify --certificate-identity-regexp '…' --certificate-oidc-issuer https://gitlab.com img@sha256:…Verify image signature
openssl x509 -in cert.pem -noout -datesCertificate validity

Host posture

CommandPurpose
ss -tulpnWhat is listening
sudo find / -perm -4000 -type f 2>/dev/nullSUID binaries
find / -xdev \( -perm -o+w \) -type f 2>/dev/null | headWorld-writable files
sudo awk -F: '($2 == "") {print $1}' /etc/shadowAccounts without a password
grep -E '^PermitRootLogin|^PasswordAuthentication' /etc/ssh/sshd_configSSH hardening flags
sudo journalctl -u sshd --since today | grep -i failedFailed logins
last -a | headRecent logins

Kubernetes quick checks

CommandPurpose
kubectl get pods -A --as=system:anonymousAnonymous access check (expect Forbidden)
kubectl get pods -A -o json | jq -r '.items[] | select(.spec.containers[].securityContext.privileged==true) | .metadata.name'Privileged pods
kubectl get clusterrolebindings -o json | jq -r '.items[] | select(.roleRef.name=="cluster-admin") | .metadata.name'cluster-admin bindings
kubectl get ns -o custom-columns='NAME:.metadata.name,PSS:.metadata.labels.pod-security\.kubernetes\.io/enforce'Pod Security enforcement per namespace