{"id":13929154,"url":"https://github.com/thomasfricke/container-hardening","last_synced_at":"2025-07-19T11:30:56.793Z","repository":{"id":45443823,"uuid":"436344313","full_name":"thomasfricke/container-hardening","owner":"thomasfricke","description":"scripts which help harden containers","archived":false,"fork":false,"pushed_at":"2022-10-17T14:49:28.000Z","size":25,"stargazers_count":28,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-08T18:21:49.597Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomasfricke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-08T18:02:27.000Z","updated_at":"2023-04-18T13:46:26.000Z","dependencies_parsed_at":"2023-01-20T02:30:44.839Z","dependency_job_id":null,"html_url":"https://github.com/thomasfricke/container-hardening","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasfricke%2Fcontainer-hardening","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasfricke%2Fcontainer-hardening/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasfricke%2Fcontainer-hardening/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasfricke%2Fcontainer-hardening/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasfricke","download_url":"https://codeload.github.com/thomasfricke/container-hardening/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226597608,"owners_count":17657177,"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","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":"2024-08-07T18:02:09.166Z","updated_at":"2024-11-26T18:30:29.437Z","avatar_url":"https://github.com/thomasfricke.png","language":"Dockerfile","funding_links":[],"categories":["others"],"sub_categories":[],"readme":"# container-hardening\n\nThe `harden` scripts help to harden containers. It needs do be used inside the `Dockerfile`.\n\nF.e. hardening `nginx:alpine`\n\n\n```Dockerfile\n\nFROM nginx:alpine as origin\n\nADD harden /harden\n\nRUN mkdir /tmp/harden\n\nRUN ./harden -d /usr/sbin/nginx \\\n             -f /etc/nginx  /var/log/nginx/ /var/run/nginx.pid /var/cache/nginx  /etc/passwd /etc/group \\\n                /usr/share/nginx /usr/share/licenses/ /var/run \\\n             -c /var/log/nginx/ /var/cache/nginx /var/run\n\nFROM scratch\n\nCOPY --from=origin /tmp/harden/ /\n\nENTRYPOINT [\"/usr/sbin/nginx\",\"-g\",\"daemon off;\"]\n\n```\n\nThe usage \n\n```bash\nharden [-x] -d \u003cdynamically linked\u003e -f \u003cfiles and dirs\u003e -r \u003cfiles to remove\u003e -u user \u003cfiles to chown to user\u003e -c \u003cchmod to be world writable\u003e\" \n      -x Activates debugging\n      -d Files are considered dynamically linked\n         All library dependencies are resolved using ldd and necessary file are included\n      -f Files and directories to include. Don't forget the license files\n      -r Files to be removed before copying, especially log files\n      -u User:Group files should be chowned to, access right will be set to rw for the user\n      -c chmod go+rw to all the files in this section\n\n      The container needs a usable version of sh, ldd, sed, rm and uniq\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasfricke%2Fcontainer-hardening","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasfricke%2Fcontainer-hardening","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasfricke%2Fcontainer-hardening/lists"}