1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-28 23:26:38 +02:00
Files
unrealircd/Config
T

642 lines
13 KiB
Bash
Executable File

#!/bin/sh
#
# Based off Config by Michael Graff (explorer@flame.org)
# Copyright 1996, 1997
#
# (original that is =P)
# UnrealIRCd - by Techie
#
# You may distribute this file without changes freely providing this notice
# remains intact. This file may not be redistributed or made available for
# distribution without the author's prior consent.
#
# $Id$
IRCD_VERSION="Unreal3.2-Selene"
CONF_DATE=`date`
#
trap "" 13 14 15
OPTIONS=Settings
AUTO_CONFIG=""
#
c=''
n=''
#
DIR=`pwd`
NOSPOOF="1"
DPATH="$DIR"
SPATH="$DIR/src/ircd"
CRYPT_OPER_PASSWORD=""
CRYPT_LINK_PASSWORD=""
CRYPT_ILINE_PASSWORD=""
CRYPT_XLINE_PASSWORD=""
LISTEN_SIZE="5"
MAXSENDQLENGTH="3000000"
BUFFERPOOL="9"
NICKNAMEHISTORYLENGTH="2000"
MAXCONNECTIONS="1024"
DEFPERM="0600"
HUB=""
#
# load $OPTIONS if present
#
if [ -r "$OPTIONS" ] ; then
. $OPTIONS
fi
#
2>/dev/null
if [ "`eval echo -n 'a'`" = "-n a" ] ; then
c='\c'
else
n='-n'
fi
clear
if [ -r .CHANGES.NEW ] ; then
more .CHANGES.NEW
echo $n "[Enter to begin]"
read cc
clear
fi
if [ -r .RELEASE.NOTES ] ; then
more .RELEASE.NOTES
echo $n "[Enter to begin]"
read cc
clear
fi
cat << __EOF__
Welcome to the configuration for the Unreal IRCD.
This UnrealIRCD version is: $IRCD_VERSION, Good Luck.
Enter "none" at any prompt to effect a null entry.
__EOF__
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
if [ -n "$NOSPOOF" ] ; then
FOO="Yes"
else
FOO="No"
fi
echo ""
echo "Many operating systems are running with insecure TCP stacks."
echo "This allows IP spoofing attacks, which are very difficult for"
echo "operators to track down and ban."
echo ""
echo "If you are CERTAIN your operating system has secure TCP stacks"
echo "you do not need to define this. If you are not certain, define"
echo "this and find out if you need it later or not. You can mail the"
echo "source mailing list later; someone there can help you determine"
echo "if your OS is secure or not."
echo ""
echo "Do you have an insecure operating system and therefore want to"
echo "use the server anti-spoof protection?"
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
case "$cc" in
[Yy]*)
NOSPOOF="1"
;;
[Nn]*)
NOSPOOF=""
;;
*)
echo ""
echo "You need to enter either Yes or No here..."
echo ""
FOO=""
;;
esac
done
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
FOO="$DPATH"
echo ""
echo "What directory are all the server configuration files in?"
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
done
DPATH=$cc
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
FOO="$SPATH"
echo ""
echo "What is the explicit path to where the ircd binary will be"
echo "installed? This should point to a file, not a directory"
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
done
SPATH=$cc
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
if [ -n "$HUB" ] ; then
FOO="Hub"
else
FOO="Hub"
fi
echo ""
echo "Would you like to compile as a hub or as a leaf?"
echo "Type Hub for selecting hub and Leaf for a leaf.."
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
case "$cc" in
[Hh]*)
HUB="1"
;;
[Ll]*)
HUB=""
;;
*)
echo ""
echo "You need to enter either Hub or Leaf here..."
echo ""
FOO=""
;;
esac
done
DOMAINNAME=`hostname`
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
FOO="$DOMAINNAME"
echo ""
echo "What is your box hostname?"
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
done
DOMAINNAME=$cc
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
FOO="$DEFPERM"
echo ""
echo "What should the default permissions for your ircd.conf be? (Set this to 0 to disable)"
echo "It is strongly recommended that you use 0600 to prevent unwanted reading of the file"
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
done
DEFPERM=$cc
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
if [ -n "$CRYPTOIRCD" ] ; then
FOO="Yes"
else
FOO="No"
fi
echo ""
echo "Do you want to support SSL (Secure Sockets Layer) connections"
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
case "$cc" in
[Yy]*)
CRYPTOIRCD="1"
;;
[Nn]*)
CRYPTOIRCD=""
;;
*)
echo ""
echo "You need to enter either Yes or No here..."
echo ""
FOO=""
;;
esac
done
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
if [ -n "$CRYPT_OPER_PASSWORD" ] ; then
FOO="Yes"
else
FOO="No"
fi
echo ""
echo "Do you use encrypted operator passwords?"
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
case "$cc" in
[Yy]*)
CRYPT_OPER_PASSWORD="1"
;;
[Nn]*)
CRYPT_OPER_PASSWORD=""
;;
*)
echo ""
echo "You need to enter either Yes or No here..."
echo ""
FOO=""
;;
esac
done
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
if [ -n "$CRYPT_LINK_PASSWORD" ] ; then
FOO="Yes"
else
FOO="No"
fi
echo ""
echo "Do you use encrypted incoming link passwords? (N lines only,"
echo "C lines must remain unencrypted always)"
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
case "$cc" in
[Yy]*)
CRYPT_LINK_PASSWORD="1"
;;
[Nn]*)
CRYPT_LINK_PASSWORD=""
;;
*)
echo ""
echo "You need to enter either Yes or No here..."
echo ""
FOO=""
;;
esac
done
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
if [ -n "$CRYPT_XLINE_PASSWORD" ] ; then
FOO="yes"
else
FOO="No"
fi
echo ""
echo "Do you want to use encrypted Restart/Die passwords?"
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
case "$cc" in
[Yy]*)
CRYPT_XLINE_PASSWORD="1"
;;
[Nn]*)
CRYPT_XLINE_PASSWORD=""
;;
*)
echo ""
echo "You need to enter either Yes or No here..."
echo ""
FOO=""
;;
esac
done
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
if [ -n "$CRYPT_ILINE_PASSWORD" ] ; then
FOO="Yes"
else
FOO="No"
fi
echo ""
echo "Do you want to use encrypted I:line passwords?"
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
case "$cc" in
[Yy]*)
CRYPT_ILINE_PASSWORD="1"
;;
[Nn]*)
CRYPT_ILINE_PASSWORD=""
;;
*)
echo ""
echo "You need to enter either Yes or No here..."
echo ""
FOO=""
;;
esac
done
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
FOO="$LISTEN_SIZE"
echo ""
echo "What listen() backlog value do you wish to use? Some servers"
echo "have problems with more than 5, others work fine with many, many"
echo "more."
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
case "$cc" in
[1-9]*)
LISTEN_SIZE="$cc"
;;
*)
echo ""
echo "You need to enter a number here."
echo ""
FOO=""
;;
esac
done
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
FOO="$NICKNAMEHISTORYLENGTH"
echo ""
echo "How far back do you want to keep the nickname history?"
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
case "$cc" in
[1-9]*)
NICKNAMEHISTORYLENGTH="$cc"
;;
*)
echo ""
echo "You need to enter a number here."
echo ""
FOO=""
;;
esac
done
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
FOO="$MAXSENDQLENGTH"
echo ""
echo "What sendq length do you wish to have?"
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
case "$cc" in
[1-9]*)
MAXSENDQLENGTH="$cc"
;;
*)
echo ""
echo "You need to enter a number here."
echo ""
FOO=""
;;
esac
done
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
FOO="$BUFFERPOOL"
echo ""
echo "How many buffer pools would you like (number * MAXSENDQLENGTH) ?"
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
case "$cc" in
*)
BUFFERPOOL="$cc"
;;
esac
done
echo ""
echo ""
FOO=""
runonce=""
while [ -z "$FOO" ] ; do
FOO="$MAXCONNECTIONS"
echo ""
echo "How many file descriptors (or sockets) can the irc server use?"
echo "(The result above, if any - shows how many sockets that the ircd can use",
echo " and can be used as an answer here)"
echo $n "[$FOO] -> $c"
if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
read cc
else
cc=""
runonce=Yes
fi
if [ -z "$cc" ] ; then
cc=$FOO
fi
case "$cc" in
[1-9][0-9][0-9]*)
MAXCONNECTIONS="$cc"
;;
*)
echo ""
echo "You need to enter a number here, greater or equal to 100."
echo ""
FOO=""
;;
esac
done
rm -f $OPTIONS
cat > $OPTIONS << __EOF__
#
NOSPOOF="$NOSPOOF"
DPATH="$DPATH"
SPATH="$SPATH"
CRYPT_OPER_PASSWORD="$CRYPT_OPER_PASSWORD"
CRYPT_LINK_PASSWORD="$CRYPT_LINK_PASSWORD"
CRYPT_ILINE_PASSWORD="$CRYPT_ILINE_PASSWORD"
CRYPT_XLINE_PASSWORD="$CRYPT_XLINE_PASSWORD"
LISTEN_SIZE="$LISTEN_SIZE"
MAXSENDQLENGTH="$MAXSENDQLENGTH"
BUFFERPOOL="$BUFFERPOOL"
MAXCONNECTIONS="$MAXCONNECTIONS"
NICKNAMEHISTORYLENGTH="$NICKNAMEHISTORYLENGTH"
HUB="$HUB"
DOMAINNAME="$DOMAINNAME"
DEFPERM="$DEFPERM"
__EOF__
ARG=""
if [ "$NOSPOOF" = "1" ] ; then
ARG="$ARG--enable-nospoof "
fi
if [ -n "$HUB" ] ; then
ARG="$ARG--enable-hub "
fi
if [ "$CRYPTOIRCD" = "1" ] ; then
ARG="$ARG--enable-ssl "
fi
if [ "$CRYPT_OPER_PASSWORD" = "1" ] ; then
ARG="$ARG--with-crypt-oper "
fi
if [ "$CRYPT_LINK_PASSWORD" = "1" ] ; then
ARG="$ARG--with-crypt-link "
fi
if [ "$CRYPT_XLINE_PASSWORD" = "1" ] ; then
ARG="$ARG--with-crypt-xline "
fi
if [ "$CRYPT_ILINE_PASSWORD" = "1" ] ; then
ARG="$ARG--with-crypt-iline "
fi
ARG="$ARG--with-listen=$LISTEN_SIZE "
ARG="$ARG--with-dpath=$DPATH "
ARG="$ARG--with-spath=$SPATH "
ARG="$ARG--with-nick-history=$NICKNAMEHISTORYLENGTH "
ARG="$ARG--with-sendq=$MAXSENDQLENGTH "
ARG="$ARG--with-bufferpool=$BUFFERPOOL "
ARG="$ARG--with-hostname=$DOMAINNAME "
ARG="$ARG--with-permissions=$DEFPERM "
ARG="$ARG--with-fd-setsize=$MAXCONNECTIONS "
ARG="$ARG--enable-dynamic-linking "
CONF="./configure $ARG"
echo $CONF
$CONF
cat << __EOF__
_____________________________________________________________________
| |
| UnrealIRCd Compile-Time Config |
| |
| The file "$OPTIONS" was either created or rewritten to contain your |
| answers to the above questions. |
| |
|_____________________________________________________________________|
|_____________________________________________________________________|
| |
| Now all you have todo is type 'make' and let it compile. When thats |
| done, you will receive other instructions on what todo next. |
| |
|_____________________________________________________________________|
|_____________________________________________________________________|
| - The UnrealIRCd Team - |
| * Stskeeps stskeeps@unrealircd.com |
| * codemastr codemastr@unrealircd.com |
| * DrBin drbin@unrealircd.com |
|_____________________________________________________________________|
__EOF__