/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
1
WARN=-O -Wall -Wformat=2 -Winit-self -Wmissing-include-dirs \
2
	-Wswitch-default -Wswitch-enum -Wunused-parameter \
3
	-Wstrict-aliasing=2 -Wextra -Wfloat-equal -Wundef -Wshadow \
4
	-Wunsafe-loop-optimizations -Wpointer-arith \
5
	-Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings \
6
	-Wconversion -Wstrict-prototypes -Wold-style-definition \
7
	-Wpacked -Wnested-externs -Wunreachable-code -Winline \
8
	-Wvolatile-register-var
21 by Teddy Hogeborn
* Makefile (CFLAGS): Changed to use $(WARN), $(DEBUG), $(COVERAGE) and
9
DEBUG=-ggdb3
28 by Teddy Hogeborn
* server.conf: New file.
10
# For info about _FORTIFY_SOURCE, see
11
# <http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html>
12
FORTIFY=-D_FORTIFY_SOURCE=2 # -fstack-protector-all
73 by Teddy Hogeborn
* Makefile (COVERAGE): Change back to "--coverage".
13
#COVERAGE=--coverage
24.1.51 by Björn Påhlsson
Added configuration files support for mandos-client
14
OPTIMIZE=-Os
21 by Teddy Hogeborn
* Makefile (CFLAGS): Changed to use $(WARN), $(DEBUG), $(COVERAGE) and
15
LANGUAGE=-std=gnu99
16
17
# Do not change these two
28 by Teddy Hogeborn
* server.conf: New file.
18
CFLAGS=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) $(OPTIMIZE) $(LANGUAGE)
21 by Teddy Hogeborn
* Makefile (CFLAGS): Changed to use $(WARN), $(DEBUG), $(COVERAGE) and
19
LDFLAGS=$(COVERAGE)
16 by Teddy Hogeborn
* Makefile: Include targets for all binaries.
20
62 by Teddy Hogeborn
* Makefile (DOCBOOKTOMAN): Do not generate AUTHORS section.
21
DOCBOOKTOMAN=xsltproc --nonet \
22
	--param man.charmap.use.subset		0 \
23
	--param make.year.ranges		1 \
24
	--param make.single.year.ranges		1 \
25
	--param man.output.quietly		1 \
26
	--param man.authors.section.enabled	0
24.1.25 by Björn Påhlsson
* clients.conf.xml: Renamed to "mandos-clients.conf.xml".
27
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
28
PLUGINS=plugins.d/password-prompt plugins.d/password-request
29
PROGS=mandos-client $(PLUGINS)
30
DOCS=mandos.8 mandos-client.8mandos mandos-keygen.8 \
31
	plugins.d/password-request.8mandos \
32
	plugins.d/password-prompt.8mandos mandos.conf.5 \
33
	 mandos-clients.conf.5
16 by Teddy Hogeborn
* Makefile: Include targets for all binaries.
34
35
objects=$(shell for p in $(PROGS); do echo $${p}.o; done)
36
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
37
all: $(PROGS)
38
39
doc: $(DOCS)
24.1.25 by Björn Påhlsson
* clients.conf.xml: Renamed to "mandos-clients.conf.xml".
40
41
%.5: %.xml
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
42
	cd $(dir $^); $(DOCBOOKTOMAN) $(notdir $^)
24.1.25 by Björn Påhlsson
* clients.conf.xml: Renamed to "mandos-clients.conf.xml".
43
44
%.8: %.xml
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
45
	cd $(dir $^); $(DOCBOOKTOMAN) $(notdir $^)
24.1.25 by Björn Påhlsson
* clients.conf.xml: Renamed to "mandos-clients.conf.xml".
46
47
%.8mandos: %.xml
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
48
	cd $(dir $^); $(DOCBOOKTOMAN) $(notdir $^)
16 by Teddy Hogeborn
* Makefile: Include targets for all binaries.
49
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
50
mandos-client: mandos-client.o
16 by Teddy Hogeborn
* Makefile: Include targets for all binaries.
51
	$(LINK.o) -lgnutls $(COMMON) $^ $(LOADLIBES) $(LDLIBS) -o $@
52
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
53
plugins.d/password-request: plugins.d/password-request.o
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
54
	$(LINK.o) -lgnutls -lavahi-core -lgpgme $(COMMON) $^ \
55
		$(LOADLIBES) $(LDLIBS) -o $@
16 by Teddy Hogeborn
* Makefile: Include targets for all binaries.
56
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
57
plugins.d/password-prompt: plugins.d/password-prompt.o
16 by Teddy Hogeborn
* Makefile: Include targets for all binaries.
58
	$(LINK.o) $(COMMON) $^ $(LOADLIBES) $(LDLIBS) -o $@
59
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
60
.PHONY : all clean distclean run-client run-server install \
61
	install-server install-client uninstall uninstall-server \
62
	uninstall-client purge purge-server purge-client
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
63
1 by Björn Påhlsson
First working version with: IPv6, GnuTLS, X.509 certificates, DN
64
clean:
24.1.25 by Björn Påhlsson
* clients.conf.xml: Renamed to "mandos-clients.conf.xml".
65
	-rm --force $(PROGS) $(objects) $(DOCS) core
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
66
67
distclean: clean
68
mostlyclean: clean
69
maintainer-clean: clean
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
70
	-rm --force --recursive keydir
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
71
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
72
check:
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
73
	./mandos --check
74
75
run-client: all
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
76
	-mkdir keydir
77
	-./mandos-keygen --dir keydir
78
	./mandos-client --plugin-dir=plugins.d \
79
		--options-for=password-request:--keydir=keydir
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
80
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
81
run-server:
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
82
	./mandos --debug --configdir=.
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
83
84
install: install-server install-client
85
86
install-server: doc
87
	mkdir --mode=0755 --parents /etc/mandos
88
	install --mode=0755 mandos /usr/sbin/mandos
89
	install --mode=0644 --target-directory=/etc/mandos mandos.conf
90
	install --mode=0640 --target-directory=/etc/mandos \
91
		clients.conf
92
	gzip --best --to-stdout mandos.8 \
93
		> /usr/share/man/man8/mandos.8.gz
94
	gzip --best --to-stdout mandos.conf.5 \
95
		> /usr/share/man/man5/mandos.conf.5.gz
96
	gzip --best --to-stdout mandos-clients.conf.5 \
97
		> /usr/share/man/man5/mandos-clients.conf.5.gz
98
99
install-client: all doc /usr/share/initramfs-tools/hooks/.
100
	mkdir --mode=0755 --parents /usr/lib/mandos /etc/mandos
71 by Teddy Hogeborn
* Makefile (install-client): Bug fix: Do not fail if plugin dir
101
	-mkdir --mode=0700 /usr/lib/mandos/plugins.d
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
102
	chmod u=rwx,g=,o= /usr/lib/mandos/plugins.d
103
	install --mode=0755 --target-directory=/usr/lib/mandos \
104
		mandos-client
105
	install --mode=0755 --target-directory=/usr/sbin mandos-keygen
106
	install --mode=0755 \
107
		--target-directory=/usr/lib/mandos/plugins.d \
108
		plugins.d/password-prompt
109
	install --mode=4755 \
110
		--target-directory=/usr/lib/mandos/plugins.d \
111
		plugins.d/password-request
112
	install initramfs-tools-hook \
113
		/usr/share/initramfs-tools/hooks/mandos
114
	install initramfs-tools-hook-conf \
115
		/usr/share/initramfs-tools/conf-hooks.d/mandos
116
	gzip --best --to-stdout mandos-keygen.8 \
117
		> /usr/share/man/man8/mandos-keygen.8.gz
118
	gzip --best --to-stdout mandos-client.8mandos \
119
		> /usr/share/man/man8/mandos-client.8mandos.gz
120
	gzip --best --to-stdout plugins.d/password-prompt.8mandos \
121
		> /usr/share/man/man8/password-prompt.8mandos.gz
122
	gzip --best --to-stdout plugins.d/password-request.8mandos \
123
		> /usr/share/man/man8/password-request.8mandos.gz
71 by Teddy Hogeborn
* Makefile (install-client): Bug fix: Do not fail if plugin dir
124
	-/usr/sbin/mandos-keygen
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
125
	update-initramfs -k all -u
126
127
uninstall: uninstall-server uninstall-client
128
129
uninstall-server: /usr/sbin/mandos
130
	-rm --force /usr/sbin/mandos /usr/share/man/man8/mandos.8.gz \
131
		/usr/share/man/man5/mandos.conf.5.gz \
132
		/usr/share/man/man5/mandos-clients.conf.5.gz
71 by Teddy Hogeborn
* Makefile (install-client): Bug fix: Do not fail if plugin dir
133
	-rmdir /etc/mandos
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
134
135
uninstall-client:
72 by Teddy Hogeborn
* Makefile (uninstall-client): Refuse to uninstall if it is in use.
136
# Refuse to uninstall client if /etc/crypttab is configured to use it
137
	! grep --regexp='^ *[^ #].*keyscript=/usr/lib/mandos/mandos-client' \
138
		/etc/crypttab
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
139
	-rm --force /usr/sbin/mandos-keygen \
140
		/usr/lib/mandos/mandos-client \
141
		/usr/lib/mandos/plugins.d/password-prompt \
142
		/usr/lib/mandos/plugins.d/password-request \
143
		/usr/share/initramfs-tools/hooks/mandos \
144
		/usr/share/initramfs-tools/conf-hooks.d/mandos \
145
		/usr/share/man/man8/mandos-client.8mandos.gz \
146
		/usr/share/man/man8/mandos-keygen.8.gz \
147
		/usr/share/man/man8/password-prompt.8mandos.gz \
148
		/usr/share/man/man8/password-request.8mandos.gz
71 by Teddy Hogeborn
* Makefile (install-client): Bug fix: Do not fail if plugin dir
149
	-rmdir /usr/lib/mandos/plugins.d /usr/lib/mandos \
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
150
		/etc/mandos/plugins.d /etc/mandos
151
152
purge: purge-server purge-client
153
154
purge-server: uninstall-server
71 by Teddy Hogeborn
* Makefile (install-client): Bug fix: Do not fail if plugin dir
155
	-rm --force /etc/mandos/mandos.conf /etc/mandos/clients.conf
156
	-rmdir /etc/mandos
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
157
158
purge-client: uninstall-client
159
	-rm --force /etc/mandos/seckey.txt /etc/mandos/pubkey.txt
71 by Teddy Hogeborn
* Makefile (install-client): Bug fix: Do not fail if plugin dir
160
	-rmdir /etc/mandos /etc/mandos/plugins.d