-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·1372 lines (1188 loc) · 37.5 KB
/
install.sh
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
#
# new age sh (SUSv2 etc) are supposed to handle our syntax
# but if that's not true, try a bash or ksh here.
#
# we could also use a strategy for finding the best bash or ksh
# on this system and re-execing ourselves because an old bourne
# shell will not be able to deal with this script completely
####### psyced installation script #######
#
# original version 2000-08-22 by Kai 'Oswald' Seidler (oswaldism.de)
# heavy improvements by heldensaga and psyc://psyced.org/~lynX
# switched from function foo to foo() syntax as suggested by cebewee
#
#######
# Use 'ldmud' here if you want to use an ldmud rather than a psyclpc'
#driver="ldmud"
#zip="gz"
#zipcmd="gzip"
#
# psyclpc as obtained from http://lpc.psyc.eu
driver="psyclpc"
zip="bz2"
zipcmd="bzip2"
# useful for debugging - see what files it would produce
exit="exit 1"
rm="rm"
#exit="echo [debug] Not exiting."
#rm="echo [debug] Not removing"
DATA_PERM="700"
BASE_PERM="700"
CONF_PERM="700"
UMASK="7"
hi="[1m"
lo="[m"
if test -d "/etc/portage"
then
cat <<X
!!${hi} HEY YOU, PORTAGE USER ${lo}!!
If you are running gentoo/portage you should try out our beautiful ebuilds
at http://www.psyced.org/files/gentoo.tar.bz2 instead of this installation
script. Stop it now.
${hi}Warning: OLD-SCHOOL install.sh STARTING${lo} ...
X
sleep 2
fi
if test -e .config
then
cat <<X
You have been installing this before. I will use the previous install .config
as defaults for this run.
X
else
cat <<X
Should you want to use the install settings from the last time you installed
psyced, please copy the .config file into here and restart this script.
X
fi
if touch .config 2> /dev/null
then
:
else
# ok, ich kann die .config nicht touchen
if rm -f .config 2>/dev/null
then
# aber ich kann sie loeschen
touch .config
else
# echt scheisse
echo "I need write permissions for this directory. Please!!"
$exit
fi
fi
chmod 700 .config
arch=`uname -s | tr "A-Z" "a-z"`
userid=`id | sed "s/).*//" | sed "s/.*(//"`
if test "`echo -n`" = ""
then
echo="echo -n"
echo_nlf=""
else
echo="echo"
echo_nlf="\c" # "
fi
echo ""
yacc=`which yacc`
bison=`which bison`
if test "$yacc" = "" -a "$bison" = ""
then
# tjgillies says: on fedora bison doen't symlink to yacc
echo "Please install 'yacc' or 'bison' on this system."
$exit
fi
#echo "Using '$bison' or '$yacc' during the compilation process."
if test -f "/usr/include/openssl/ssl.h"
then
tls="y"
else
tls="n"
echo ""
echo "${hi}Warning: ${lo}You are apparently missing the OpenSSL header files!"
echo "If you're on debian/ubuntu you may have to 'apt-get install libssl-dev' now"
echo "or your psyclpc will compile without support for encryption."
sleep 2
fi
ask() {
echo ""
eval $echo \"\$1 [\$$2]? $echo_nlf\"
read answer
if test "$answer" = ""
then
eval answer="\$$2"
fi
eval $2=\"$answer\"
save "$2" "$answer"
}
save() {
touch .config
egrep -v "^$1=" .config > .config.tmp
echo "$1=\"$2\"" >> .config.tmp
mv .config.tmp .config
}
get() {
touch .config
eval `egrep "^$1=" .config`
eval tmp=\"\$$1\"
if test "$tmp" = "" -a "$2" != ""
then
eval $1="$2"
fi
}
#uid() {
# id|sed 's/uid=//
# s/(.*//'
#}
getuid() {
egrep "^$1:" /etc/passwd | awk -F: '{print $3}'
}
getgid() {
egrep "^$1:" /etc/group | awk -F: '{print $3}'
}
###############################################################################
# INTERVIEW
###############################################################################
echo ""
echo ""
echo "${hi}PSYCED INSTALLATION WIZARD${lo}"
if ! test -e data.tar && ! test -d .git
then
cat <<X
This installation script is designed to work with an image of the current
development tree in a file called data.tar. Obtain a psyced release tar from
http://www.psyced.org, which contains both this script and its data.tar.
X
$exit
fi
#get WITHOUT_DRIVER "n"
WITHOUT_DRIVER="n"
echo ""
if test -d .git
then
:
elif test `ls -1 ${driver}-*tar.${zip} 2>/dev/null |wc -l` -gt 1
then
echo "${hi}ATTENTION:${lo} you've got more than one ${driver}-*tar.${zip}"
echo "in this directory. Please tidy up before continuing!"
$exit
else
if test `ls -d1 */src 2>/dev/null |wc -l` -gt 1
then
echo "${hi}ATTENTION:${lo} you've got more than one ${driver}"
echo "(sub)directory in this directory. Please tidy up before continuing!"
$exit
else
if ! test `ls -1 ${driver}-*tar.${zip} 2>/dev/null`
then
echo "${hi}ATTENTION: ${lo}You have no ${driver}-*.tar.${zip} in this directory."
echo "Please obtain one from http://lpc.psyc.eu."
# echo "Please obtain one from http://www.psyced.org/ldmud (stable) or"
# echo "http://www.bearnip.com/lars/proj/ldmud-dev.html (bleeding edge),"
# echo "then restart this script."
# echo "If you're interested in LPC, inspect http://lpc.pages.de"
ask "Continue without $driver" WITHOUT_DRIVER
if ! test $WITHOUT_DRIVER = "y"
then
# bart meint, man sollte das .config hier loeschen
rm -f .config 2>/dev/null
$exit
fi
else
echo "I can see you have a ${driver} tar here. That's good."
echo ""
fi
fi
fi
echo ""
echo "${hi}INSTALLATION SPECIFIC QUESTIONS${lo}"
echo ""
echo "Please specify the directory path where to install the psyced components."
echo "userid = $userid"
# does `whoami || who am i` work for solaris etc?
#if test `whoami` = root
if test "x$userid" != "xroot"
then
BASE_DIR="$HOME/psyced"
CONFIG_DIR=$BASE_DIR
echo "Since you started the installation not as root, you will see non-root defaults."
else
if test -d /opt
then
BASE_DIR="/opt/psyced"
else
BASE_DIR="/usr/local/psyced"
fi
CONFIG_DIR="/etc/psyc"
CONF_PERM="750"
fi
get BASE_DIR
ask "PSYCED installation directory" BASE_DIR
echo "[base directory is set to $BASE_DIR]"
if test -f $BASE_DIR
then
echo ""
echo "$BASE_DIR already exists."
echo "Please make a backup and remove it or choose another directory."
$exit
fi
# one day we should seperate variable files from static files better
LOG_DIR="$BASE_DIR/log"
DATA_DIR="$BASE_DIR/data"
LIB_DIR="$BASE_DIR/world"
echo ""
echo "psyconf will automatically search /etc/psyc for psyced.ini."
echo "If you plan to put this file anywhere else, you will have to"
echo "pass it as the argument to psyconf."
get CONFIG_DIR
ask "PSYCED configuration directory" CONFIG_DIR
echo "[config directory is set to $CONFIG_DIR]"
echo ""
# setting up ARCH_DIR directly because there is no need to bother the
# user with such a detail. if you think we should, then fix all the
# 'i have a feeling' places in this file and make psyconf use ARCH_DIR too
ARCH_DIR="$BASE_DIR/bin-$arch"
echo "[binary directory is $ARCH_DIR]"
#echo "Where do you want to install architecture dependent PSYC binaries?"
#
## uname -m returns "Power Macintosh" on macosx. very unuseful.
##get ARCH_DIR "$BASE_DIR/bin-`uname -m`"
## why did we call uname twice anyway? uname -s returns such a nice "darwin"
## on linux it returns the actual processor type (i686, x86_64, etc)
## which these days needs to be considered.. FIXME
##
#get ARCH_DIR "$BASE_DIR/bin-$arch"
#ask "Binary installation directory" ARCH_DIR
#echo "[binary directory is set to $ARCH_DIR]"
echo ""
echo ""
echo "Hostname would typically be 'psyc' or 'dishwasher' without a domain name"
echo "which is going to be the next question. If you want to install psyced as"
echo "something like 'example.net' use 'example' here and 'net' on the next"
echo "input line."
get HOST_NAME `hostname | sed "s/\..*//"`
ask "Server host name" HOST_NAME
# freebsd does not support -sil, other systems don't even have nslookup
#get DOMAIN_NAME `nslookup -sil $HOST_NAME | tail -n 3 | head -n 1 | sed "s/[^.]*\.//"`
# this grep isn't safe from having spaces behind the domain name or suchlike
get DOMAIN_NAME "" # `grep ^domain /etc/resolv.conf | sed "s/^domain.//"`
ask "Your domain name" DOMAIN_NAME
#get HOST_IP "127.0.0.1"
get HOST_IP
# `nslookup -sil $HOST_NAME | tail -n 2 | head -n 1 | awk '{print $2}' | sed "s/,//"`
echo ""
echo "If you have a static IP address for your server, please tell me."
echo "Otherwise I will resolve my own hostname at runtime in order to get my"
echo "current IP address."
ask "Server IP address" HOST_IP
echo ""
get USER "psyc"
if test "x$USER" = "xroot"; then
echo ""
echo "You shouldn't run psyced as root, so what about a 'psyc' user?"
# indigo6 thinks we should run useradd here, even if some unices
# do not provide that command. we can >/dev/null the error though...
echo "If the user doesn't exist yet, please make one."
fi
#while true
#do
ask "Which user do you want to run psyced as" USER
# if id -u $USER > /dev/null
# then
# echo "[User $USER selected.]"
# break
# fi
#echo "No such user."
# continue
#done
get GROUP "psyc"
#while true
#do
echo "If such a group doesn't exist yet, please create it now."
ask "Which group do you want to run psyced as" GROUP
# if `id -Gn $USER | grep $GROUP > /dev/null`
# then
# echo "[Group $GROUP selected.]"
# break
# fi
# echo "No such group or you are not a member of it."
# continue
#done
if test "x$USER" != "x$userid" -a "x$userid" != "xroot"
then
echo "You want to install files as $USER. Please change to this user or become root."
$exit
fi
echo ""
echo "Where do you want psyced runtime output? For manually started development"
echo "servers choose 'console', for background daemon service use 'files'."
echo ""
echo "['files' for log files, 'console' for server console]"
# replace "files" by "buffered" vs. "flushed" .. see also TODO
get RUNTIME_OUTPUT "files"
while true
do
ask "Send server runtime output to" RUNTIME_OUTPUT
if test "$RUNTIME_OUTPUT" = "console" -o "$RUNTIME_OUTPUT" = "files"
then
break
else
echo "Please choose 'files' or 'console' output."
fi
done
#echo "[server output goes to $RUNTIME_OUTPUT]"
## BUG IN ORDER!!! we dont have $PSYC_PORT yet!!!!! TODO!!111
## also HOST_IP may be empty
RUNTIME_OUTPUT_DIR="$LOG_DIR/$HOST_IP-$PSYC_PORT"
RUNTIME_OUTPUT_STDERR="$RUNTIME_OUTPUT_DIR/stderr"
RUNTIME_OUTPUT_STDOUT="$RUNTIME_OUTPUT_DIR/stdout"
if test "$RUNTIME_OUTPUT" = "files"
then
echo "[runtime output log directory is $RUNTIME_OUTPUT_DIR/.]"
get DEBUG "0"
else
get DEBUG "1"
fi
echo ""
echo "Debug level 0 gives you minimum output, level 1 gives you interesting"
echo "output. Level 2 and more is for real down-to-earth debugging. It gives"
echo "you messages that will make you think something is going wrong even if"
echo "everything is going fine, so please use level 1 unless you are going"
echo "to read the source code for every nervous message you see. ;-)"
ask "Debug level (0..2)" DEBUG
#echo "[debug level set to $DEBUG]"
echo ""
echo ""
echo "${hi}PSYC SPECIFIC OPTIONS${lo}"
echo ""
echo "Set the PSYC identification for your server. e.g. psyc.$DOMAIN_NAME."
echo "If you are using dial-up internet, you can try out a few things, but"
echo "if you want this software to serve a serious purpose you need to have"
echo "a dynamic DNS address for this machine installed and provide it here."
echo "A static address is even better. See the FIRSTSTEPS document for more."
#get SERVER_HOST "$HOST_NAME.$DOMAIN_NAME"
SERVER_HOST="$HOST_NAME.$DOMAIN_NAME"
ask "Set PSYC hostname to" SERVER_HOST
get CHATNAME $HOST_NAME
#ask "Name of your chat service" CHATNAME
cat <<X
Now comes the best part. You get to decide which of the many protocols and
services that psyced provides you want to activate. Since ${driver} doesn't
have the ability to run safely as root, all protocols use non-privileged
port numbers. We also mention the official privileged port numbers in case
you want to set up a firewall based port mapping.
If you need to change the port numbers later on, you can do so by editing
the psyconf.ini configuration file.
X
# FIXME: in fact we should probably not ask about port numbers here
get PSYC_YN "y"
ask "Enable PSYC (you better say yes here)" PSYC_YN
if test "$PSYC_YN" = "n"
then
PSYC_PORT=""
echo "[PSYC disabled. Ouch!]"
UDP=""
else
get PSYC_PORT "4404"
#
# if i'm not mistaken all ports are now passed to the mudlib so
# there is no reason to make *any* limitations here
# we could delete the "between" ranges from all protocols
#
# ask "Which port number between 4400 and 4409" PSYC_PORT
ask "Which port number " PSYC_PORT
echo "[PSYC enabled on port $PSYC_PORT.]"
UDP="-u $PSYC_PORT"
fi
echo ""
echo ""
echo "${hi}PSYCED REGULAR PROTOCOL SERVICES${lo}"
get INTERJABBER_YN "y"
ask "Enable XMPP communication with other JABBER servers" INTERJABBER_YN
if test "$INTERJABBER_YN" = "n"
then
INTERJABBER_PORT=""
echo "[JABBER S2S disabled.]"
else
get INTERJABBER_PORT "5269"
echo "Note: If you change the port number, you will have to set up DNS SRV records"
ask "Which port number" INTERJABBER_PORT
echo "[JABBER interserver communication enabled on port $INTERJABBER_PORT.]"
fi
get IRC_YN "y"
ask "Enable access for IRC clients" IRC_YN
if test "$IRC_YN" = "n"
then
IRC_PORT=""
echo "[IRC client access disabled.]"
else
get IRC_PORT "6667"
ask "Which port number between 6600 and 6699" IRC_PORT
echo "[IRC client access enabled on port $IRC_PORT.]"
fi
get JABBER_YN "y"
ask "Enable access for Jabber/XMPP clients" JABBER_YN
if test "$JABBER_YN" = "n"
then
JABBER_PORT=""
echo "[JABBER client access disabled.]"
else
get JABBER_PORT "5222"
ask "Which port number (5222 or 55222)" JABBER_PORT
echo "[JABBER client access enabled on port $JABBER_PORT.]"
fi
get SMTP_YN "n"
ask "Enable SMTP reception server (only for messaging)" SMTP_YN
if test "$SMTP_YN" = "n"
then
SMTP_PORT=""
echo "[SMTP server disabled.]"
else
get SMTP_PORT "2525"
ask "Which port number between 2500 and 2599" SMTP_PORT
echo "[SMTP server enabled on port $SMTP_PORT (official 25).]"
fi
get POP3_YN "n"
ask "Enable POP3 server (experimental)" POP3_YN
if test "$POP3_YN" = "n"
then
POP3_PORT=""
echo "[POP3 server disabled.]"
else
get POP3_PORT "1100"
ask "Which port number should we use" POP3_PORT
echo "[POP3 server enabled on port $POP3_PORT (official 110).]"
fi
get NNTP_YN "n"
ask "Enable access for NNTP readers (experimental)" NNTP_YN
if test "$NNTP_YN" = "n"
then
NNTP_PORT=""
echo "[NNTP reader access disabled.]"
else
get NNTP_PORT "1199"
ask "Which port number between 1190 and 1199" NNTP_PORT
echo "[NNTP reader access enabled on port $NNTP_PORT (official 119).]"
fi
get TELNET_YN "y"
ask "Enable telnet access" TELNET_YN
if test "$TELNET_YN" = "n"
then
TELNET_PORT=""
echo "[telnet access disabled.]"
else
# if ! test `whoami` = "root"
# then
# TELNET_PORT="2323"
# fi
# if egrep "^telnet" /etc/inetd.conf > /dev/null 2>&1
# then
# TELNET_PORT="2323"
# else
# if test `whoami` = "root"
# then
# TELNET_PORT="23"
# echo "[According to your /etc/inetd.conf your system doesn't run any"
# echo "telnetd on port 23. You may want psyced to use this port!]"
# fi
# fi
get TELNET_PORT 2323
ask "Which port between 2300 and 2399 to use for telnet" TELNET_PORT
echo "[telnet access enabled on port $TELNET_PORT (instead of 23).]"
fi
echo ""
echo "HTTP is necessary for the social network functions, the web-based "
echo "configuration, various chatroom export features and the WAP gateway.. "
get HTTP_YN "y"
ask "Enable builtin HTTP daemon" HTTP_YN
webconfig=""
if test "$HTTP_YN" = "n"
then
HTTP_PORT=""
echo "[HTTP service disabled.]"
else
get HTTP_PORT 44444
ask "Which port number" HTTP_PORT
echo "[HTTP service enabled on port $HTTP_PORT (instead of 80).]"
# currently not in use and not configured by install.sh
HTTPCONFIG_YN="n"
# get HTTPCONFIG_YN "y"
# ask "Activate web-based configuration for localhost users" HTTPCONFIG_YN
#
# if test "$HTTPCONFIG_YN" = "n"
# then
# echo "[WEB_CONFIGURE disabled.]"
# else
# echo "[WEB_CONFIGURE enabled.]"
# webconfig="#define WEB_CONFIGURE"
# fi
fi
get APPLET_YN "n"
ask "Enable applet access" APPLET_YN
if test "$APPLET_YN" = "n"
then
APPLET_PORT=""
echo "[applet access disabled.]"
else
echo ""
echo "world/static/index.html configures the applet to use port 2008."
echo "Should you want to use an other one, you need to edit that file."
echo ""
get APPLET_PORT 2008
ask "Which port number " APPLET_PORT
echo "[applet access enabled on port $APPLET_PORT.]"
fi
echo ""
echo ""
echo "${hi}PSYCED ENCRYPTED PROTOCOL SERVICES${lo}"
echo ""
#echo "With either openssl or gnutls installed, your driver may provide TLS/SSL."
echo "With openssl libs installed, your driver should provide TLS/SSL."
echo "If you don't have it installed, you must say 'n' here."
echo "Would you like to configure any ports for TLS-enhanced protocols?"
get TLS_YN $tls
ask "Let's use some TLS cryptography" TLS_YN
# das ganze tls-geviech macht nur sinn, wenn man cert und privkey hat
# ergo die pfade fuer die abfragen und dann entscheiden, ob...
PSYCS_PORT=""
IRCS_PORT=""
JABBERS_PORT=""
SMTPS_PORT=""
NNTPS_PORT=""
TELNETS_PORT=""
if test "$TLS_YN" = "n"
then
tlso=""
echo "[No crypto protocols.]"
else
tlso="--tls-key $CONFIG_DIR/key.pem --tls-cert $CONFIG_DIR/cert.pem"
echo ""
echo "Alright. You need to create a key.pem and cert.pem file using"
echo "any openssl or gnutls tool, then place them in $CONFIG_DIR."
echo "These will be the identity of your new PSYC homeserver."
echo "Help needed? http://www.openssl.org/docs/HOWTO/certificates.txt"
echo ""
echo "PSYC intentionally uses a dedicated TLS port not just for"
echo "simplicity, but also because it reduces interserver latency"
echo "as we can leave out negotiation. Newer versions of psyclpc when"
echo "compiled with libpsyc support automatic detection of immediate"
echo "TLS on the same ports as the unencrypted protocols, so in that"
echo "case you don't need to define dedicated TLS ports."
get PSYCS_YN "y"
ask "Enable PSYC over TLS" PSYCS_YN
if test "$PSYCS_YN" = "n"
then
echo "[PSYCS access disabled.]"
else
get PSYCS_PORT "9404"
ask "Which port number between 9400 and 9499" PSYCS_PORT
echo "[PSYCS access enabled on port $PSYCS_PORT.]"
fi
get IRCS_YN "y"
ask "Enable IRC over TLS" IRCS_YN
if test "$IRCS_YN" = "n"
then
echo "[IRCS access disabled.]"
else
get IRCS_PORT "9999"
ask "Which port number between 9960 and 9999" IRCS_PORT
echo "[IRCS access enabled on port $IRCS_PORT (instead of 994).]"
fi
get JABBERS_YN "y"
ask "Enable legacy JABBER client access over TLS" JABBERS_YN
# das ist eigentlich nen altmodischer weg, starttls ist toller und braucht
# keinen extra-port
if test "$JABBERS_YN" = "n"
then
echo "[JABBERS client access disabled.]"
else
get JABBERS_PORT "5223"
ask "Which port number (5223 or 55223)" JABBERS_PORT
echo "[JABBERS client access enabled on port $JABBERS_PORT.]"
fi
get HTTPS_YN "y"
ask "Enable HTTPS daemon" HTTPS_YN
if test "$HTTPS_YN" = "n"
then
HTTPS_PORT=""
echo "[HTTPS service disabled.]"
else
get HTTPS_PORT "4433"
ask "Which port number (4433 or 44300 .. 44443)" HTTPS_PORT
echo "[HTTPS service enabled on port $HTTPS_PORT (instead of 443).]"
fi
get SMTPS_YN "n"
ask "Enable SMTP over TLS" SMTPS_YN
if test "$SMTPS_YN" = "n"
then
echo "[SMTPS server disabled.]"
else
get SMTPS_PORT "4656"
ask "Which port number between 4650 and 4659" SMTPS_PORT
echo "[SMTPS server enabled on port $SMTPS_PORT (instead of 465).]"
fi
get POP3S_YN "n"
ask "Enable POP3 over TLS" POP3S_YN
if test "$POP3S_YN" = "n"
then
echo "[POP3S server disabled.]"
else
get POP3S_PORT "9950"
ask "Official port would be 995. Use" POP3S_PORT
echo "[POP3S server enabled on port $POP3S_PORT.]"
fi
get NNTPS_YN "n"
ask "Enable NNTP over TLS" NNTPS_YN
if test "$NNTPS_YN" = "n"
then
echo "[NNTPS reader access disabled.]"
else
get NNTPS_PORT "5636"
ask "Which port number between 5630 and 5639" NNTPS_PORT
echo "[NNTPS enabled on port $NNTPS_PORT (instead of 563).]"
fi
echo ""
echo "In theory telnet should negotiate TLS/SSL internally, but we haven't"
echo "looked into that yet, so if you want a custom telnets: port.."
get TELNETS_YN "n"
ask "Enable telnet over TLS" TELNETS_YN
if test "$TELNETS_YN" = "n"
then
echo "[telnet over SSL disabled.]"
else
get TELNETS_PORT "9992"
ask "Which port number (9992 or 9920 .. 9929)" TELNETS_PORT
echo "[telnet over SSL enabled on $TELNETS_PORT (instead of 992).]"
fi
fi
if test "$IRCNICK" != ""; then
ADMIN_NICKNAME="$IRCNICK"
else
if test "$USER" != ""; then
ADMIN_NICKNAME="$USER"
else
ADMIN_NICKNAME="`logname`"
fi
fi
echo ""
echo ""
echo "${hi}MISCELLANEOUS CONFIGURATION SETTINGS${lo}"
echo ""
get ADMIN_NICKNAME
ask "Admin Nickname" ADMIN_NICKNAME
get ADMIN_PASSWORD hackme
#ask "Admin Password" ADMIN_PASSWORD
echo ""
echo "psyced can provide all of its system messages in either english or"
echo "german as of now. Pick 'de' or 'en' as default language."
get DEFLANG en
ask "Default Language" DEFLANG
get WANT_ERQ "y"
echo ""
echo ""
echo "psyced uses an external program called 'erq' for non-blocking resolution"
echo "of IP addresses. Both PSYC and XMPP will not operate correctly without it."
# stupid question
#ask "Do you want this additional process to be activated?" WANT_ERQ
if test "$WANT_ERQ" != "n"
then
WANT_ERQ="y"
echo "[host name resolving enabled (start erq).]"
else
echo "[host name resolving disabled (don't start erq).]"
fi
## TODO, should be disabled when there is no HOST_IP?
get WANT_PORTRULES "y"
echo ""
echo ""
echo "Something you may find useful later: I will generate a file for you"
echo "which contains suitable rules for an iptables-type firewall, mapping"
echo "privileged ports to the ones you have actually chosen for your"
echo "non-privileged psyced process (DNAT). You can look at it anytime"
echo "you feel ready for it. Say yes here. It's just a file."
ask "Do you want some iptable lines?" WANT_PORTRULES
PR_FILE="portrules.iptables"
if test "$WANT_PORTRULES" = "y"
then
echo "# typical way of routing privileged ports to a psyced running non-privileged" > $PR_FILE
echo "# this file has been generated by psyced's install.sh" >> $PR_FILE
echo "" >> $PR_FILE
echo "IF_EX=eth0" >> $PR_FILE
echo "IP_PSYC=$HOST_IP" >> $PR_FILE
echo "IPT=/sbin/iptables" >> $PR_FILE
echo "" >> $PR_FILE
RULE_BEGIN="\$IPT -t nat -A PREROUTING -i \$IF_EX -d \$IP_PSYC -p tcp --dport"
RULE_END="-j DNAT --to :"
if test $SMTP_PORT; then
echo "$RULE_BEGIN 25 $RULE_END $SMTP_PORT # SMTP" >> $PR_FILE
fi
if test $POP3_PORT; then
echo "$RULE_BEGIN 110 ${RULE_END}${POP3_PORT} # POP3" >> $PR_FILE
fi
if test $NNTP_PORT; then
echo "$RULE_BEGIN 119 ${RULE_END}${NNTP_PORT} # NNTP" >> $PR_FILE
fi
if test $TELNET_PORT; then
echo "$RULE_BEGIN 23 ${RULE_END}${TELNET_PORT} # TELNET" >> $PR_FILE
fi
if test $HTTP_PORT; then
echo "$RULE_BEGIN 80 ${RULE_END}${HTTP_PORT} # HTTP" >> $PR_FILE
fi
# if test $PSYCS_PORT; then
# echo "$RULE_BEGIN 18 ${RULE_END}${PSYCS_PORT} # PSYCS" >> $PR_FILE
# fi
if test $IRCS_PORT; then
echo "$RULE_BEGIN 994 ${RULE_END}${IRCS_PORT} # IRCS" >> $PR_FILE
fi
if test $HTTPS_PORT; then
echo "$RULE_BEGIN 443 ${RULE_END}${HTTPS_PORT} # HTTPS" >> $PR_FILE
fi
if test $SMTPS_PORT; then
echo ""$RULE_BEGIN 465 ${RULE_END}${SMTPS_PORT} # SMTPS" >> $PR_FILE
fi
if test $POP3S_PORT; then
echo "$RULE_BEGIN 995 ${RULE_END}${POP3S_PORT} # POP3S" >> $PR_FILE
fi
if test $NNTPS_PORT; then
echo "$RULE_BEGIN 563 ${RULE_END}${NNTPS_PORT} # NNTPS" >> $PR_FILE
fi
if test $TELNETS_PORT; then
echo "$RULE_BEGIN 992 ${RULE_END}${TELNETS_PORT} # TELNETS" >> $PR_FILE
fi
echo "[port rules written to '$PR_FILE'.]"
else
echo "[no port rules written.]"
fi
#get WANT_CVSUP "n"
#
# would be soooo smart if we'd ask for update before we even enter
# the install.sh interview because frequently there is a better
# install.sh in the repo worth running instead. TODO
#echo ""
#echo ""
#echo "The version you are about to install is considered stable,"
#echo "If you need to run the latest off-the-mill version you can"
#echo "update the code tree via CVS. You can choose to do so now or"
#echo "anytime later using the -u option of psyced. You can"
#echo "even inspect the changes in the code before updating, using"
#echo "psyced -d. We think this feature is quite cool."
#echo ""
#echo "${hi}But be aware, by updating you may be switching"
#echo "to an unstable or otherwise unusable version.${lo}"
#ask "Update your installation by CVS?" WANT_CVSUP
echo ""
echo ""
echo ""
echo "${hi}OKAY!! HERE WE GOOOOO!!!${lo}"
echo ""
echo ""
###############################################################################
# ACTION
###############################################################################
echo "Creating configuration files..."
if test "$HTTPCONFIG_YN" = "y"
then
HTTPCONFIG_10="1"
else
HTTPCONFIG_10="0"
fi
if test "$RUNTIME_OUTPUT" = "console"
then
CONSOLE_10="1"
else
CONSOLE_10="0"
fi
FILES_10="0"
if test "$TLS_YN" = "y"
then
TLS_10="1"
else
TLS_10="0"
fi
# so we essentially have this file twice.. in here and in config/
# what kind of trick could we use to come up with a common template?
#
# i have a feeling i should put ARCH_DIR into psyced.ini
cat << EOT > psyced.ini
; this is the psyced configuration file
; automatically generated by install.sh
;
; after modifying this file you must always run 'psyconf'.
; inspect http://about.psyc.eu/psyced for further instructions.
;
; boolean variables are 0 = false (no) and 1 = true (yes).
[_basic]
; Base directory of the psyced installation
_path_base = $BASE_DIR
; Configuration directory of this PSYCED installation
; psyconf will automatically search /etc/psyc for psyced.ini.
; If you plan to put this file anywhere else, you will have to pass it
; as argument to psyconf.
_path_configuration = $CONFIG_DIR
; Path leading to your private and public TLS keys
; (absolute or relative to _path_configuration)
_path_PEM_key = key.pem
_path_PEM_certificate = cert.pem
; You can run 'make' in the 'utility/gencert' folder to create a pair
; Path to the TLS trust directory where certs are kept.
; If unset this will default to your system installation's defaults.
;_path_trust = trust
;
; Path to the TLS CRL directory where certificate revocation lists are kept.
; We currently simply use the same one as for the certs. In fact we don't use
; these things yet, but it is a good idea to start doing so.
;_path_revocation = trust
; Do you want psyced to be launched automatically at system startup?
; List of filenames a System V start/stop script shall be generated to.
; Purpose of this is: you can _really_ move the installation
; to another _path_base.
;
; May look like this for a classic System V set-up:
;_list_script_init = /etc/rc.d/psyced /etc/rc.d/rc3.d/K04psyced /etc/rc.d/rc3.d/S44psyced
; For a BSD it should be something like this:
;_list_script_init = /etc/init.d/psyced /etc/rc3.d/K04psyced /etc/rc3.d/S44psyced
; or it should look like this for gentoo:
;_list_script_init = /etc/init.d/psyced
; You can simply disable the line to turn off this feature. If you want to
; use this function instead, please make sure your distribution has /bin/sh
; in /etc/shells. Recently Slackware has decided to remove that, which
; probably means it is no longer POSIX compliant ;)
; Maybe it is not the only one..
;
; Userid to run the psyced as, when started from the init script.
_system_user = $USER
;
; Unused as yet:
;_system_group = $GROUP
; Where new users will be sent to
_place_default = RendezVous
; How the system speaks to you unless specified.
; de = German, en = English, en_g = English for Geeks
_language_default = $DEFLANG