]>
git.ipfire.org Git - ipfire-dit.git/blob - install.sh
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2012 IPFire Development Team #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
22 BASEDIR
="/usr/share/ipfire-dit"
23 TEMPLATE
="${BASEDIR}/template.ldif"
28 function parse_cli
() {
29 while [ $# -gt 0 ]; do
42 while [ -z "${PASSWORD}" ]; do
43 echo -n "Enter password: "
48 # Check for valid input data.
50 if [ ${#PASSWORD} -lt 8 ]; then
51 echo "Using weak password. Must at least have 8 characters!" >&2
55 if [ -z "${DOMAIN}" ]; then
56 echo "Domain is empty." >&2
60 # XXX check domain for invalid characters
63 function substitude_ldif
() {
67 for bit
in ${DOMAIN//./ }; do
68 if [ -n "${suffix}" ]; then
69 suffix
="${suffix},dc=${bit}"
78 -e "s/@SUFFIX@/${suffix}/g" \
79 < ${TEMPLATE} > ${output}
82 function load_database
() {
83 local new_ldif
=$
(mktemp
)
84 trap "rm -f ${new_ldif}" EXIT KILL TERM
86 substitude_ldif
${new_ldif}
91 function generate_pwhash
() {
92 local password
="${PASSWORD}"
94 slappasswd
-h "{SSHA}" -s "${password}"
97 # Hello to this wonderful script.
98 # Firstly, let's see what we need to do.
101 # Now, we got all the information we need, we
102 # can load the database.