/[pkg-mixmaster]/trunk/Mix/Install
ViewVC logotype

Contents of /trunk/Mix/Install

Parent Directory Parent Directory | Revision Log Revision Log


Revision 944 - (show annotations) (download)
Wed Jun 28 15:14:43 2006 UTC (6 years, 10 months ago) by rabbi
File size: 26632 byte(s)
Added recent versions of OpenSSL to the Install script version checking routine. Now recognizes OpenSSL 0.9.7j and previous, and 0.9.8a and previous.
1 #!/bin/sh
2 # Mixmaster version 3.0 -- (C) 1999-2006 Anonymizer Inc. and others.
3
4 # Mixmaster may be redistributed and modified under certain conditions.
5 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
6 # ANY KIND, either express or implied. See the file COPYRIGHT for
7 # details.
8
9 # $Id$
10
11 #whereis program default-path
12 whereis()
13 {
14 #echo "Looking for $1..."
15 found=""
16 for i in $* `which $1 2>&1`
17 do
18 if [ -f "$i" -a -x "$i" ]
19 then
20 found=$i
21 fi
22 done
23 if [ "$found" = "" ]
24 then
25 found=$2
26 # echo "$1 not found. Using $found."
27 # else
28 # echo "$1 is at $found."
29 fi
30 }
31
32 if echo -n | grep n >/dev/null
33 then
34 echo1=""
35 echo2="\c"
36 else
37 echo1="-n"
38 echo2=""
39 fi
40
41 # readln text default
42 readln()
43 {
44 echo $echo1 "$1 [$2] $echo2"
45 read ans
46 if [ -z "$ans" ]
47 then
48 ans="$2"
49 fi
50 }
51
52 # findlib libxxx.a -- find and configure libraries
53 # Input:
54 # $1 library name
55 # $CONFIG library configure options
56 # $INCDIR possible include directories
57 # $SRCDIR possible library source directories
58 # $LIBDIR possible library binary directories
59 #
60 # Output:
61 # $found library directory
62 # $lib library name
63 # $INCDIR include directory if required, empty otherwise
64 # $LDFLAG linker options
65 # $LIB path to library file
66 # $MAKELIB Makefile entry to compile library
67 findlib()
68 {
69 lib=$1
70 libso=`echo $lib | sed 's/\.a$/.so/'`
71 echo "Looking for $lib..."
72
73 found=
74 source=
75 type=
76 LIB=
77 LDFLAG=
78 MAKELIB=
79
80 for i in /usr/local/lib /usr/lib /lib /usr/lib64
81 do
82 if [ -r $i/$lib -o -r $i/$libso ]
83 then
84 found=$i
85 type=system
86 fi
87 done
88
89 for i in $LIBDIR
90 do
91 if [ -r $i/$lib -o -r $i/$libso ]
92 then
93 found=$i
94 type=installed
95 fi
96 done
97
98 for i in $SRCDIR
99 do
100 if [ -r $i/$lib -o -r $i/lib/$lib ]
101 then
102 found=$i
103 type=binary
104 fi
105 done
106
107 if [ -r "$found/$libso" ]
108 then
109 echo "Found at $found/$libso."
110 elif [ -r "$found/$lib" ]
111 then
112 echo "Found at $found/$lib."
113 elif [ -r "$found/lib/$lib" ]
114 then
115 echo "Found at $found/lib/$lib."
116 fi
117
118 for i in $SRCDIR
119 do
120 if [ -d $i -a ! "$type" = binary ]
121 then
122 source=$i
123 fi
124 done
125
126 if [ "$source" != "" ]
127 then
128 echo "Found source directory $source."
129 if [ "$found" = "" ]
130 then
131 ans=y
132 else
133 echo "Use the source if the pre-installed library causes compilation problems."
134 readln "Use source?" n
135 fi
136 if [ "$ans" = "y" ]
137 then
138 found=$source
139 type=source
140 fi
141 fi
142
143 if [ "$found" = "" ]
144 then
145 echo "Not found."
146 fi
147
148 if [ -r $found/lib/$lib ]
149 then
150 LIB=$found/lib/$lib
151 else
152 LIB=$found/$lib
153 fi
154 if [ "$type" = system ]
155 then
156 LIB=
157 LDFLAG="-l`echo $lib | sed 's/^lib//;s/\.a$//'` -L$found"
158 if [ "$found" = "/usr/local/lib" ]
159 then
160 INCDIR="/usr/local/include $INCDIR"
161 fi
162 fi
163
164 incdir=$INCDIR
165 INCDIR=
166 for i in $incdir
167 do
168 if [ -d $i ]
169 then
170 INCDIR=$i
171 fi
172 done
173
174 if [ "$type" = source -o "$type" = binary ]
175 then
176 if [ ! -r $found/lib/$lib ]
177 then
178 MAKELIB="$found/$lib:
179 cd $found; make $lib"
180 fi
181 if [ -d $found/include ]
182 then
183 INCDIR=$found/include
184 else
185 INCDIR=$found
186 fi
187 fi
188
189 if [ "$type" = source ]
190 then
191 dir=`pwd`
192 if [ "$dir" = "" ]
193 then
194 dir=$PWD
195 fi
196
197 cd $found
198 if [ -x configure ]
199 then
200 echo "Configuring..."
201 ./configure $CONFIG
202 fi
203 if [ "$lib" = "libcrypto.a" ]
204 then
205 if [ -f config ]
206 then
207 sh config
208 elif [ -x Configure ]
209 then
210 ./Configure 2>tmp.$$
211 cat tmp.$$
212 readln "Your system?" `cat tmp.$$ | tr ' ' '\n' | grep -i \`uname\` | tail -1`
213 rm -f tmp.$$
214 echo "Configuring..."
215 ./Configure $ans
216 fi
217 fi
218 cd $dir
219 fi
220 }
221
222 # Global installation.
223
224
225 ##########################################################################
226 umask 077
227
228 #FIXME -- Mixmaster now should be installed as root, and Install should
229 #create a remailer user. /var/spool/mixmaster is a good home.
230
231 if [ `whoami` = root ]
232 then
233 echo "Please create a new user, e.g, \`mix', and install Mixmaster under that
234 user id. Installing Mixmaster as root is not recommended."
235 readln "Continue anyway?" n
236 if [ "$ans" = n ]
237 then
238 exit 1
239 fi
240 fi
241
242 MIXDIR="$PWD"
243 if [ "$MIXDIR" = "" ]
244 then
245 MIXDIR=`pwd`
246 fi
247 MIXCFG="$MIXDIR/conf"
248 MIXSRC="$MIXDIR/Src"
249 MIXDEST0=${MIXPATH:-$HOME/Mix}
250
251 system=`uname`
252 if [ "$system" = "MS-DOS" ]
253 then
254 system=msdos
255 fi
256
257 if [ "$HOSTNAME" = "" ]
258 then
259 HOSTNAME=`hostname`
260 fi
261 if [ "$HOSTNAME" = "" ]
262 then
263 HOSTNAME=msdos
264 system=msdos
265 fi
266
267 if [ "$system" = msdos ]
268 then
269 MIXDEST0=${MIXPATH:-C:/Mix}
270 fi
271
272 if [ -f "$MIXSRC/Makefile" ]
273 then
274 if grep "#Makefile generated.*$HOSTNAME" $MIXSRC/Makefile
275 then
276 echo "Found a Makefile for this system."
277 readln "Use this Makefile?" y
278 if [ "$ans" = n ]
279 then
280 rm -f "$MIXSRC/Makefile"
281 fi
282 else
283 readln "Remove old Makefile?" y
284 if [ "$ans" = y ]
285 then
286 rm -f "$MIXSRC/Makefile"
287 fi
288 fi
289 fi
290
291 if [ -f "$MIXSRC/Makefile" ]
292 then
293 MIXDEST=`grep "DSPOOL=" $MIXSRC/Makefile | sed 's/.*DSPOOL=..//;s/\".*//'`
294 if [ "$MIXDEST" = "" ]
295 then
296 MIXDEST="$MIXDEST0"
297 fi
298 fi
299
300 if [ "$MIXDEST" = "" ]
301 then
302 readln "Mixmaster directory?" "$MIXDEST0"
303 MIXDEST=$ans
304 else
305 echo "Mixmaster directory: $MIXDEST"
306 fi
307
308 if [ ! -d "$MIXDEST" ]
309 then
310 echo "Creating directory $MIXDEST"
311 mkdir "$MIXDEST"
312 fi
313
314 if [ ! -d "$MIXDEST" ]
315 then
316 echo "Cannot not create $MIXDEST"
317 exit 1
318 fi
319
320 if [ -f "$MIXDEST/mix.cfg" ]
321 then
322 if [ -f "$MIXDEST/secring.mix" ]
323 then
324 remailer=y
325 if grep PASSPHRASE "$MIXDEST/mix.cfg" >/dev/null
326 then
327 PASSINCONFIG=1
328 fi
329 else
330 readln "Do you want to set up a remailer?" n
331 remailer=$ans
332 fi
333 elif [ -f "$MIXDEST/mixmaster.conf" ]
334 then
335 echo "Upgrading from Mixmaster 2.0.*"
336 remailer=n
337 else
338 readln "Do you want to set up a remailer?" y
339 remailer=$ans
340 fi
341
342
343 ans=""
344 if [ "$remailer" = "y" ]
345 then
346 ans="n"
347 if [ "$PASSINCONFIG" != 1 ]
348 then
349 echo ""
350 echo "You can either compile your secret passphrase into the binary
351 or you can set it in your config file. Note that the former does not
352 really increase security as the passphrase can still be discovered by
353 running something like \`strings mixmaster'."
354 echo ""
355 echo "Most users should answer \`n' to this question:"
356 echo ""
357 readln "Do you want to compile the passphrase into the binary?" n
358 fi
359
360 rm -f "$MIXSRC/mix.o" # make sure our new passphrase takes effect
361 if [ "$ans" = "y" ]
362 then
363 ans=""
364 echo "Please enter a passphrase for your remailer (must be the same
365 whenever you re-compile Mixmaster)."
366 read ans
367
368 if [ "$ans" != "" ]
369 then
370 PASS="PASS=$ans"
371 else
372 echo "WARNING: not setting a passphrase"
373 fi
374 else
375 if [ "$PASSINCONFIG" != 1 ]
376 then
377 ans=""
378 echo "Please enter a passphrase for your remailer (it will be
379 stored in mix.cfg in clear)."
380 read ans
381
382 if [ "$ans" = "" ]
383 then
384 echo "WARNING: setting empty passphrase"
385 fi
386 PASSPHRASE="PASSPHRASE $ans"
387 if [ -f $MIXDEST/mix.cfg ]
388 then
389 echo "$PASSPHRASE" >> $MIXDEST/mix.cfg
390 fi
391 fi
392 fi
393 fi
394
395
396 cd "$MIXSRC"
397 if [ ! -f Makefile ]
398 then
399 LIBS=
400 INC=
401 DEF=
402 LDFLAGS=
403
404 if [ ! -z "$PASS" ]
405 then
406 DEF="$DEF -DCOMPILEDPASS='\"\$(PASS)\"'"
407 fi
408
409 if [ "$system" = msdos ]
410 then
411 readln "Use WIN32 GUI?" y
412 if [ "$ans" = y ]
413 then
414 system=win32
415 LDFLAGS=-lwsock32
416 fi
417 fi
418 if [ "$system" = SunOS ]
419 then
420 LDFLAGS="-lsocket -lnsl"
421 fi
422
423 LIBDIR=
424 INCDIR=
425 SRCDIR=zlib*
426 findlib libz.a
427 if [ "$found" = "" ]
428 then
429 readln "Continue anyway?" n
430 if [ "$ans" = "n" ]
431 then
432 echo "Please install zlib 1.1.4 or 1.2.3 or greater now."
433 exit 1
434 fi
435 else
436 ZLIB="$MAKELIB"
437 DEF="$DEF -DUSE_ZLIB"
438 LIBS="$LIBS $LIB"
439 LDFLAGS="$LDFLAGS $LDFLAG"
440 if [ "$INCDIR" != "" ]
441 then
442 INC="$INC -I$INCDIR"
443 fi
444 fi
445
446 LIBDIR=
447 INCDIR="/usr/include /usr/include/pcre /usr/local/pcre/include"
448 SRCDIR=pcre*
449 findlib libpcre.a
450 if [ "$found" != "" ]
451 then
452 PCRE="$MAKELIB"
453 DEF="$DEF -DUSE_PCRE"
454 LIBS="$LIBS $LIB"
455 LDFLAGS="$LDFLAGS $LDFLAG"
456 if [ "$INCDIR" != "" ]
457 then
458 INC="$INC -I$INCDIR"
459 fi
460 fi
461
462 opensslinfo="Please get OpenSSL 0.9.6l or greater from http://www.openssl.org/"
463 opensslwarning6="WARNING: This version of OpenSSL contains known vulnerabilities. Please upgrade to OpenSSL 0.9.6l or greater!"
464 opensslwarning7="WARNING: This version of OpenSSL contains known vulnerabilities. Please upgrade to OpenSSL 0.9.7c or greater!"
465 opensslwarning0=$opensslwarning7
466 LIBDIR=/usr/local/ssl/lib
467 INCDIR="/usr/include /usr/include/ssl /usr/lib/ssl/include /usr/local/ssl/include"
468 SRCDIR="openssl*"
469
470 opensslwarn()
471 {
472 if [ "$1" = "6" ]
473 then
474 echo $opensslwarning6
475 elif [ "$1" = "7" ]
476 then
477 echo $opensslwarning7
478 else
479 echo $opensslwarning0
480 fi
481 readln "Continue anyway?" y
482 if [ "$ans" = "n" ]
483 then
484 echo $opensslinfo
485 exit 1
486 fi
487 }
488
489 if [ "$system" = win32 ]
490 then
491 findlib libeay32.a
492 else
493 findlib libcrypto.a
494 fi
495 if [ "$found" = "" ]
496 then
497 echo $opensslinfo
498 exit 1
499 fi
500
501 OPENSSLLIB="$LIB"
502 LIBS="$LIBS $LIB"
503 LDFLAGS="$LDFLAGS $LDFLAG"
504 if [ "$MAKELIB" != "" ]
505 then
506 OPENSSL="$found/$lib:
507 cd $found/crypto; make"
508 fi
509 if [ -d "$INCDIR/openssl" ]
510 then
511 INC="$INC -I$INCDIR"
512 else
513 # detect old SSLeay versions
514 if [ -f "$INCDIR/crypto.h" ]
515 then
516 version=800
517 if grep OPENSSL "$INCDIR/crypto.h" > /dev/null
518 then
519 version=920
520 fi
521 fi
522 fi
523
524 # Find the OpenSSL version header
525 if [ -f "$INCDIR/openssl/opensslv.h" ]
526 then
527 version=`grep 'SSL.*_VERSION_NUMBER.*0x' $INCDIR/openssl/opensslv.h | sed 's/.*0x0*//;s/[ ].*//;s/L$//' | tr '[a-f]' '[A-F]'`
528 elif [ -f "$INCDIR/opensslv.h" ]
529 then
530 version=`grep 'SSL.*_VERSION_NUMBER.*0x' $INCDIR/opensslv.h | sed 's/.*0x0*//;s/[ ].*//;s/L$//' | tr '[a-f]' '[A-F]'`
531 fi
532 if [ "$version" = "" ]
533 then
534 echo "Warning: Can't find OpenSSL version number!"
535 readln "Continue anyway?" y
536 if [ "$ans" = "n" ]
537 then
538 echo $opensslinfo
539 exit 1
540 fi
541 #
542 # Here we match against known OpenSSL versions
543 #
544 elif [ "$version" = "90581F" ]
545 then
546 decimalversion=9459743
547 echo "Compiling with OpenSSL 0.9.5a."
548 opensslwarn 6
549 elif [ "$version" = "90601F" ]
550 then
551 decimalversion=9461791
552 echo "Compiling with OpenSSL 0.9.6a."
553 opensslwarn 6
554 elif [ "$version" = "90602F" ]
555 then
556 decimalversion=9461807
557 echo "Compiling with OpenSSL 0.9.6b."
558 opensslwarn 6
559 elif [ "$version" = "90603F" ]
560 then
561 decimalversion=9461823
562 echo "Compiling with OpenSSL 0.9.6c."
563 opensslwarn 6
564 elif [ "$version" = "90604F" ]
565 then
566 decimalversion=9461839
567 echo "Compiling with OpenSSL 0.9.6d."
568 opensslwarn 6
569 elif [ "$version" = "90605F" ]
570 then
571 decimalversion=9461855
572 echo "Compiling with OpenSSL 0.9.6e."
573 opensslwarn 6
574 elif [ "$version" = "90606F" ]
575 then
576 decimalversion=9461871
577 echo "Compiling with OpenSSL 0.9.6f."
578 opensslwarn 6
579 elif [ "$version" = "90607F" ]
580 then
581 decimalversion=9461887
582 echo "Compiling with OpenSSL 0.9.6g."
583 opensslwarn 6
584 elif [ "$version" = "90608F" ]
585 then
586 decimalversion=9461903
587 echo "Compiling with OpenSSL 0.9.6h."
588 opensslwarn 6
589 elif [ "$version" = "90609F" ]
590 then
591 decimalversion=9461919
592 echo "Compiling with OpenSSL 0.9.6i."
593 opensslwarn 6
594 elif [ "$version" = "9060A0" ]
595 then
596 decimalversion=9461920
597 echo "Compiling with OpenSSL 0.9.6j."
598 opensslwarn 6
599 elif [ "$version" = "9060B0" ]
600 then
601 decimalversion=9461936
602 echo "Compiling with OpenSSL 0.9.6k."
603 opensslwarn 6
604 elif [ "$version" = "9060C0" ]
605 then
606 decimalversion=9461952
607 echo "Compiling with OpenSSL 0.9.6l."
608 elif [ "$version" = "9060D0" ]
609 then
610 decimalversion=9461968
611 echo "Compiling with OpenSSL 0.9.6m."
612 elif [ "$version" = "90700F" ]
613 then
614 decimalversion=9465871
615 echo "Compiling with OpenSSL 0.9.7."
616 opensslwarn 7
617 DEF="$DEF -DUSE_AES"
618 elif [ "$version" = "90701F" ]
619 then
620 decimalversion=9465887
621 echo "Compiling with OpenSSL 0.9.7a."
622 opensslwarn 7
623 DEF="$DEF -DUSE_AES"
624 elif [ "$version" = "90702F" ]
625 then
626 decimalversion=9465903
627 echo "Compiling with OpenSSL 0.9.7b."
628 opensslwarn 7
629 DEF="$DEF -DUSE_AES"
630 elif [ "$version" = "90703F" ]
631 then
632 decimalversion=9465919
633 echo "Compiling with OpenSSL 0.9.7c."
634 DEF="$DEF -DUSE_AES"
635 elif [ "$version" = "90704F" ]
636 then
637 decimalversion=9465935
638 echo "Compiling with OpenSSL 0.9.7d."
639 DEF="$DEF -DUSE_AES"
640 elif [ "$version" = "90705F" ]
641 then
642 decimalversion=9465951
643 echo "Compiling with OpenSSL 0.9.7e."
644 DEF="$DEF -DUSE_AES"
645 elif [ "$version" = "90706F" ]
646 then
647 decimalversion=9465967
648 echo "Compiling with OpenSSL 0.9.7f."
649 DEF="$DEF -DUSE_AES"
650 elif [ "$version" = "90707F" ]
651 then
652 decimalversion=9465983
653 echo "Compiling with OpenSSL 0.9.7g."
654 DEF="$DEF -DUSE_AES"
655 elif [ "$version" = "90708F" ]
656 then
657 decimalversion=9465999
658 echo "Compiling with OpenSSL 0.9.7h."
659 DEF="$DEF -DUSE_AES"
660 elif [ "$version" = "90709F" ]
661 then
662 decimalversion=9466015
663 echo "Compiling with OpenSSL 0.9.7i."
664 DEF="$DEF -DUSE_AES"
665 elif [ "$version" = "9070A0" ]
666 then
667 decimalversion=9466016
668 echo "Compiling with OpenSSL 0.9.7j."
669 DEF="$DEF -DUSE_AES"
670 elif [ "$version" = "90800F" ]
671 then
672 decimalversion=9469967
673 echo "Compiling with OpenSSL 0.9.8."
674 DEF="$DEF -DUSE_AES"
675 elif [ "$version" = "90801F" ]
676 then
677 decimalversion=9469983
678 echo "Compiling with OpenSSL 0.9.8a."
679 DEF="$DEF -DUSE_AES"
680 elif [ "$version" = "90802F" ]
681 then
682 decimalversion=9469999
683 echo "Compiling with OpenSSL 0.9.8b."
684 DEF="$DEF -DUSE_AES"
685
686 fi
687 #
688 # Now we try to guess about unknown versions:
689 #
690 if [ "$decimalversion" = "" ]
691 then
692 decimalversion=`echo 16i $version p | dc`
693 fi
694 if [ "$decimalversion" = "" ]
695 then
696 echo "Warning: This version: ${version} of OpenSSL is not recognized."
697 readln "Continue anyway?" y
698 if [ "$ans" = "n" ]
699 then
700 echo $opensslinfo
701 exit 1
702 else
703 echo "Does this version of OpenSSL contain AES support?"
704 readln "If unsure of the answer, say \`n'" n
705 if [ "$ans" = "y" ]
706 then
707 DEF="$DEF -DUSE_AES"
708 fi
709 fi
710 elif [ "$decimalversion" -lt "2336" ] # 920
711 then
712 echo "This version: ${version} of SSLeay is not supported."
713 echo $opensslinfo
714 exit 1
715 elif [ "$decimalversion" -lt "9449728" ] # 903100
716 then
717 echo "This version: ${version} of OpenSSL is not supported."
718 echo $opensslinfo
719 exit 1
720 elif [ "$decimalversion" -gt "9469967" ] # 90800F
721 then
722 echo "Warning: This version: ${version} of OpenSSL is untested."
723 readln "Continue anyway?" y
724 if [ "$ans" = "n" ]
725 then
726 echo $opensslinfo
727 exit 1
728 else
729 echo "Does this version of OpenSSL contain AES support?"
730 readln "If unsure of the answer, say \`n'" n
731 if [ "$ans" = "y" ]
732 then
733 DEF="$DEF -DUSE_AES"
734 fi
735 fi
736 fi
737
738 LIBDIR=
739 INCDIR=/usr/include/ncurses
740 SRCDIR=ncurses*
741 CONFIG=--enable-termcap
742 if [ "$TERMINFO" != "" ]
743 then
744 CONFIG="--datadir=$TERMINFO"
745 fi
746 if [ -d /usr/share/terminfo ]
747 then
748 CONFIG=
749 fi
750 if [ -d /usr/lib/terminfo ]
751 then
752 CONFIG=--datadir=/usr/lib/terminfo
753 fi
754
755 if [ `uname` = OpenBSD ]
756 then
757 findlib libcurses.a
758 else
759 findlib libncurses.a
760 fi
761 if [ "$found" = "" ]
762 then
763 if [ "$system" != win32 ]
764 then
765 readln "Do you want to use Mixmaster's menu-based user interface?" y
766 if [ "$ans" = "y" ]
767 then
768 echo "Please install ncurses now. It is available from http://www.clark.net/pub/dickey/ncurses/ncurses.tar.gz"
769 exit 1
770 fi
771 fi
772 else
773 DEF="$DEF -DUSE_NCURSES"
774 if [ "$type" = system -o "$type" = installed ]
775 then
776 LIBS="$LIBS $LIB"
777 LDFLAGS="$LDFLAGS $LDFLAG"
778 else
779 LIBS="$LIBS $found/lib/$lib"
780 NCURSES="$found/lib/$lib:
781 cd $found/ncurses; make ../lib/$lib"
782 fi
783 if [ "$INCDIR" != "" ]
784 then
785 INC="$INC -I$INCDIR"
786 elif [ -f "/usr/include/ncurses.h" ]
787 then
788 DEF="$DEF -DHAVE_NCURSES_H"
789 fi
790 fi
791
792 ideawarn()
793 {
794 echo "
795 WARNING: Your version of OpenSSL has been configured without IDEA support.
796 If you continue, Mixmaster will be installed with reduced functionality.
797 This means (among other things) that Mixmaster will not create an RSA
798 OpenPGP key (to avoid mail loss in the Type I system). You may want to
799 re-install OpenSSL before proceeding.
800
801 This will not concern you if you only plan to run a type II remailer or
802 simply want a type II client."
803 readln "Continue anyway?" y
804 if [ "$ans" = "n" ]
805 then
806 exit 1
807 fi
808 }
809
810 if [ "$system" = OpenBSD ]
811 then
812 LIBDIR=
813 INCDIR=
814 SRCDIR=idea*
815 findlib libidea.a
816 if [ "$found" = "" ]
817 then
818 ideawarn
819 else
820 DEF="$DEF -DUSE_IDEA"
821 IDEALIB="$MAKELIB"
822 LIBS="$LIBS $LIB"
823 LDFLAGS="$LDFLAGS $LDFLAG"
824 if [ "$INCDIR" != "" ]
825 then
826 INC="$INC -I$INCDIR"
827 fi
828 fi
829 elif [ "$system" = msdos -o "$system" = win32 ]
830 then
831 DEF="$DEF -DUSE_IDEA"
832 else
833 echo "Checking for IDEA support..."
834 cat <<END >tmptst.c
835 #include <openssl/idea.h>
836 int main() {
837 void *dummy;
838 dummy = idea_cfb64_encrypt;
839 exit(0);
840 }
841 END
842 if gcc $LDFLAGS $INC tmptst.c -o tmptst $OPENSSLLIB
843 then
844 DEF="$DEF -DUSE_IDEA"
845 else
846 ideawarn
847 fi
848 rm -f tmptst.c tmptst
849 fi
850
851 echo "testing for setenv()..."
852 cat <<END >tmptst.c
853 int main() {
854 #include <stdlib.h>
855 setenv("TZ", "GMT", 0);
856 exit(0);
857 }
858 END
859 if gcc tmptst.c -o tmptst
860 then
861 DEF="$DEF -DHAVE_SETENV"
862 fi
863 echo "done"
864 rm -f tmptst.c tmptst
865
866 # if [ "$MIXDEST" = "$HOME/Mix" ]
867 # then
868 # SPOOL=
869 # else
870 SPOOL=-DSPOOL=\'\"$MIXDEST\"\'
871 # fi
872
873 echo "Generating Makefile."
874 echo "#Makefile generated on $HOSTNAME `date`" >Makefile
875 sed -e "s#%MIXDIR#$SPOOL#" \
876 -e "s#%LIBS#$LIBS#" \
877 -e "s#%LDFLAGS#$LDFLAGS#" \
878 -e "s#%INC#$INC#" \
879 -e "s#%DEF#$DEF#" < Makefile.in >> Makefile
880 # echo "$ZLIB" >>Makefile
881 # echo "$PCRE" >>Makefile
882 echo "$IDEALIB" >>Makefile
883 echo "$NCURSES" >>Makefile
884 echo "$OPENSSL" >>Makefile
885 fi
886
887
888
889
890
891 echo "Compiling. Please wait."
892 whereis make
893 make=$found
894
895 if [ "$system" = win32 ]
896 then
897 # (cd zlib*; make libz.a)
898 # (cd pcre*; make libpcre.a)
899 if [ "$PASS" != "" ]
900 then
901 $make "$PASS" dllmix
902 else
903 $make dllmix
904 fi
905 else
906 if [ "$PASS" != "" ]
907 then
908 $make "$PASS"
909 else
910 $make
911 fi
912 fi
913
914 if [ -x mixmaster ]
915 then
916 echo
917 else
918 echo "Error: The compilation failed. Please consult the documentation (section
919 \`Installation problems')."
920 readln "Remove the old Makefile?" y
921 if [ "$ans" = y ]
922 then
923 rm -f Makefile
924 fi
925 exit 1
926 fi
927
928 if [ -f "$MIXDEST/mixmaster.conf" -a ! -f "$MIXDEST/mix.cfg" ]
929 then
930 export MIXDEST
931 export MIXDIR
932 export MIXSRC
933 "${MIXDIR}/upgrade"
934 exit 0
935 fi
936
937 if [ -f mixmaster.exe ]
938 then
939 cp mixmaster.exe "$MIXDEST"
940 else
941 cp mixmaster "$MIXDEST"
942 fi
943
944 cd "$MIXCFG"
945 for i in mlist.txt pubring.mix rlist.txt pubring.asc
946 do
947 if [ ! -f "$MIXDEST/$i" ]
948 then
949 cp "$i" "$MIXDEST"
950 fi
951 done
952
953 if [ "$remailer" = "y" ]
954 then
955 cd "$MIXCFG"
956 for i in adminkey.txt dest.alw
957 do
958 if [ ! -f "$MIXDEST/$i" ]
959 then
960 cp "$i" "$MIXDEST"
961 fi
962 done
963 fi
964
965 if [ "$remailer" = "n" ]
966 then
967 if [ ! -f "$MIXDEST/mix.cfg" ]
968 then
969 whereis sendmail /usr/lib/sendmail /usr/sbin/sendmail
970 echo "SENDMAIL $found -t" >"$MIXDEST/mix.cfg"
971 cat mix.cfg >>"$MIXDEST/mix.cfg"
972 fi
973 echo "Client installation complete."
974 exit
975 fi
976
977 for i in *.blk
978 do
979 if [ ! -f "$MIXDEST/$i" ]
980 then
981 cp "$i" "$MIXDEST"
982 fi
983 done
984
985 cd "$MIXDEST"
986
987 installed=n
988 if [ -f mix.cfg ]
989 then
990 if grep REMAILERADDR mix.cfg >/dev/null
991 then
992 installed=y
993 fi
994 fi
995
996 if [ "$installed" = "n" ]
997 then
998 Date=`date`
999 whereis sendmail /usr/lib/sendmail /usr/sbin/sendmail
1000 sendmail=$found
1001
1002 echo "Mixmaster can be installed in the low-maintenance \`middleman' mode.
1003 In that mode, it will send mail to other remailers only, to avoid
1004 complaints about anonymous messages."
1005 readln "Install as middleman?" n
1006 middle=$ans
1007
1008 readln "The e-mail address of your remailer:" `whoami`@$HOSTNAME
1009 RMA=$ans
1010
1011 echo "Do you want Mixmaster to send auto-replies to messages it does not
1012 understand (If the address <$RMA> is also used"
1013 readln "for mail to be read by a human, type \`n')?" y
1014 autoreply=$ans
1015
1016 if [ "$middle" = n ]
1017 then
1018 readln "An address to appear in the \`From:' line of anonymous messages:" `echo $RMA | sed 's/.*@/nobody@/'`
1019 RAA=$ans
1020
1021 readln "Address for complaints to be sent to:" `echo $RMA | sed 's/.*@/abuse@/'`
1022 CA=$ans
1023 else
1024 RAA=$RMA
1025 CA=$RMA
1026 fi
1027
1028 echo "Choose a name for your remailer. It will appear in remailer status messages."
1029 readln "Long name:" "Anonymous Remailer"
1030 RMN=$ans
1031
1032 if [ "$middle" = n ]
1033 then
1034 echo "Choose a name to be used in the \`From:' line of remailed messages."
1035 readln "Anon long name:" "Anonymous"
1036 RAN=$ans
1037 fi
1038
1039 readln "A short name to appear in lists:" `echo $HOSTNAME|sed 's/\..*//'`
1040 SN=$ans
1041
1042 readln "Accept Mixmaster (Type II) messages?" y
1043 mix=$ans
1044
1045 readln "Accept PGP (Type I) remailer messages?" n
1046 pgp=$ans
1047
1048 unencrypted=n
1049 if [ "$pgp" = "y" ]
1050 then
1051 readln "Accept unencrypted remailer messages?" n
1052 unencrypted=$ans
1053 fi
1054
1055 echo "Mixmaster will log error messages and warnings. Do you want to log"
1056 readln "informational messages about normal operation as well?" y
1057 if [ "$ans" = y ]
1058 then
1059 verbose=2
1060 else
1061 verbose=1
1062 fi
1063
1064 readln "Filter binary attachments?" n
1065 binfilter=$ans
1066
1067 if [ "$middle" = n ]
1068 then
1069 if [ "$autoreply" = y ]
1070 then
1071 readln "Allow users to add themselves to the list of blocked addresses?" y
1072 autoblock=$ans
1073 fi
1074
1075 echo "Do you want to allow posting? Newsgroups can be restricted in dest.blk.
1076 y)es, post locally; use m)ail-to-news gateway; n)o."
1077 readln "Allow posting to Usenet?" m
1078 post="$ans"
1079 if [ "$ans" = y ]
1080 then
1081 whereis inews /usr/lib/news/inews
1082 readln "News posting software:" "$found -h"
1083 news=$ans
1084 readln "Organization line for anonymous Usenet posts:" "Anonymous Posting Service"
1085 orga=$ans
1086 readln "Use anti-spam message IDs?" y
1087 mid=$ans
1088 elif [ "$ans" = m ]
1089 then
1090 readln "Mail-to-news gateway:" mail2news@nym.alias.net
1091 news=$ans
1092 fi
1093 fi
1094
1095 # Commented the poolsize question out, since poolsize is the least
1096 # important of the three pool parameters.
1097 #
1098 # echo "How many messages do you want to keep in the reordering pool?
1099 #A larger pool is more secure, but also causes higher latency.
1100 #0 means to remail immediately."
1101 # readln "Pool size:" 45
1102 # poolsize=$ans
1103
1104 mbox=
1105 if [ -f ~/.forward ]
1106 then
1107 mbox=`head -1 ~/.forward | sed 's/^"//;s/"$//'`
1108 if echo "$mbox" | grep 'mix' >/dev/null 2>/dev/null
1109 then
1110 mbox=
1111 elif echo "$mbox" | grep 'procmail' >/dev/null 2>/dev/null
1112 then
1113 if grep mix ~/.procmailrc >/dev/null 2>/dev/null
1114 then
1115 mbox=
1116 fi
1117 fi
1118 fi
1119
1120 if [ "$mbox" = "" ]
1121 then
1122 mbox=${MAIL:-/usr/spool/mail/$NAME}
1123 touch "$mbox"
1124 if [ ! -w "$mbox" ]
1125 then
1126 echo "$mbox is not writeable."
1127 readln "Mailbox for non-remailer messages:" "${MIXDEST}/mbox"
1128 mbox=$ans
1129 fi
1130 fi
1131
1132 cat <<END >mix.cfg
1133 # mix.cfg -- installed $Date
1134 SENDMAIL $sendmail -t
1135
1136 # Where to store non-remailer messages:
1137 MAILBOX $mbox
1138 #MAILABUSE mbox.abuse
1139 #MAILBLOCK mbox.block
1140 #MAILUSAGE mbox.usage
1141 #MAILANON mbox.anon
1142 #MAILERROR mbox.error
1143 #MAILBOUNCE mbox.bounce
1144
1145 REMAIL y
1146 MIDDLEMAN $middle
1147
1148 BINFILTER $binfilter
1149 AUTOBLOCK $autoblock
1150
1151 ERRLOG error.log
1152 VERBOSE $verbose
1153
1154 # Remailer name and addresses
1155 REMAILERADDR $RMA
1156 ANONADDR $RAA
1157 COMPLAINTS $CA
1158
1159 SHORTNAME $SN
1160 REMAILERNAME $RMN
1161 ANONNAME $RAN
1162
1163 # Supported formats:
1164 MIX $mix
1165 PGP $pgp
1166 UNENCRYPTED $unencrypted
1167
1168 # Maximum message size in kB (0 for no limit):
1169 SIZELIMIT 0
1170
1171 # Usenet news:
1172 NEWS $news
1173 ORGANIZATION $orga
1174 MID $mid
1175
1176 # Remailing strategy:
1177 SENDPOOLTIME 15m
1178 POOLSIZE 45
1179 RATE 65
1180 INDUMMYP 10
1181 OUTDUMMYP 90
1182 CHAIN *,*,*,*
1183 IDEXP 7d
1184 PACKETEXP 7d
1185
1186 $PASSPHRASE
1187
1188 END
1189
1190 fi # not yet installed
1191
1192
1193 REPLACE="s/%RMN/$RMN/g;s/%RMA/$RMA/g;s/%CA/$CA/g;s/%RAA/$RAA/g"
1194 if [ "$installed" = "n" ]
1195 then
1196 cd "$MIXCFG"
1197 if [ ! -f "$MIXDEST/help.txt" ]
1198 then
1199 sed "$REPLACE" < intro.hlp >"$MIXDEST/help.txt"
1200 if [ "$mix" = y ]
1201 then
1202 sed "$REPLACE" < mix.hlp >>"$MIXDEST/help.txt"
1203 fi
1204 if [ "$unencrypted" = y ]
1205 then
1206 sed "$REPLACE" < type1.hlp >>"$MIXDEST/help.txt"
1207 if [ "$pgp" = y ]
1208 then
1209 sed "$REPLACE" < pgp.hlp >>"$MIXDEST/help.txt"
1210 fi
1211 elif [ "$pgp" = y ]
1212 then
1213 sed "$REPLACE" < pgponly.hlp >>"$MIXDEST/help.txt"
1214 fi
1215 if [ "$post" = y ]
1216 then
1217 if [ "$pgp" = y -o "$unencrypted" = y ]
1218 then
1219 sed "$REPLACE" < news.hlp >>"$MIXDEST/help.txt"
1220 fi
1221 fi
1222 sed "$REPLACE" < end.hlp >>"$MIXDEST/help.txt"
1223 fi
1224
1225 for i in *.txt.in
1226 do
1227 j=`echo $i | sed 's/\.in$//'`
1228 if [ ! -f "$MIXDEST/$j" ]
1229 then
1230 sed "$REPLACE" < "$i" >"$MIXDEST/$j"
1231 fi
1232 done
1233 cd "$MIXDEST"
1234 fi
1235
1236 echo
1237 if [ ! -f secring.mix ]
1238 then
1239 echo "Generating secret keys. This may take a while..."
1240 else
1241 echo "Updating secret keys..."
1242 fi
1243 ./mixmaster -K
1244 if [ -f key.txt ]
1245 then
1246 echo "Done."
1247 echo
1248 else
1249 echo "Installation failed. Please consult the Mixmaster documentation."
1250 exit 1
1251 fi
1252
1253 if [ "$system" = msdos -o "$system" = win32 ]
1254 then
1255 exit
1256 fi
1257
1258 umask 033
1259
1260 # Set .forward?
1261 #
1262 set=y
1263 # FIXME -- Mixmastger should run in daemon mode, not from procmail
1264 # Make the Install script do that.
1265
1266 if grep procmail ~/.forward >/dev/null 2>/dev/null
1267 then
1268 if grep mix ~/.procmailrc >/dev/null 2>/dev/null
1269 then
1270 echo "Mixmaster is installed in your .procmailrc file."
1271 set=n
1272 fi
1273 fi
1274
1275 if [ "$set" = y -a -f ~/.forward ]
1276 then
1277 echo "Your current .forward is:"
1278 cat ~/.forward
1279 echo
1280 if grep mix ~/.forward >/dev/null 2>/dev/null
1281 then
1282 echo "Mixmaster already is installed in your .forward file."
1283 set=n
1284 elif [ "$mbox" != "" ]
1285 then
1286 if echo "$mbox" | grep '|' >/dev/null 2>/dev/null
1287 then
1288 echo "Mixmaster will pipe messages to $mbox"
1289 elif echo $mbox | grep '@' >/dev/null 2>/dev/null
1290 then
1291 echo "Mixmaster will forward messages to $mbox"
1292 else
1293 echo "Mixmaster will store messages to $mbox"
1294 fi
1295 fi
1296 fi
1297
1298 if [ "$set" = y ]
1299 then
1300 echo "Set .forward to the following line:"
1301 echo "\"|${MIXDEST}/mixmaster -RM\""
1302 if [ -f ~/.forward ]
1303 then
1304 readln "Overwrite now?" n
1305 else
1306 readln "Do that now?" n
1307 fi
1308 if [ "$ans" = "y" ]
1309 then
1310 echo "\"|${MIXDEST}/mixmaster -RM\"" >~/.forward
1311 fi
1312 fi
1313
1314 #FIXME -- we need a second script that can re-generate help files
1315 # when the conf changes.
1316
1317 if [ "$RMA" != "" ]
1318 then
1319 echo "
1320 Mixmaster will send the following files as auto-replies:
1321 Mail to <$RMA> with Subject: remailer-help => help.txt"
1322 echo "Mail to <$RMA> with Subject: remailer-adminkey => adminkey.txt
1323 Remember to add your Remailer Admin public PGP key to the adminkey.txt file."
1324 if [ "$autoblock" = y ]
1325 then
1326 echo "Mail to <$RMA> with line DESTINATION-BLOCK => blocked.txt"
1327 fi
1328 if [ "$autoreply" = y ]
1329 then
1330 echo "Other mail to <$RMA> => usage.txt"
1331 echo
1332 if [ "$CA" != "$RMA" ]
1333 then
1334 echo "If you arrange for mail to <$CA> and <$RAA>
1335 to be forwarded to <$RMA>:
1336 Mail to <$CA> => abuse.txt
1337 Mail to <$RAA> => reply.txt"
1338 fi
1339 fi
1340 fi
1341
1342 echo
1343 echo "Mixmaster installation complete."
1344

Properties

Name Value
svn:executable *
svn:keywords Id

  ViewVC Help
Powered by ViewVC 1.1.5