Naufal Dean Anugrah (13518123)
This repository contains code that is used in the paper. And it is intended as a complement only. To use it in real environment, follow the steps in the paper.
$ python --version
Python 2.7.17
-
Install dependencies
sudo apt-get update
sudo apt-get install python
sudo apt-get install libpam-python
-
Install postgresql (script below is from here)
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update sudo apt-get -y install postgresql
-
Allow password login on postgresql\
sudo nano /etc/postgresql/13/main/pg_hba.conf
- change
local all postgres peer
tolocal all postgres md5
- change
local all all peer
tolocal all all md5
- save change
- login as user postgres and set user postgres password using
sudo -u postgres psql postgres \password postgres
- input password
- quit postgres using
\q
- restart postgresql using
sudo service postgresql restart
-
Create pam database to store user public key
- login as user postgres
psql -U postgres -W
- create database
CREATE DATABASE pam;
- connect to database pam
\c pam
- create public_key table
CREATE TABLE validation_table ( id int PRIMARY KEY, public_key varchar(500), signature varchar(300) );
- login as user postgres
-
Install python dependencies globally
sudo apt install python-pip
sudo pip install psycopg2-binary
-
Add this line to
/etc/pam.d/sudo
auth sufficient pam_python.so [<pam_py_path>]