class: center, middle
### Small. Simple.
Secure
Natanael Copa (@n_copa) natanael.copa@docker.com --- ### Original design goal - to run diskless - install from scratch to ram-disk (tmpfs) at bootup. ### Usecases - router, firewall, vpn, proxy, voip ### Later also - containers (Docker FTW!), servers, desktop? --- ### Small - reduces attack surface (Docker images: ubuntu=120MB, alpine=4MB) ### Simple - don't install/start things unless explicitly asked for - reduced complexity leads to fewer bugs ### Secure - Hardened kernel - Hardened toolchain --- ## Hardened kernel - Grsecurity/PaX (unofficial fork) - enforce non-executable pages - PAGEEXEC, MPROTECT, EMUTRAMP - Address Space Layout Randomizaion (ASLR) - RANDUSTACK, RANDMMAP - Reuse Attack Protector (RAP) - Misc memory protections - REFCOUNT, MEMORY_STRUCTLEAK ### More useful with userspace: - Position Independent Executable (PIE) - Full Relocation Read-Only (RELRO) -Wl,-z,relro,-z,now --- ## Hardened toolchain Enabled by default: - PIE (incl. static) - -Wl,-z,relro,-z,now - -fstack-protector-strong - -DFORTIFY_SOURCE=2 --- ## musl libc > a new standard library . . . > musl is lightweight, fast, simple, free, and strives to be _correct_ in the > sense of standards-conformance and safety. - https://www.musl-libc.org/ - clean, modern codease - small (580kb - 5% of glibc) --- ### "correct in the sense of ... safety" #### unified libc/libpthread/ldso - atomic upgrades #### Thread-local Storage (TLS) - reserve all storage at time when failure is reportable - dlclose() is a NOP #### No utmp/wtmp - stubs only - requires suid/sgid to work properly #### Other examples - getmntent_r() returns failure instead of truncate lines --- ## What about tracking and fixing CVE's? - yes we do that - Effective security shouldn't depend on hoping the "bad guys" don't have early access to vulnerability information --- ## The future #### in progress - build in containers - apk rewrite (implement ideas from TUF, get rid of SHA1) - better support for safer languages as Go and Rust #### needs help - suid executbles (main repo has 32. community has 17) - automatic testing - code reviews - llvm/clang by default (CFI) - default thread stack size? --- ## Questions?