{"id":26099262,"url":"https://github.com/desbma/shh","last_synced_at":"2026-03-07T22:08:12.237Z","repository":{"id":212872759,"uuid":"695187360","full_name":"desbma/shh","owner":"desbma","description":"Systemd Hardening Helper - Automatic systemd service hardening guided by strace profiling","archived":false,"fork":false,"pushed_at":"2026-03-01T22:17:26.000Z","size":4748,"stargazers_count":346,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-03-02T01:35:42.389Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/desbma.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2023-09-22T14:44:22.000Z","updated_at":"2026-03-01T01:33:54.000Z","dependencies_parsed_at":"2023-12-16T23:52:14.212Z","dependency_job_id":"18da01ee-1f8a-424d-922d-59172b0f9ca2","html_url":"https://github.com/desbma/shh","commit_stats":null,"previous_names":["desbma/shh"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/desbma/shh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desbma%2Fshh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desbma%2Fshh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desbma%2Fshh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desbma%2Fshh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/desbma","download_url":"https://codeload.github.com/desbma/shh/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desbma%2Fshh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30233432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T19:01:10.287Z","status":"ssl_error","status_checked_at":"2026-03-07T18:59:58.103Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-09T16:01:44.774Z","updated_at":"2026-03-07T22:08:12.220Z","avatar_url":"https://github.com/desbma.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# SHH (Systemd Hardening Helper)\n\n[![CI status](https://github.com/desbma/shh/actions/workflows/ci.yml/badge.svg)](https://github.com/desbma/shh/actions)\n[![crates.io version](https://img.shields.io/crates/v/systemd-hardening-helper)](https://crates.io/crates/systemd-hardening-helper)\n[![AUR version](https://img.shields.io/aur/version/shh.svg?style=flat)](https://aur.archlinux.org/packages/shh/)\n[![License](https://img.shields.io/github/license/desbma/shh.svg?style=flat)](https://github.com/desbma/shh/blob/master/LICENSE)\n\nAutomatic [systemd](https://systemd.io/) service hardening guided by [strace](https://strace.io/) profiling.\n\n[Official repository](https://github.com/desbma/shh) - [Mirror repository](https://github.com/synacktiv/shh)\n\n## Documentation\n\n- High level introduction: [Systemd hardening made easy with SHH](https://www.synacktiv.com/publications/systemd-hardening-made-easy-with-shh)\n- [FAQ](FAQ.md)\n- [Changelog](CHANGELOG.md)\n- [Currently supported systemd options](systemd_options.md)\n\n## Installation\n\n### Dependencies\n\nStrace needs to be installed and its executable available in the path. A recent Strace version is strongly recommended.\n\n### From source\n\nYou need a Rust build environment for example from [rustup](https://rustup.rs/).\n\nRun in the current repository:\n\n```\ncargo build --release\ninstall -Dm 755 -t /usr/local/bin target/release/shh\n```\n\n### From [`crates.io`](https://crates.io/)\n\n```\nsudo cargo install --root /usr/local\n```\n\n### Debian (or Debian based distribution)\n\nSee [GitHub releases](https://github.com/desbma/shh/releases) for Debian packages built for each tagged version.\n\n### Arch Linux\n\nArch Linux users can install the [shh AUR package](https://aur.archlinux.org/packages/shh).\n\n## Usage\n\n### Hardening a service\n\nTo harden a system unit named `SERVICE.service`:\n\n1. Start service profiling: `shh service start-profile SERVICE`. The service will be restarted with strace profiling.\n2. Use the service normally for a while, trying to cover as much features and use cases as possible.\n3. Run `shh service finish-profile SERVICE -a`. The service will be restarted with a hardened configuration built from previous runtime profiling, to allow it to run safely as was observed during the profiling period, and to deny other dangerous system actions.\n\nRun `shh -h` for full command line reference, or append `-h` to a subcommand to get help.\n\nServices running in per-user instances of the service manager (controlled via `systemctl --user ...`) are **not** supported.\n\n\u003e [!WARNING]\n\u003e The hardening options generated by `shh` are by construction **not** portable across different systems.\n\u003e They depend on many factors, and may break the service if any of those change:\n\u003e\n\u003e - the code path covered during profiling\n\u003e - the Linux kernel version\n\u003e - the libc used\n\u003e - the systemd version\n\u003e\n\u003e Reusing options generated by `shh` on a system with a different environment (ie. different Linux distribution) is very likely to break the service.\n\n### Testing locally\n\nIf you want to run a quick test to see what options would be generated, you can use `shh run -- COMMAND`.\n\nCurrent directory and `PATH` environment variable both influence the program execution, reset those first:\n\n```\n$ cd /\nexport PATH=/usr/local/bin:/usr/bin:/bin\n```\n\nThen to see what options would be generated for a `curl https://www.example.com` invocation:\n\n```\n$ shh run -- curl https://www.example.com\n...\n-------- Start of suggested service options --------\nProtectSystem=strict\nProtectHome=true\nPrivateTmp=disconnected\nPrivateDevices=true\nProtectKernelTunables=true\nProtectKernelModules=true\nProtectKernelLogs=true\nProtectControlGroups=true\nProtectProc=ptraceable\nLockPersonality=true\nRestrictRealtime=true\nProtectClock=true\nMemoryDenyWriteExecute=true\nRestrictAddressFamilies=AF_INET AF_INET6 AF_NETLINK AF_UNIX\nSocketBindDeny=ipv4:tcp\nSocketBindDeny=ipv4:udp\nSocketBindDeny=ipv6:tcp\nSocketBindDeny=ipv6:udp\nCapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_BPF CAP_CHOWN CAP_MKNOD CAP_NET_RAW CAP_PERFMON CAP_SYS_BOOT CAP_SYS_CHROOT CAP_SYS_MODULE CAP_SYS_NICE CAP_SYS_PACCT CAP_SYS_PTRACE CAP_SYS_TIME CAP_SYSLOG CAP_WAKE_ALARM\nSystemCallFilter=~@aio:EPERM @chown:EPERM @clock:EPERM @cpu-emulation:EPERM @debug:EPERM @ipc:EPERM @keyring:EPERM @memlock:EPERM @module:EPERM @mount:EPERM @obsolete:EPERM @pkey:EPERM @privileged:EPERM @raw-io:EPERM @reboot:EPERM @resources:EPERM @sandbox:EPERM @setuid:EPERM @swap:EPERM @sync:EPERM @timer:EPERM\n-------- End of suggested service options --------\n```\n\nOr to sandbox as much as possible:\n\n```\n$ shh run --mode aggressive --filesystem-whitelisting --network-firewalling -- curl https://www.example.com -o /dev/null\n...\n-------- Start of suggested service options --------\nProtectSystem=strict\nProtectHome=true\nPrivateTmp=disconnected\nPrivateDevices=true\nProtectKernelTunables=true\nProtectKernelModules=true\nProtectKernelLogs=true\nProtectControlGroups=true\nProtectProc=ptraceable\nLockPersonality=true\nRestrictRealtime=true\nProtectClock=true\nMemoryDenyWriteExecute=true\nSystemCallArchitectures=native\nReadOnlyPaths=-/\nReadWritePaths=-/dev\nInaccessiblePaths=-/boot -/home -/lost+found -/media -/mnt -/opt -/root -/srv -/sys -/tmp -/var\nTemporaryFileSystem=/usr:ro\nBindReadOnlyPaths=-/usr/bin -/usr/lib -/usr/lib64 -/usr/local -/usr/share\nNoExecPaths=-/\nExecPaths=-/usr/bin/curl -/usr/lib/x86_64-linux-gnu\nRestrictAddressFamilies=AF_INET AF_INET6 AF_NETLINK AF_UNIX\nSocketBindDeny=ipv4:tcp\nSocketBindDeny=ipv4:udp\nSocketBindDeny=ipv6:tcp\nSocketBindDeny=ipv6:udp\nIPAddressDeny=any\nIPAddressAllow=[redacted]\nCapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_BPF CAP_CHOWN CAP_MKNOD CAP_NET_RAW CAP_PERFMON CAP_SYS_BOOT CAP_SYS_CHROOT CAP_SYS_MODULE CAP_SYS_NICE CAP_SYS_PACCT CAP_SYS_PTRACE CAP_SYS_TIME CAP_SYSLOG CAP_WAKE_ALARM\nSystemCallFilter=~@aio:EPERM @chown:EPERM @clock:EPERM @cpu-emulation:EPERM @debug:EPERM @ipc:EPERM @keyring:EPERM @memlock:EPERM @module:EPERM @mount:EPERM @obsolete:EPERM @pkey:EPERM @privileged:EPERM @raw-io:EPERM @reboot:EPERM @resources:EPERM @sandbox:EPERM @setuid:EPERM @swap:EPERM @sync:EPERM @timer:EPERM\n-------- End of suggested service options --------\n```\n\n## License\n\n[GPLv3](https://www.gnu.org/licenses/gpl-3.0-standalone.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdesbma%2Fshh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdesbma%2Fshh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdesbma%2Fshh/lists"}