{"id":26708199,"url":"https://github.com/reznetdevops/ansible-k8s-node-sec","last_synced_at":"2025-10-12T19:36:13.613Z","repository":{"id":284610575,"uuid":"955500426","full_name":"rezNetDevOps/ansible-k8s-node-sec","owner":"rezNetDevOps","description":"Kubernetes Node Security Hardening by Ansible","archived":false,"fork":false,"pushed_at":"2025-03-26T22:43:16.000Z","size":41,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-12T19:36:08.710Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rezNetDevOps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-26T18:28:50.000Z","updated_at":"2025-09-30T16:38:21.000Z","dependencies_parsed_at":"2025-03-26T19:46:02.798Z","dependency_job_id":null,"html_url":"https://github.com/rezNetDevOps/ansible-k8s-node-sec","commit_stats":null,"previous_names":["reznetdevops/ansible-k8s-node-sec"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rezNetDevOps/ansible-k8s-node-sec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rezNetDevOps%2Fansible-k8s-node-sec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rezNetDevOps%2Fansible-k8s-node-sec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rezNetDevOps%2Fansible-k8s-node-sec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rezNetDevOps%2Fansible-k8s-node-sec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rezNetDevOps","download_url":"https://codeload.github.com/rezNetDevOps/ansible-k8s-node-sec/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rezNetDevOps%2Fansible-k8s-node-sec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279012670,"owners_count":26085159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-27T07:17:18.078Z","updated_at":"2025-10-12T19:36:13.578Z","avatar_url":"https://github.com/rezNetDevOps.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kubernetes Node Security Hardening\n\nThis Ansible project implements security best practices for Kubernetes nodes based on industry standards. It helps secure the Linux hosts running Kubernetes components without disrupting running services.\n\n## Features\n\n- **SSH Hardening**: Secures SSH configuration, disables root login, enforces key-based authentication\n- **Admin User Setup**: Creates a dedicated admin user with appropriate permissions\n- **Firewall Configuration**: Sets up UFW with appropriate rules for Kubernetes services\n- **Kernel Hardening**: Applies secure kernel parameters suitable for Kubernetes\n- **Audit Logging**: Configures auditd for system event logging\n- **Fail2ban**: Protects against brute-force attacks\n- **Container Runtime Security**: Secures containerd with appropriate settings\n\n## Requirements\n\n- Ansible 2.9+ (use the provided Docker wrapper if you don't have Ansible installed)\n- SSH access to the Kubernetes nodes\n- Root or sudo access on the target nodes\n\n## Usage\n\n### Using the Docker Wrapper (Recommended)\n\nThe easiest way to run this playbook is using the provided Docker wrapper script:\n\n```bash\n./run-with-docker.sh --private-key=~/.ssh/id_ed25519 --user=root\n```\n\n### Manual Execution\n\nIf you have Ansible installed locally, you can run the playbook directly:\n\n```bash\nansible-playbook k8s-security.yml -i inventory/hosts.ini --private-key=~/.ssh/id_ed25519 --user=root\n```\n\n### Options\n\n- Run against specific nodes or groups:\n  ```bash\n  ./run-with-docker.sh --limit=kube-node-1 --private-key=~/.ssh/id_ed25519 --user=root\n  ```\n\n- Run specific role tags only:\n  ```bash\n  ./run-with-docker.sh --tags=ssh_hardening,firewall --private-key=~/.ssh/id_ed25519 --user=root\n  ```\n\n- Test mode (dry run):\n  ```bash\n  ./run-with-docker.sh --check --private-key=~/.ssh/id_ed25519 --user=root\n  ```\n\n## Important Notes\n\n1. Always test in `--check` mode before applying changes to production systems\n2. Ensure you have backup access methods in case SSH configuration changes lock you out\n3. Review the variables in `vars/main.yml` to customize the security settings for your environment\n4. Make sure your kubernetes services and networking remain functional after applying security hardening\n\n## License\n\nMIT\n\n## References\n\n- [Kubernetes Security Checklist](https://kubernetes.io/docs/concepts/security/security-checklist/)\n- [NSA \u0026 CISA Kubernetes Hardening Guide](https://www.nsa.gov/portals/75/documents/what-we-do/cybersecurity/professional-resources/ctr-kubernetes-hardening-guidance.pdf)\n- [CIS Kubernetes Benchmark](https://www.cisecurity.org/benchmark/kubernetes/) ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freznetdevops%2Fansible-k8s-node-sec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freznetdevops%2Fansible-k8s-node-sec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freznetdevops%2Fansible-k8s-node-sec/lists"}