aboutsummaryrefslogtreecommitdiff
path: root/security
AgeCommit message (Collapse)Author
2019-09-08Fix various typos and grammatical errors (#141)ebiggers
These were found by a combination of manual review and a custom script that checks for common errors. Also removed an outdated sentence from the comment for setupBefore().
2018-09-02feat(spell-check): add make command for spell check.Deepesh Pathak
* Remove spelling mistakes in the repository * Add travis script to check for typos. * Add command to Makefile to check for typos. * Fixes #71
2018-08-23Ensure keyring privilege changes are reversibleJoe Richey joerichey@google.com
This change makes sure that, when we set the ruid and euid in order to get the user keyring linked into the current process keyring, we will always be able to reverse these changes (using a suid of 0). This fixes an issue where "su <user>" would result in a system error when called by an unprivileged user. It also explains exactly how and why we are making these privilege changes.
2018-08-23Ensure setting user privileges is reversibleJoe Richey joerichey@google.com
This change makes sure after dropping then elevating privileges for a process, the euid, guid, and groups are all the same as they were originally. This significantly simplifies the privilege logic. This fixes CVE-2018-6558, which allowed an unprivleged user to gain membership in the root group (gid 0) due to the groups not being properly reset in the process.
2018-03-25security: drop and regain privileges in all threadsEric Biggers
After enabling pam_fscrypt for "session" and creating a directory protected with a login protector, I was no longer able to log in as that user. The problem is that the Go runtime is creating threads after pam_fscrypt drops privileges, but pam_fscrypt is not re-acquiring privileges on those threads because the Go wrappers for setreuid(), setregid(), and setgroups() in the "sys/unix" package are using the raw syscalls which operate on the calling thread only. This violates glibc's assumption that all threads have the same uids and gids, causing it to abort() the process when a later module in the PAM stack (pam_mail in my case) tries to drop privileges using the glibc functions. Fix it by dropping and regaining privileges using the glibc functions rather than the "sys/unix" functions. This also avoids any possibility that privileges could be changed in a thread other than the "main" one for pam_fscrypt, since the Go runtime does not guarantee which OS-level thread runs what. It would be nice to also exit all Go worker threads before returning from pam_fscrypt, but the Go runtime doesn't seem to support that.
2018-02-11test: all packages should have testsJoseph Richey
The tests added in this change are trivial, but they make sure that every package has a non-zero number of tests. This is important for eventually increasing test coverage.
2017-10-02security: Sync filesystem before dropping cachesJoe Richey joerichey@google.com
2017-09-29Fix lintJoseph Richey
2017-09-29security: Add check option to UserKeyringIDJoseph Richey
2017-09-01security: Change user keyring lookup algorithmJoseph Richey
Now instead of spawning a seperate thread we alternate between changing the euid and ruid to both find the keyring and link it to the process keyring. Note that we also ensure that the user keyring is linked into the root keyring whenever possible.
2017-09-01security: No more permenant privilege droppingJoseph Richey
This was creating an issue becasuse fully dropping privileges required spawning a goroutine and using rutime.DropOSThread().
2017-08-31security: Error if privilege reset goes wrongJoe Richey
2017-08-31Fixed linter issuesJoe Richey
2017-08-30security: Rewrite of keryings and permissionsJoe Richey
The keyring lookup functions no longer read from /proc/keys. Now they simply spawn a thread, drop privs, and check with GetKeyringID and KEY_SPEC_USER_KEYRING. See userKeyringID() for more info. The privileges functions have also been changed. Now the concept of setting privileges is seperate form the concept of setting up the keyrings.
2017-08-23security: fscrypt now possesses the user keyringJoseph Richey
2017-08-23Added some documentation and improved security APIJoe Richey joerichey@google.com
2017-08-22security: Moved cache dropping functionJoe Richey joerichey@google.com
2017-08-22security: Fixed typo and improved error handlingJoe Richey joerichey@google.com
2017-08-17cmd/fscrypt: purge command now clears cacheJoe Richey joerichey@google.com