commit 93b57c3ee3a6641889545b6f10e1495388e9f006 Author: Liam Waldron Date: Tue Mar 28 14:13:44 2023 -0400 init diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..99862c0 --- /dev/null +++ b/Makefile @@ -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 diff --git a/README b/README new file mode 100644 index 0000000..a7543d7 --- /dev/null +++ b/README @@ -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 diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..ccde2bc --- /dev/null +++ b/config.mk @@ -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 diff --git a/man/pm.1 b/man/pm.1 new file mode 100644 index 0000000..efc8e51 --- /dev/null +++ b/man/pm.1 @@ -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) diff --git a/src/config.h b/src/config.h new file mode 100644 index 0000000..2b1ee21 --- /dev/null +++ b/src/config.h @@ -0,0 +1,6 @@ +#ifndef CONFIG_H_ +#define CONFIG_H_ + +#define PM_ENTRIES_FILE "/etc/pm/entries" + +#endif diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..ad64b7a --- /dev/null +++ b/src/main.c @@ -0,0 +1,21 @@ +#include +#include + +#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); +}