This commit is contained in:
Liam Waldron 2023-03-28 14:13:44 -04:00
commit 93b57c3ee3
6 changed files with 92 additions and 0 deletions

11
Makefile Normal file
View File

@ -0,0 +1,11 @@
include config.mk
all: src/main.c
$(CC) $(CFLAGS) $(LDFLAGS) src/main.c -o src/pm
install: src/pm man/pm.1
install src/pm $(PREFIX)/bin
install -d $(PM_ENTRIES_DIR)
touch $(PM_ENTRIES_DIR)/$(PM_ENTRIES_FILE)
install -g 0 -o 0 -m man/pm.1 /usr/local/man/man1
gzip /usr/local/man/man1/pm.1

22
README Normal file
View File

@ -0,0 +1,22 @@
+ pm - a simple password manager
pm is a very simple password manager. It aims to be simple and portable. It creates
entries in a predefined file, containing a password and a name. Those entries can
then be queried by pmsearch, a wrapper script.
Since there is no runtime configuration, ecrypt is extremely fast and secure.
+ Installation
Clone this repository:
(user)$ git clone https://git.everestlinux.org/EverestLinux/pm
Edit src/config.h and ensure it looks good:
(user)$ $EDITOR src/config.h
Edit config.mk and adjust any options:
(user)$ $EDITOR config.mk
Run make:
(user)$ make
Install:
(root)# make install

13
config.mk Normal file
View File

@ -0,0 +1,13 @@
#
# config.mk
#
PREFIX = /usr
CC = cc
CFLAGS = -O2 -fstack-protector-strong
LDFLAGS = -s -static
# these should be the same as they are in config.h
PM_ENTRIES_DIR = /etc/pm
PM_ENTRIES_FILE = entries

19
man/pm.1 Normal file
View File

@ -0,0 +1,19 @@
.\" Manpage for pm.
.TH man 1 "28 March 2023" "1.0" "Everest Linux Manual"
.SH NAME
pm \- password manager that stores all entries in a file for reference later
.SH SYNOPSIS
pm PASSWORD ENTRY_NAME
.SH DESCRIPTION
pm is a password manager for *NIX systems that stores entry names and passwords in a file. These can later be queried by pmsearch(1). pm is designed to work very well with ecrypt(1).
.SH OPTIONS
pm takes no options.
.SH EXAMPLES
Create a new entry named "entry1", using ecrypt to generate the password:
pm $(ecrypt) entry1
.SH SEE ALSO
ecrypt(1)
.SH BUGS
Report all bugs on the issues page at https://git.everestlinux.org/EverestLinux/pm
.SH AUTHOR
Liam Waldron (liamwaldron@everestlinux.org)

6
src/config.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef CONFIG_H_
#define CONFIG_H_
#define PM_ENTRIES_FILE "/etc/pm/entries"
#endif

21
src/main.c Normal file
View File

@ -0,0 +1,21 @@
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
int main(int argc, char *argv[]) {
if (argc == 1) {
printf("usage: %s PASSWORD ENTRY_NAME\n", argv[0]);
return 1;
}
FILE *fp;
fp = fopen(PM_ENTRIES_FILE, "a+");
fprintf(fp, "ENTRY\n");
fprintf(fp, "%s", argv[2]);
fprintf(fp, " - ");
fprintf(fp, "%s\n", argv[1]);
fprintf(fp, "END ENTRY\n");
fclose(fp);
}