<feed xmlns='http://www.w3.org/2005/Atom'>
<title>fscrypt.git/security/privileges.go, branch v0.3.2</title>
<subtitle>Go tool for managing Linux filesystem encryption
</subtitle>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/'/>
<entry>
<title>privileges.go: remove a stale comment (#184)</title>
<updated>2020-01-23T21:42:10+00:00</updated>
<author>
<name>ebiggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2020-01-23T21:42:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=6e4e557ca6f879627d877a4fc3815203a103e4ff'/>
<id>6e4e557ca6f879627d877a4fc3815203a103e4ff</id>
<content type='text'>
The workaround for Go versions before 1.10 was already removed by
commit 3022c1603d96 ("Ensure setting user privileges is reversible").</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The workaround for Go versions before 1.10 was already removed by
commit 3022c1603d96 ("Ensure setting user privileges is reversible").</pre>
</div>
</content>
</entry>
<entry>
<title>Add keyring package</title>
<updated>2020-01-05T18:02:13+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2019-12-16T03:31:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=462d166d5355d33a05271d24de4d52f30dd62f67'/>
<id>462d166d5355d33a05271d24de4d52f30dd62f67</id>
<content type='text'>
In preparation for introducing support for the new filesystem-level
keyrings, move the existing user keyring management code from
security/keyring.go and crypto/crypto.go into a new package, 'keyring'.

This package provides functions AddEncryptionKey, RemoveEncryptionKey,
and GetEncryptionKeyStatus which delegate to either the filesystem
keyring (added by a later patch) or to the user keyring.  This provides
a common interface to both types of keyrings, to the extent possible.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In preparation for introducing support for the new filesystem-level
keyrings, move the existing user keyring management code from
security/keyring.go and crypto/crypto.go into a new package, 'keyring'.

This package provides functions AddEncryptionKey, RemoveEncryptionKey,
and GetEncryptionKeyStatus which delegate to either the filesystem
keyring (added by a later patch) or to the user keyring.  This provides
a common interface to both types of keyrings, to the extent possible.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix various typos and grammatical errors (#141)</title>
<updated>2019-09-09T02:46:59+00:00</updated>
<author>
<name>ebiggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2019-09-09T02:46:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=6445dad7d66fa6a1867090fcd9602c98863649f6'/>
<id>6445dad7d66fa6a1867090fcd9602c98863649f6</id>
<content type='text'>
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().</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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().</pre>
</div>
</content>
</entry>
<entry>
<title>feat(spell-check): add make command for spell check.</title>
<updated>2018-09-01T19:47:27+00:00</updated>
<author>
<name>Deepesh Pathak</name>
<email>deepshpathak@gmail.com</email>
</author>
<published>2018-09-01T19:47:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=f270dfadb9af9e81ae4c884a3ea45ca4618a7a05'/>
<id>f270dfadb9af9e81ae4c884a3ea45ca4618a7a05</id>
<content type='text'>
* Remove spelling mistakes in the repository
* Add travis script to check for typos.
* Add command to Makefile to check for typos.
* Fixes #71
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Remove spelling mistakes in the repository
* Add travis script to check for typos.
* Add command to Makefile to check for typos.
* Fixes #71
</pre>
</div>
</content>
</entry>
<entry>
<title>Ensure keyring privilege changes are reversible</title>
<updated>2018-08-23T18:00:34+00:00</updated>
<author>
<name>Joe Richey joerichey@google.com</name>
<email>joerichey@google.com</email>
</author>
<published>2018-08-22T12:23:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=315f9b042237200174a1fb99427f74027e191d66'/>
<id>315f9b042237200174a1fb99427f74027e191d66</id>
<content type='text'>
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 &lt;user&gt;" 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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;user&gt;" 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.
</pre>
</div>
</content>
</entry>
<entry>
<title>Ensure setting user privileges is reversible</title>
<updated>2018-08-23T18:00:34+00:00</updated>
<author>
<name>Joe Richey joerichey@google.com</name>
<email>joerichey@google.com</email>
</author>
<published>2018-08-22T12:17:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=3022c1603d968c22f147b4a2c49c4637dd1be91b'/>
<id>3022c1603d968c22f147b4a2c49c4637dd1be91b</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>security: drop and regain privileges in all threads</title>
<updated>2018-03-25T17:22:39+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2018-03-25T17:13:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=aa88bf4527cced6e3e16ca3e5ae07076cc8217f0'/>
<id>aa88bf4527cced6e3e16ca3e5ae07076cc8217f0</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>security: No more permenant privilege dropping</title>
<updated>2017-09-01T07:50:42+00:00</updated>
<author>
<name>Joseph Richey</name>
<email>joerichey94@gmail.com</email>
</author>
<published>2017-09-01T07:50:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=d5f64c1ecd8f13f01681d0a18b8f3174ff9bd225'/>
<id>d5f64c1ecd8f13f01681d0a18b8f3174ff9bd225</id>
<content type='text'>
This was creating an issue becasuse fully dropping privileges required
spawning a goroutine and using rutime.DropOSThread().
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This was creating an issue becasuse fully dropping privileges required
spawning a goroutine and using rutime.DropOSThread().
</pre>
</div>
</content>
</entry>
<entry>
<title>security: Rewrite of keryings and permissions</title>
<updated>2017-08-31T00:51:05+00:00</updated>
<author>
<name>Joe Richey</name>
<email>joerichey@google.com</email>
</author>
<published>2017-08-31T00:51:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=7888645ab68ed0510ff66121f35630b11976a09f'/>
<id>7888645ab68ed0510ff66121f35630b11976a09f</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>security: Moved cache dropping function</title>
<updated>2017-08-22T19:53:26+00:00</updated>
<author>
<name>Joe Richey joerichey@google.com</name>
<email>joerichey@google.com</email>
</author>
<published>2017-08-22T19:52:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.hodgden.net/cgit.cgi/fscrypt.git/commit/?id=32c9be59a2485ef44ac4b3accc2f102cf2eb5a39'/>
<id>32c9be59a2485ef44ac4b3accc2f102cf2eb5a39</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
