Lines 124-129
G_F_CHECK_CONFIG=0
Link Here
|
124 |
G_F_SECURE=0 |
124 |
G_F_SECURE=0 |
125 |
G_F_SOFT=0 |
125 |
G_F_SOFT=0 |
126 |
G_F_LEFTBEHIND=0 |
126 |
G_F_LEFTBEHIND=0 |
|
|
127 |
G_F_RANDSTR=0 |
127 |
|
128 |
|
128 |
# changing these variables changes the behaviour of this script |
129 |
# changing these variables changes the behaviour of this script |
129 |
# you have been warned!! |
130 |
# you have been warned!! |
Lines 2104-2109
fn_parseparams ()
Link Here
|
2104 |
G_NEEDSERVER=1 |
2105 |
G_NEEDSERVER=1 |
2105 |
G_F_UPGRADE=1 |
2106 |
G_F_UPGRADE=1 |
2106 |
;; |
2107 |
;; |
|
|
2108 |
--randstr) |
2109 |
G_F_RANDSTR="1" |
2110 |
;; |
2107 |
-d|--dir) |
2111 |
-d|--dir) |
2108 |
G_INSTALLDIR="$2" |
2112 |
G_INSTALLDIR="$2" |
2109 |
G_ORIG_INSTALLDIR="$2" |
2113 |
G_ORIG_INSTALLDIR="$2" |
Lines 3018-3023
EOF
Link Here
|
3018 |
} |
3022 |
} |
3019 |
|
3023 |
|
3020 |
# ------------------------------------------------------------------------ |
3024 |
# ------------------------------------------------------------------------ |
|
|
3025 |
# fn_get_random_string() |
3026 |
# |
3027 |
# Generates a random string (33 bytes) using a simplistic seeding "algorithm" |
3028 |
# that uses the /dev/urandom pseudo-random numbers generator device to gather |
3029 |
# entropy, and MD5 to calculate pseudo-random sums to be used for calculating |
3030 |
# the final MD5 sum, that is, the pseudo-random string to be used finally (ie. |
3031 |
# for generating a random password value to be used in automatically-created |
3032 |
# configuration or installation files). |
3033 |
# |
3034 |
# No parameters |
3035 |
|
3036 |
fn_get_random_string() |
3037 |
{ |
3038 |
SEED1=$(head -1 /dev/urandom -c 1000 | od -N 1000 | md5sum | sed -e 's/ -//' | sed -e 's/ //') |
3039 |
SEED2=$(head -1 /dev/urandom -c 10 | od -N 1000 | md5sum | sed -e 's/ -//' | sed -e 's/ //') |
3040 |
SEED3=$(head -1 /dev/urandom -c 1000 | od -N 1000 | md5sum | sed -e 's/ -//' | sed -e 's/ //') |
3041 |
SEED4=$(head -1 /dev/urandom -c 50 | od -N 1000 | md5sum | sed -e 's/ -//' | sed -e 's/ //') |
3042 |
SEED5=$(head -1 /dev/urandom -c 1000 | od -N 1000 | md5sum | sed -e 's/ -//' | sed -e 's/ //') |
3043 |
RNDSTR="$SEED1$SEED2$SEED3$SEED4$SEED5" |
3044 |
RNDSTR=$(echo $RNDSTR | md5sum | sed -e 's/ -//' | sed -e 's/ //') |
3045 |
} |
3046 |
|
3047 |
# ------------------------------------------------------------------------ |
3021 |
# main() - it all happens here |
3048 |
# main() - it all happens here |
3022 |
# |
3049 |
# |
3023 |
# Inputs: |
3050 |
# Inputs: |
Lines 3036-3041
main ()
Link Here
|
3036 |
fn_verifyparams |
3063 |
fn_verifyparams |
3037 |
fi |
3064 |
fi |
3038 |
|
3065 |
|
|
|
3066 |
if [ "${G_F_RANDSTR}" = 1 ] ; then |
3067 |
fn_get_random_string |
3068 |
fi |
3069 |
|
3039 |
# the actual functions to do the work are stored in |
3070 |
# the actual functions to do the work are stored in |
3040 |
# seperate scripts |
3071 |
# seperate scripts |
3041 |
# |
3072 |
# |