简体   繁体   English

从头开始硬化的BSD

[英]Hardened BSD from Scratch

I am aware of the Hardened Linux from Scratch project which is a project that provides you with step-by-step instructions for building your own customized and hardened Linux system entirely from source. 我知道ScratchHardened Linux项目是一个项目,该项目为您提供了逐步说明,以完全从源代码构建自己的定制和强化Linux系统。 I would like to know what is the equivalent in BSD? 我想知道BSD中的等效功能是什么?

As Richard said OpenBSD is definitely worth a go, it is my #1 choice for everything that is dedicated for firewalls and gateways. 正如Richard所说,OpenBSD绝对值得一试,对于专用于防火墙和网关的所有产品,这是我的第一选择。 For other services I tend to stick to FreeBSD although there is no obvious reason for it just a personal preference. 对于其他服务,我倾向于使用FreeBSD,尽管没有明显的理由使它只是个人喜好。

But I would like to point out that the from 'scratch part' concept if you want to do more secure hosting of a service can be much better done using Jails . 但是我想指出的是,如果您想对服务进行更安全的托管,那么从零开始的概念可以使用Jails更好地完成。 In essence you create a limited FreeBSD environment on an a full FreeBSD install. 本质上,您在完整的FreeBSD安装上创建了一个受限的FreeBSD环境。 In that limited environment you only copy/link those binaries and files that the service requires to run. 在这种有限的环境中,您仅复制/链接服务运行所需的那些二进制文件和文件。

Because the hosted service has no access to any other files/binaries, all the potential security flaws in those things aren't open to exploit. 由于托管服务无法访问任何其他文件/二进制文件,因此这些漏洞中的所有潜在安全漏洞都无法利用。 If by chance your application gets 'rooted' it will not go beyond the boundaries of the jail. 如果您的应用程序被“扎根”,它将不会超出监狱的范围。

See it like a sandbox on steroids with neglectable performance penalties. 看到它就像是对类固醇的沙盒,性能损失可忽略不计。

OpenBSD is hardened "by default" from the installation. 默认情况下,OpenBSD从安装中进行了加固。 Only the admin opens it up... component by component. 只有管​​理员才能将其打开...逐个组件。

[UPDATE] while I have not read the document for hardening linux... some of the same things might apply... for example they both use OpenSSH so the strategies would be the same. [更新]虽然我还没有阅读用于增强linux的文档...某些相同的事情可能适用...例如,它们都使用OpenSSH,所以策略将是相同的。 So where there is module overlap the same would apply. 因此,如果有模块重叠,则同样适用。

You don't really do bsd 'from scratch'. 您并不是真的从头开始bsd。 All of the major projects come with a complete system in a single source repository so you're not grabbing a kernel from here, binutils and compiler from over there and c libraries and standard utilities from somewhere else and X from yet another place. 所有主要项目都在一个源存储库中带有一个完整的系统,因此您不必从这里获取内核,从那里获取binutils和编译器,也不必从其他地方获取c库和标准实用程序,而从另一个地方获取X。

They are generally easier to get all the source for and to rebuild the entire system than your average linux distro, but that's not really customizing anything. 与一般的Linux发行版相比,它们通常更容易获取所有源代码并重建整个系统,但这实际上并不是自定义任何内容。

You could try to do something nuts, like perhaps trying to get the OpenBSD userland to run on a NetBSD kernel with FreeBSD ports, but you'd be on your own and it certainly wouldn't be 'hardened'. 您可以尝试做一些疯狂的事情,例如尝试使OpenBSD用户域在具有FreeBSD端口的NetBSD内核上运行,但是您将自己行事,而且它肯定不会被“强化”。

HardenedBSD is a fork of the FreeBSD project with the aim of implementing PIE, RELRO, SAFESTACK, CFIHARDEN. HardenedBSD是FreeBSD项目的一个分支,旨在实施PIE,RELRO,SAFESTACK和CFIHARDEN。 Some goals are there, others are extreme-WIP. 这里有一些目标,另一些是极端在制品。 I wouldn't consider it as "ready for production" yet, but usable as desktop (also depends on production env requirements). 我还不认为它可以“投入生产”,但可以用作台式机(还取决于生产环境的要求)。

Repo: https://github.com/HardenedBSD 回购: https : //github.com/HardenedBSD

Everything, including "make buildworld/buildkernel" is the same as on FreeBSD and the Handbook does a good job of explaining this. 包括“ make buildworld / buildkernel”在内的所有内容都与FreeBSD上的相同,并且手册对此做了很好的解释。 You'll have a bit of reading to do though even coming from linux-land. 即使来自linux-land,您也需要做一些阅读工作。 Building your own ports is an entire topic in it's self. 建立自己的端口是一个完整的主题。

Re jails, the statement is not entirely correct. 牢狱之灾,这一说法并不完全正确。 While certainly adding an important security layer, Unix systems (IDK about Linux) [quoting here] "lack kernel exploit mitigations. If an attacker gains access to a jail, it's not too much work to pivot to other jails or escalate privileges via a kernel exploit." 虽然无疑增加了重要的安全层,但Unix系统(关于Linux的IDK)在缓解内核漏洞利用方面没有优势。如果攻击者获得了进入监狱的权限,那么通过内核转移到其他监狱或提升特权的工作就不会太多。利用。” Don't misunderstand me, I place almost every service in a jail as much possible. 别误会我,我几乎将所有服务都投入了监狱。

As to "Hardened by default" comment: It's all in the sysctl settings which can be tweaked on every *BSD flavor, but sec measures are pretty much useless if the sysadmin does not take time to read the docs. 至于“默认情况下已硬化”的注释:都是在sysctl设置中进行的,可以在每种* BSD风格上进行调整,但是如果sysadmin不花时间阅读文档,则秒措施几乎没有用。

If you are interested, your homework: https://www.freebsd.org/doc/handbook/ 如果您有兴趣,请做作业: https : //www.freebsd.org/doc/handbook/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM