2018-04-01 23:18:29 +00:00
[![Build Status ](https://travis-ci.org/pampanic/pam_panic.svg?branch=master )](https://travis-ci.org/pampanic/pam_panic)
2018-04-01 23:16:41 +00:00
[![Codacy Badge ](https://api.codacy.com/project/badge/Grade/001445f05a4e47bcad151c2f6a05a29c )](https://app.codacy.com/app/pampanic/pam_panic?utm_source=github.com& utm_medium=referral& utm_content=pampanic/pam_panic& utm_campaign=badger)
2018-04-01 23:18:29 +00:00
# pam\_panic
2018-03-29 02:38:48 +00:00
2018-03-27 01:32:29 +00:00
## Purpose
2018-04-01 00:31:27 +00:00
pam\_panic is a PAM module that protects sensitive data and provides a panic function for emergency situations.
2018-03-27 01:32:29 +00:00
2018-03-31 23:53:41 +00:00
2018-03-27 02:20:16 +00:00
## How it works
2018-04-03 03:00:18 +00:00
You can choose from one of two options:
2018-03-31 23:53:41 +00:00
2018-05-15 10:03:28 +00:00
### Using two removable media previous your own password
2018-03-28 19:42:14 +00:00
There are two removable media which work as keys: the auth key and the panic key. The auth key will let you pass to the password prompt whereas the panic key, if provided, will securely erase the LUKS header, rendering the data unreadable.
2018-03-27 01:32:29 +00:00
2018-03-31 23:53:41 +00:00
### Using two passwords previous your own password
There are two passwords you are able to set: the key password and the panic password. The key password will let you pass to the original password prompt whereas the panic password, if provided, will securely erase the LUKS header, rendering the data unreadable.
2018-03-27 01:32:29 +00:00
## Installation
2018-09-21 20:23:59 +00:00
### Arch Linux AUR
There is
- [pam_panic ](https://aur.archlinux.org/packages/pam_panic/ ) - Actual [releases ](https://github.com/pampanic/pam_panic/releases ) and
- [pam_panic-git ](https://aur.archlinux.org/packages/pam_panic-git/ ) for this actual git repository.
2018-05-14 10:55:16 +00:00
2018-05-18 10:31:36 +00:00
### Ubuntu
2018-09-21 20:23:59 +00:00
There's a [PPA ](https://launchpad.net/~bandie/+archive/ubuntu/pampanic ) updating for new [releases ](https://github.com/pampanic/pam_panic/releases ).
2018-05-18 10:31:36 +00:00
To install the package using the PPA:
```
sudo add-apt-repository ppa:bandie/pampanic
sudo apt-get update
sudo apt-get install pampanic
```
2018-05-14 10:55:16 +00:00
### From sources
2018-03-28 19:42:14 +00:00
You will need GCC or similar, as well as the PAM headers. Some distributions package the PAM headers as `libpam0g-dev` .
2018-05-14 10:55:16 +00:00
Also you need `autoconf` .
2018-03-28 19:42:14 +00:00
To compile and install it, do the following within the project's root directory:
2018-03-27 01:32:29 +00:00
2018-04-03 03:00:18 +00:00
```console
$ [ ! -e ./configure ] & & autoreconf -i
$ ./configure
$ make
$ sudo make install
2018-03-27 01:32:29 +00:00
```
2018-03-28 19:42:14 +00:00
Note: the paths of the `reboot` , `poweroff` , and `cryptsetup` commands are passed to the module at compile-time.
2018-03-27 01:32:29 +00:00
## Preparation
2018-04-03 03:00:18 +00:00
If you want to use removable media you'll need two GPT-formatted removable storage devices, and said devices must have at least one partition. Here's an example `fdisk` session, showing how this might be accomplished:
2018-03-27 01:32:29 +00:00
2018-04-03 03:00:18 +00:00
```console
2018-03-27 01:32:29 +00:00
$ sudo fdisk /dev/sdc
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): g
Created a new GPT disklabel (GUID: AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA).
Command (m for help): n
Partition number (1-128, default 1):
First sector (2048-15661022, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-15661022, default 15661022):
Created a new partition 1 of type 'Linux filesystem' and of size 7.5 GiB.
Command (m for help): w
```
2018-03-27 13:52:32 +00:00
You'll find the UUID of your partition in `/dev/disk/by-partuuid/` . You can find out which device is which typing `ls -l /dev/disk/by-partuuid/` in your favourite shell.
2018-03-27 01:32:29 +00:00
2018-04-03 23:54:09 +00:00
2018-03-28 19:42:14 +00:00
## Configuration
2018-04-03 23:54:09 +00:00
To configure the module, add the following to the appropriate PAM configuration file(s): (see `pam.conf(5)` for details on these files)
2018-03-27 01:32:29 +00:00
2018-03-31 23:53:41 +00:00
### Using the removable media:
2018-03-27 01:32:29 +00:00
```
2018-04-03 02:32:07 +00:00
auth requisite /usr/local/lib/security/pam_panic.so auth=< UUID > reject=< UUID > reboot serious=< UUID >
account requisite /usr/local/lib/security/pam_panic.so
2018-03-27 01:32:29 +00:00
```
2018-03-31 23:53:41 +00:00
### Using the two passwords:
```
2018-04-03 02:32:07 +00:00
auth requisite /usr/local/lib/security/pam_panic.so password reboot serious=< UUID >
account requisite /usr/local/lib/security/pam_panic.so
2018-03-31 23:53:41 +00:00
```
2018-08-04 11:15:01 +00:00
To set your passwords run `pam_panic_pw` as root in your preferred shell.
2018-03-31 23:53:41 +00:00
2018-04-03 03:00:18 +00:00
## More information
2018-04-03 23:54:09 +00:00
See `man 8 pam_panic` and `man 1 pam_panic_pw` for more information.
2018-03-27 01:32:29 +00:00
2018-04-25 11:10:19 +00:00
## Contact
2018-04-30 10:18:54 +00:00
- Support channel on IRC at [**#pampanic** on chat.**freenode**.net ](https://webchat.freenode.net/?channels=%23pampanic&uio=d4 ) - Feel free to idle. :)
- Developer channel on IRC at [**#pampanic-dev** on chat.**freenode**.net ](https://webchat.freenode.net/?channels=%23pampanic-dev&uio=d4 )
2018-04-25 11:10:19 +00:00
2018-03-27 01:32:29 +00:00
## TODO
2018-03-28 19:46:03 +00:00
- [Manpage translations ](https://github.com/Bandie/pam_panic/issues?q=is%3Aissue+is%3Aopen+label%3Alocalization )
2018-04-08 13:45:51 +00:00
# Addendum
2018-04-08 21:14:07 +00:00
## Poisoning memory when issuing a reboot or shutdown
2018-04-08 13:45:51 +00:00
If you want to be sure to have your memory clear of all information when issuing a reboot/shutdown
you might want to add the option `page_poison=on` and `slub_debug=P` to your kernel command line at boot.
For GRUB2 you just append it on your `GRUB_CMDLINE_LINUX` entry in `/etc/default/grub` and then issue a rebuild
of the GRUB2 config: `grub-mkconfig -o /boot/grub/grub.cfg`