/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
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
16
# PREFIX=/usr/local
17
PREFIX=/usr
18
# CONFDIR=/usr/local/lib/mandos
19
CONFDIR=/etc/mandos
20
# MANDIR=/usr/local/man
21
MANDIR=/usr/share/man
21 by Teddy Hogeborn
* Makefile (CFLAGS): Changed to use $(WARN), $(DEBUG), $(COVERAGE) and
22
81 by Teddy Hogeborn
* Makefile (GNUTLS_CFLAGS, GNUTLS_LIBS, AVAHI_CFLAGS, AVAHI_LIBS,
23
GNUTLS_CFLAGS=$(shell libgnutls-config --cflags)
24
GNUTLS_LIBS=$(shell libgnutls-config --libs)
25
AVAHI_CFLAGS=$(shell pkg-config --cflags-only-I avahi-core)
26
AVAHI_LIBS=$(shell pkg-config --libs avahi-core)
27
GPGME_CFLAGS=$(shell gpgme-config --cflags)
28
GPGME_LIBS=$(shell gpgme-config --libs)
29
21 by Teddy Hogeborn
* Makefile (CFLAGS): Changed to use $(WARN), $(DEBUG), $(COVERAGE) and
30
# Do not change these two
81 by Teddy Hogeborn
* Makefile (GNUTLS_CFLAGS, GNUTLS_LIBS, AVAHI_CFLAGS, AVAHI_LIBS,
31
CFLAGS=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) $(OPTIMIZE) \
32
	$(LANGUAGE) $(GNUTLS_CFLAGS) $(AVAHI_CFLAGS) $(GPGME_CFLAGS)
21 by Teddy Hogeborn
* Makefile (CFLAGS): Changed to use $(WARN), $(DEBUG), $(COVERAGE) and
33
LDFLAGS=$(COVERAGE)
16 by Teddy Hogeborn
* Makefile: Include targets for all binaries.
34
90 by Teddy Hogeborn
* Makefile (DOCBOOKTOMAN): Added "--xinclude".
35
DOCBOOKTOMAN=xsltproc --nonet --xinclude \
62 by Teddy Hogeborn
* Makefile (DOCBOOKTOMAN): Do not generate AUTHORS section.
36
	--param man.charmap.use.subset		0 \
37
	--param make.year.ranges		1 \
38
	--param make.single.year.ranges		1 \
39
	--param man.output.quietly		1 \
84 by Teddy Hogeborn
* Makefile (DOCBOOKTOMAN): Use the local manpages/docbook.xsl file, do
40
	--param man.authors.section.enabled	0 \
41
	 /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl
81 by Teddy Hogeborn
* Makefile (GNUTLS_CFLAGS, GNUTLS_LIBS, AVAHI_CFLAGS, AVAHI_LIBS,
42
# DocBook-to-man post-processing to fix a \n escape bug
83 by Teddy Hogeborn
* Makefile (MANPOST): Bug fix: do not replace *all* "een" with "en".
43
MANPOST=sed --in-place --expression='s,\\en,\en,g;s,\\een,\\en,g'
24.1.25 by Björn Påhlsson
* clients.conf.xml: Renamed to "mandos-clients.conf.xml".
44
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
45
PLUGINS=plugins.d/password-prompt plugins.d/password-request
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
46
PROGS=plugin-runner $(PLUGINS)
47
DOCS=mandos.8 plugin-runner.8mandos mandos-keygen.8 \
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
48
	plugins.d/password-request.8mandos \
49
	plugins.d/password-prompt.8mandos mandos.conf.5 \
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
50
	mandos-clients.conf.5
16 by Teddy Hogeborn
* Makefile: Include targets for all binaries.
51
81 by Teddy Hogeborn
* Makefile (GNUTLS_CFLAGS, GNUTLS_LIBS, AVAHI_CFLAGS, AVAHI_LIBS,
52
objects=$(addsuffix .o,$(PROGS))
16 by Teddy Hogeborn
* Makefile: Include targets for all binaries.
53
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
54
all: $(PROGS)
55
56
doc: $(DOCS)
24.1.25 by Björn Påhlsson
* clients.conf.xml: Renamed to "mandos-clients.conf.xml".
57
58
%.5: %.xml
89 by Teddy Hogeborn
* Makefile: Bug fix: fixed creation of man pages for section 5 pages.
59
	cd $(dir $^); $(DOCBOOKTOMAN) $(notdir $^); $(MANPOST) $(notdir $@)
24.1.25 by Björn Påhlsson
* clients.conf.xml: Renamed to "mandos-clients.conf.xml".
60
61
%.8: %.xml
87 by Teddy Hogeborn
* Makefile: Bug fix: fixed creation of man pages in "plugins.d".
62
	cd $(dir $^); $(DOCBOOKTOMAN) $(notdir $^); $(MANPOST) $(notdir $@)
24.1.25 by Björn Påhlsson
* clients.conf.xml: Renamed to "mandos-clients.conf.xml".
63
64
%.8mandos: %.xml
87 by Teddy Hogeborn
* Makefile: Bug fix: fixed creation of man pages in "plugins.d".
65
	cd $(dir $^); $(DOCBOOKTOMAN) $(notdir $^); $(MANPOST) $(notdir $@)
16 by Teddy Hogeborn
* Makefile: Include targets for all binaries.
66
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
67
plugins.d/password-request: plugins.d/password-request.o
81 by Teddy Hogeborn
* Makefile (GNUTLS_CFLAGS, GNUTLS_LIBS, AVAHI_CFLAGS, AVAHI_LIBS,
68
	$(LINK.o) $(GNUTLS_LIBS) $(AVAHI_LIBS) $(GPGME_LIBS) \
69
		$(COMMON) $^ $(LOADLIBES) $(LDLIBS) -o $@
70
71
.PHONY : all doc clean distclean run-client run-server install \
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
72
	install-server install-client uninstall uninstall-server \
73
	uninstall-client purge purge-server purge-client
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
74
1 by Björn Påhlsson
First working version with: IPv6, GnuTLS, X.509 certificates, DN
75
clean:
24.1.25 by Björn Påhlsson
* clients.conf.xml: Renamed to "mandos-clients.conf.xml".
76
	-rm --force $(PROGS) $(objects) $(DOCS) core
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
77
78
distclean: clean
79
mostlyclean: clean
80
maintainer-clean: clean
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
81
	-rm --force --recursive keydir
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
82
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
83
check:
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
84
	./mandos --check
85
86
run-client: all
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
87
	-mkdir keydir
88
	-./mandos-keygen --dir keydir
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
89
	./plugin-runner --plugin-dir=plugins.d \
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
90
		--options-for=password-request:--keydir=keydir
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
91
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
92
run-server:
47 by Teddy Hogeborn
* plugbasedclient.c: Renamed to "mandos-client.c". All users changed.
93
	./mandos --debug --configdir=.
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
94
95
install: install-server install-client
96
97
install-server: doc
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
98
	mkdir --mode=0755 --parents $(CONFDIR) $(MANDIR)/man5 \
99
		$(MANDIR)/man8
100
	install --mode=0755 mandos $(PREFIX)/sbin/mandos
101
	install --mode=0644 --target-directory=$(CONFDIR) mandos.conf
102
	install --mode=0640 --target-directory=$(CONFDIR) \
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
103
		clients.conf
104
	gzip --best --to-stdout mandos.8 \
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
105
		> $(MANDIR)/man8/mandos.8.gz
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
106
	gzip --best --to-stdout mandos.conf.5 \
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
107
		> $(MANDIR)/man5/mandos.conf.5.gz
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
108
	gzip --best --to-stdout mandos-clients.conf.5 \
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
109
		> $(MANDIR)/man5/mandos-clients.conf.5.gz
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
110
111
install-client: all doc /usr/share/initramfs-tools/hooks/.
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
112
	mkdir --mode=0755 --parents $(PREFIX)/lib/mandos $(CONFDIR) \
113
		$(MANDIR)/man8
114
	-mkdir --mode=0700 $(PREFIX)/lib/mandos/plugins.d
115
	chmod u=rwx,g=,o= $(PREFIX)/lib/mandos/plugins.d
116
	install --mode=0755 --target-directory=$(PREFIX)/lib/mandos \
117
		plugin-runner
118
	install --mode=0755 --target-directory=$(PREFIX)/sbin \
119
		mandos-keygen
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
120
	install --mode=0755 \
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
121
		--target-directory=$(PREFIX)/lib/mandos/plugins.d \
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
122
		plugins.d/password-prompt
123
	install --mode=4755 \
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
124
		--target-directory=$(PREFIX)/lib/mandos/plugins.d \
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
125
		plugins.d/password-request
126
	install initramfs-tools-hook \
127
		/usr/share/initramfs-tools/hooks/mandos
128
	install initramfs-tools-hook-conf \
129
		/usr/share/initramfs-tools/conf-hooks.d/mandos
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
130
	install initramfs-tools-script \
131
		/usr/share/initramfs-tools/scripts/local-top/mandos
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
132
	gzip --best --to-stdout mandos-keygen.8 \
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
133
		> $(MANDIR)/man8/mandos-keygen.8.gz
134
	gzip --best --to-stdout plugin-runner.8mandos \
135
		> $(MANDIR)/man8/plugin-runner.8mandos.gz
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
136
	gzip --best --to-stdout plugins.d/password-prompt.8mandos \
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
137
		> $(MANDIR)/man8/password-prompt.8mandos.gz
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
138
	gzip --best --to-stdout plugins.d/password-request.8mandos \
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
139
		> $(MANDIR)/man8/password-request.8mandos.gz
140
	-$(PREFIX)/sbin/mandos-keygen
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
141
	update-initramfs -k all -u
142
143
uninstall: uninstall-server uninstall-client
144
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
145
uninstall-server: $(PREFIX)/sbin/mandos
146
	-rm --force $(PREFIX)/sbin/mandos \
147
		$(MANDIR)/man8/mandos.8.gz \
148
		$(MANDIR)/man5/mandos.conf.5.gz \
149
		$(MANDIR)/man5/mandos-clients.conf.5.gz
150
	-rmdir $(CONFDIR)
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
151
152
uninstall-client:
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
153
# Refuse to uninstall client if /etc/crypttab is explicitly configured
154
# to use it.
155
	! grep --regexp='^ *[^ #].*keyscript=[^,=]*/mandos/' \
72 by Teddy Hogeborn
* Makefile (uninstall-client): Refuse to uninstall if it is in use.
156
		/etc/crypttab
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
157
	-rm --force $(PREFIX)/sbin/mandos-keygen \
158
		$(PREFIX)/lib/mandos/plugin-runner \
159
		$(PREFIX)/lib/mandos/plugins.d/password-prompt \
160
		$(PREFIX)/lib/mandos/plugins.d/password-request \
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
161
		/usr/share/initramfs-tools/hooks/mandos \
162
		/usr/share/initramfs-tools/conf-hooks.d/mandos \
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
163
		$(MANDIR)/man8/plugin-runner.8mandos.gz \
164
		$(MANDIR)/man8/mandos-keygen.8.gz \
165
		$(MANDIR)/man8/password-prompt.8mandos.gz \
166
		$(MANDIR)/man8/password-request.8mandos.gz
167
	-rmdir $(PREFIX)/lib/mandos/plugins.d $(CONFDIR)/plugins.d \
168
		 $(PREFIX)/lib/mandos $(CONFDIR)
169
	update-initramfs -k all -u
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
170
171
purge: purge-server purge-client
172
173
purge-server: uninstall-server
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
174
	-rm --force $(CONFDIR)/mandos.conf $(CONFDIR)/clients.conf
175
	-rmdir $(CONFDIR)
67 by Teddy Hogeborn
* mandos-keygen: New program to generate new client keys on
176
177
purge-client: uninstall-client
74 by Teddy Hogeborn
* Makefile (PREFIX, CONFDIR): New.
178
	-rm --force $(CONFDIR)/seckey.txt $(CONFDIR)/pubkey.txt
179
	-rmdir $(CONFDIR) $(CONFDIR)/plugins.d