-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
74 lines (56 loc) · 1.95 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#
# Makefile - One-time password login system
#
# Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/>
#
VERSION=1.5
CC=gcc
CFLAGS=-O -ggdb -W -Wall -Wno-unused-result -fPIC
%.gz: %
gzip -9c $< >$@
TARGETS=otpw-gen demologin pam_otpw.so pam_otpw.8.gz otpw-gen.1.gz
all: $(TARGETS)
otpw-gen: otpw-gen.o rmd160.o md.o otpw.o
$(CC) -o $@ $+
demologin: demologin.o otpw.o rmd160.o md.o
$(CC) -o $@ $+ -lcrypt
otpw-gen.o: otpw-gen.c md.h otpw.h
otpw.o: otpw.c otpw.h md.h
md.o: md.c md.h rmd160.h
rmd160.o: rmd160.c rmd160.h
otpw-l.o: otpw-l.c otpw.c otpw.h md.h
pam_otpw.o: pam_otpw.c otpw.h md.h
pam_otpw.so: pam_otpw.o otpw-l.o rmd160.o md.o
ld --shared -o $@ $+ -lcrypt -lpam -lpam_misc
distribution:
git archive --prefix otpw-$(VERSION)/ -o otpw-$(VERSION).tar.gz v$(VERSION)
release:
git diff --exit-code v$(VERSION) -- otpw.html
rsync -t otpw-$(VERSION).tar.gz $(HOME)/public_html/download/
rsync -t otpw.html $(HOME)/public_html/
#PAMLIB=/lib/security
PAMLIB=/lib/x86_64-linux-gnu/security
install: install-pam install-gen
install-pam: pam_otpw.so pam_otpw.8.gz
rsync -t pam_otpw.so $(PAMLIB)/
rsync -t pam_otpw.8.gz /usr/share/man/man8/
perl -i.bak -pe 's/^(\@include common-auth)$$/\# $$1\nauth required pam_otpw.so/' /etc/pam.d/sshd
perl -i.bak -pe 's/^(ChallengeResponseAuthentication\s+)no$$/$$1yes/' \
/etc/ssh/sshd_config
killall -SIGHUP sshd
install-gen: otpw-gen otpw-gen.1.gz
rsync -t otpw-gen /usr/bin/
rsync -t otpw-gen.1.gz /usr/share/man/man1/
-getent passwd otpw && \
chown otpw /usr/bin/otpw-gen && chmod u+s /usr/bin/otpw-gen
install-pseudouser:
adduser --system --gecos 'Pseudouser for storing one-time password files' --home /var/lib/otpw otpw
uninstall-pseudouser:
deluser --remove-home otpw
uninstall:
rm -f $(PAMLIB)/pam_otpw.so /usr/share/man/man8/pam_otpw.8.gz
rm -f /usr/bin/otpw-gen /usr/share/man/man1/otpw-gen.1.gz
clean:
rm -f $(TARGETS) *~ *.o core
test-login:
ssh -o PreferredAuthentications=keyboard-interactive localhost