From 894afa96cd14a84cd1a1bcfb9523f10210aebb7c Mon Sep 17 00:00:00 2001 From: Dante Catalfamo Date: Mon, 18 Oct 2021 17:36:47 -0400 Subject: bsd-auth: no longer WIP --- .../WIP-how-bsd-authentication-works/index.org | 2811 -------------------- 1 file changed, 2811 deletions(-) delete mode 100644 content/posts/WIP-how-bsd-authentication-works/index.org (limited to 'content/posts/WIP-how-bsd-authentication-works/index.org') diff --git a/content/posts/WIP-how-bsd-authentication-works/index.org b/content/posts/WIP-how-bsd-authentication-works/index.org deleted file mode 100644 index f0623c2..0000000 --- a/content/posts/WIP-how-bsd-authentication-works/index.org +++ /dev/null @@ -1,2811 +0,0 @@ -#+TITLE: How BSD Authentication Works -#+DATE: 2021-10-18T17:27:13-04:00 -#+DRAFT: true -#+SHOWTOC: true -#+DESCRIPTION: A walkthrough of how OpenBSD's BSD Auth framework functions -#+TAGS[]: openbsd security -#+KEYWORDS[]: openbsd security -#+SLUG: -#+SUMMARY: - -#+ATTR_HTML: :title OpenBSD Internals -#+ATTR_HTML: :alt OpenBSD mascot cutaway view with spinning gears inside -[[file:openbsd_internals.gif]] - -* History - :PROPERTIES: - :CUSTOM_ID: history - :END: - - The way OpenBSD authenticates users is quite different from other - Unix-like operating systems. Most other systems like AIX, Solaris, - Linux, the other BSDs, and MacOS, use a framework called [[https://en.wikipedia.org/wiki/Pluggable_authentication_module][Pluggable - Authentication Module]] (PAM). The two main implementations are [[http://www.linux-pam.org/][Linux - PAM]] and [[https://www.openpam.org/][OpenPAM]]. PAM modules are created as dynamically loaded - shared objects, which communicate using a combination of common and - implementation specific interfaces ([[https://linux.die.net/man/3/pam][Linux-PAM]] and [[https://www.freebsd.org/cgi/man.cgi?query=pam&apropos=0&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports&arch=default&format=html][OpenPAM]]). It's - configured using the [[https://linux.die.net/man/5/pam.d][pam.d]] directory and [[https://www.freebsd.org/cgi/man.cgi?query=pam.conf&sektion=5&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports][pam.conf]] file. While it can - be flexible, it's highly complex and very easy to mis-configure, - leaving you open to strange and hard to track down authentication - bugs. On top of that, the fact that it's a shared library means that - any vulnerability in a poorly vetted authentication module gives - attackers direct access to the internals of your application. Author - Michael W. Lucas said it best when he described PAM as - [[https://www.youtube.com/watch?v=-CXp3byvI1g][unstandardized black magic]]. - - OpenBSD on the other hand uses a mechanism called BSD - Authentication. It was originally developed for a now-defunct - proprietary operating system called [[https://en.wikipedia.org/wiki/BSD/OS][BSD/OS]] by [[https://en.wikipedia.org/wiki/Berkeley_Software_Design][Berkeley Software - Design Inc.]], who later donated the system. It was then adopted by - OpenBSD in release 2.9. BSD Auth is comparatively much simpler than - PAM. Modules or, authentication "styles", are instead stand alone - applications or scripts that communicate over IPC. The module has no - ability to interfere with the parent and can very easily revoke - permissions using [[https://man.openbsd.org/pledge][=pledge(2)=]] or [[https://man.openbsd.org/unveil][=unveil(2)=]]. The BSD Authentication - system of configured through [[https://man.openbsd.org/login.conf][=login.conf(5)=]]. - -* Documentation - :PROPERTIES: - :CUSTOM_ID: documentation - :END: - - All of the high level authentication functions are described in - [[https://man.openbsd.org/authenticate][=authenticate(3)=]], with the lower level functions being described in - [[https://man.openbsd.org/auth_subr][=auth_subr(3)=]]. - - Click on any function prototype in this post to see its definition. - - I've also created a [[#graph][graph]] at the bottom of the post to help - visualize the function calls. - - All code snippets from this blog post belong to the OpenBSD - contributors. Please see the [[#copyright][Copyright]] section for details. - -* BSD Auth Modules - :PROPERTIES: - :CUSTOM_ID: modules - :END: - - Modules are located in =/usr/libexec/auth/= with the naming - convention =login_ -#+end_export -- cgit v1.2.3