-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_graylog.sh
4359 lines (4350 loc) · 175 KB
/
install_graylog.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/bash
#==============================================================================
#title : install_graylog.sh
#description : This script will install Graylog components (server and web).
#author : Mikaël ANDRE
#job title : Network engineer
#mail : [email protected]
#created : 20150219
#last revision : 20150921
#version : 1.5
#platform : Linux
#processor : 64 Bits
#os : CentOS
#os version : 6.5 to 6.7
#usage : sh install_graylog.sh -i | -a <file.cfg> | -v (options)
# options are --cfg <file.cfg> | --cnx | --sys
#notes : Copy and paste in Vi to use this script
#==============================================================================
#==============================================================================
# Global variables
#==============================================================================
# SCRIPT VARIABLES
SCRIPT_MODE=
# SYSTEM VARIABLES
SERVER_PROCESSOR_TYPE=
SERVER_IP_ADDRESS=
SERVER_HOST_NAME=
SERVER_SHORT_NAME=
SERVER_TIME_ZONE=
PRIVATE_KEY_FILE=
PUBLIC_KEY_FILE=
INSTALLATION_LOG_TIMESTAMP=`date +%d%m%Y%H%M%S`
INSTALLATION_LOG_FOLDER=`pwd`
INSTALLATION_LOG_FILE="${INSTALLATION_LOG_FOLDER}/install_graylog_${INSTALLATION_LOG_TIMESTAMP}.log"
INSTALLATION_CFG_FILE=
# NETWORK VARIABLES
NETWORK_INTERFACE_NAME=
# NTP VARIABLES
BOOLEAN_NTP_ONSTARTUP=
BOOLEAN_NTP_CONFIGURE=
NEW_NTP_ADDRESS=
# SSH VARIABLES
BOOLEAN_RSA_AUTH=
RSA_PUBLIC_KEY=
# MONGO VARIABLES
BOOLEAN_MONGO_ONSTARTUP=
MONGO_HOST_NAME=
MONGO_PORT_NUMBER=
MONGO_ADMIN_DATABASE='admin'
MONGO_ADMIN_USER='admin'
MONGO_ADMIN_PASSWORD=
MONGO_GRAYLOG_DATABASE=
MONGO_GRAYLOG_USER=
MONGO_GRAYLOG_PASSWORD=
# SSL VARIABLES
SSL_KEY_SIZE=
SSL_KEY_DURATION=
SSL_SUBJECT_COUNTRY=
SSL_SUBJECT_STATE=
SSL_SUBJECT_LOCALITY=
SSL_SUBJECT_ORGANIZATION=
SSL_SUBJECT_ORGANIZATIONUNIT=
SSL_SUBJECT_EMAIL=
# JAVA VARIABLES
ELASTICSEARCH_RAM_RESERVATION=
GRAYLOGSERVER_RAM_RESERVATION=
# ELASTICSEARCH VARIABLES
BOOLEAN_ELASTICSEARCH_ONSTARTUP=
BOOLEAN_INSTALL_ELASTICSEARCHPLUGIN=
# GRAYLOG VARIABLES
BOOLEAN_GRAYLOGSERVER_ONSTARTUP=
BOOLEAN_GRAYLOGWEBGUI_ONSTARTUP=
GRAYLOG_SECRET_PASSWORD=
GRAYLOG_ADMIN_USERNAME=
GRAYLOG_ADMIN_PASSWORD=
BOOLEAN_GRAYLOG_SMTP=
GRAYLOGWEB_HOST_NAME=
GRAYLOGWEB_PORT_NUMBER=
# SMTP VARIABLES
SMTP_HOST_NAME=
SMTP_DOMAIN_NAME=
SMTP_PORT_NUMBER=
BOOLEAN_SMTP_AUTH=
BOOLEAN_SMTP_TLS=
BOOLEAN_SMTP_SSL=
SMTP_AUTH_USERNAME=
SMTP_AUTH_PASSWORD=
# NGINX VARIABLES
BOOLEAN_NGINX_ONSTARTUP=
# IPTABLES VARIABLES
BOOLEAN_IPTABLES_ONSTARTUP=
DEFAULT_SYSLOG_PORT='514'
CUSTOM_SYSLOG_PORT=
DEFAULT_SNMPTRAP_PORT='162'
CUSTOM_SNMPTRAP_PORT=
# TERMINAL VARIABLES
RES_COL="60"
RES_COL1="67"
# COLOR VARIABLES
MOVE_TO_COL="\\033[${RES_COL}G"
MOVE_TO_COL1="\\033[${RES_COL1}G"
SETCOLOR_INFO="\\033[0;36m"
SETCOLOR_SUCCESS="\\033[0;32m"
SETCOLOR_FAILURE="\\033[0;31m"
SETCOLOR_WARNING="\\033[0;33m"
SETCOLOR_DISABLE="\\033[0;90m"
SETCOLOR_NORMAL="\\033[0;39m"
#==============================================================================
#==============================================================================
# Functions
#==============================================================================
# Log function to write all events during installation process
function log() {
local program_name=${0}
local message_type=${1}
shift
local message_content=${@}
echo -e "$(date) [${program_name}]: ${message_type}: ${message_content}" >> ${INSTALLATION_LOG_FILE}
}
# Display message on standart output without carriage return
function echo_message() {
echo -en "${1}${MOVE_TO_COL}"
}
# Display "[ INFO ]" message on standart output with carriage return
function echo_info() {
echo -e "[ ${SETCOLOR_INFO}${1}${SETCOLOR_NORMAL} ]"
}
# Display "[ OK ]" message on standart output with carriage return
function echo_success() {
echo -e "[ ${SETCOLOR_SUCCESS}${1}${SETCOLOR_NORMAL} ]"
}
# Display "[FAILED]" message on standart output with carriage return
function echo_failure() {
echo -e "[${SETCOLOR_FAILURE}${1}${SETCOLOR_NORMAL}]"
}
# Display "[ WARN ]" message on standart output with carriage return
function echo_warning() {
echo -e "[ ${SETCOLOR_WARNING}${1}${SETCOLOR_NORMAL} ]"
}
# Display "[ PASS ]" message on standart output with carriage return
function echo_passed() {
echo -e "[ ${SETCOLOR_WARNING}${1}${SETCOLOR_NORMAL} ]"
}
# Return 0 if user answers "yes" or 1 to "no" answer
function yes_no_function() {
local input_message=${1}
local default_answer=${2}
local user_answer="UNDEF"
while [[ !( "${user_answer}" =~ ^[Yy][Ee][Ss]$|^[Yy]$ ) && !( "${user_answer}" =~ ^[Nn][Oo]$|^[Nn]$ ) && !( -z "${user_answer}" ) ]]
do
echo -e "\n${input_message}\n[y/n], default to [${SETCOLOR_INFO}${default_answer}${SETCOLOR_NORMAL}]:"
echo -en "> "
read user_answer
if [ -z "${user_answer}" ]
then
user_answer=${default_answer}
fi
done
if [[ "${user_answer}" =~ ^[Yy][Ee][Ss]$|^[Yy]$ ]]
then
return 0
else
return 1
fi
}
# Abort function and inform user to read log file for more informations on bad ending
function abort_installation() {
log "ERROR" "GRAYLOG installation: Abort"
echo_message "Check log file : ${INSTALLATION_LOG_FILE}"
echo_info "INFO"
if [ ! -z "${INSTALLATION_CFG_FILE}" ]
then
if [[ "${INSTALLATION_CFG_FILE}" =~ .*\.cfg$ ]]
then
log "INFO" "GRAYLOG installation: After debugging, launch again installation process with ${0} -a ${INSTALLATION_CFG_FILE}"
fi
fi
exit 1
}
# Return 0 if file exists or 1 if not
function test_file() {
local input_file=${1}
local is_exist=
if [ -f "${input_file}" ]
then
is_exist=0
else
is_exist=1
fi
echo ${is_exist}
}
# Return 0 if directory exists or 1 if not
function test_directory() {
local input_folder=${1}
local is_exist=
if [ -d "${input_folder}" ]
then
is_exist=0
else
is_exist=1
fi
echo ${is_exist}
}
# Return 0 if search pattern is present in specified file or 1 if not
function find_pattern() {
local input_file=${1}
local input_pattern=${1}
local find_command=
local is_present=
find_command=$(find ${input_file} -type f -print | xargs grep "${input_pattern}")
if [ -z "${find_command}" ]
then
is_present=1
else
is_present=0
fi
echo ${is_present}
}
# Test DNS configuration and send 4 icmp packets
function test_internet() {
local icmp_packets_sent=4
local icmp_packets_received=
local internet_host_name="www.google.fr"
local icmp_time_out=5
echo_message "Check Internet connection"
log "INFO" "Internet connection: Check connection to ${internet_host_name}"
icmp_packets_received=$(ping -c ${icmp_packets_sent} -W ${icmp_time_out} ${internet_host_name} 2>&1)
if [[ ! "${icmp_packets_received}" =~ .*unknown.* ]]
then
log "INFO" "Internet connection: DNS successfully configured"
log "INFO" "Internet connection: ICMP packets sent=${icmp_packets_sent}"
icmp_packets_received=$(ping -c ${icmp_packets_sent} -W ${icmp_time_out} ${internet_host_name} | grep "received" | awk -F: '{print $1}' | awk '{print $4}')
if [ "${icmp_packets_received}" == ${icmp_packets_sent} ]
then
log "INFO" "Internet connection: ICMP packets received=${icmp_packets_received}"
echo_success "OK"
if [[ ${SCRIPT_MODE} =~ v_cnx ]]
then
echo_message "Check log file : ${INSTALLATION_LOG_FILE}"
echo_info "INFO"
fi
else
log "ERROR" "Internet connection: ICMP packets received=${icmp_packets_received}"
echo_failure "FAILED"
abort_installation
fi
else
log "ERROR" "Internet connection: Unable to resolve ${internet_host_name}"
echo_failure "FAILED"
abort_installation
fi
}
# Set all global variables using inputs user
function set_globalvariables() {
local command_output_message=
local old_input_value=
local installation_cfg_tmpfile="${INSTALLATION_LOG_FOLDER}/install_graylog_${INSTALLATION_LOG_TIMESTAMP}.cfg"
local mailaddress_regular_expression="^[a-z0-9,!#\$%&'\*\+/=\?\^_\`\{\|}~-]+(\.[a-z0-9,!#\$%&'\*\+/=\?\^_\`\{\|}~-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,})$"
if [ "${SCRIPT_MODE}" == "i" ]
then
command_output_message=$(test_file ${installation_cfg_tmpfile})
if [ "${command_output_message}" == "0" ]
then
log "WARN" "Global variables: ${installation_cfg_tmpfile} already created"
else
touch ${installation_cfg_tmpfile}
log "INFO" "Global variables: ${installation_cfg_tmpfile} successfully created"
fi
else
installation_cfg_tmpfile=${INSTALLATION_CFG_FILE}
log "INFO" "Global variables: ${installation_cfg_tmpfile} successfully selected"
fi
if [ -z "${NETWORK_INTERFACE_NAME}" ]
then
while [ -z "${NETWORK_INTERFACE_NAME}" ]
do
echo -e "\nType network interface name, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}eth0${SETCOLOR_NORMAL}]:"
echo -en "> "
read NETWORK_INTERFACE_NAME
if [ -z "${NETWORK_INTERFACE_NAME}" ]
then
NETWORK_INTERFACE_NAME='eth0'
fi
done
else
yes_no_function "Can you confirm you want to modify current interface name ?" "yes"
if [ "${?}" == "0" ]
then
old_input_value=${NETWORK_INTERFACE_NAME}
NETWORK_INTERFACE_NAME=
while [ -z "${NETWORK_INTERFACE_NAME}" ]
do
echo -e "\nType network interface name, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read NETWORK_INTERFACE_NAME
if [ -z "${NETWORK_INTERFACE_NAME}" ]
then
NETWORK_INTERFACE_NAME=${old_input_value}
fi
done
else
NETWORK_INTERFACE_NAME=${old_input_value}
fi
fi
echo "NETWORK_INTERFACE_NAME='${NETWORK_INTERFACE_NAME}'" > ${installation_cfg_tmpfile}
if [ -z "${BOOLEAN_RSA_AUTH}" ]
then
yes_no_function "Do you want to use RSA authentication on GRAYLOG back-end server ?" "yes"
if [ "${?}" == "0" ]
then
BOOLEAN_RSA_AUTH="true"
else
BOOLEAN_RSA_AUTH="false"
fi
else
if [[ "${BOOLEAN_RSA_AUTH}" =~ true ]]
then
yes_no_function "Can you confirm you want to ${SETCOLOR_FAILURE}not use${SETCOLOR_NORMAL} RSA authentication ?" "yes"
if [ "${?}" == "0" ]
then
BOOLEAN_RSA_AUTH="false"
else
BOOLEAN_RSA_AUTH=${BOOLEAN_RSA_AUTH}
fi
else
yes_no_function "Can you confirm you want to ${SETCOLOR_FAILURE}use${SETCOLOR_NORMAL} RSA authentication ?" "yes"
if [ "${?}" == "0" ]
then
BOOLEAN_RSA_AUTH="true"
else
BOOLEAN_RSA_AUTH=${BOOLEAN_RSA_AUTH}
fi
fi
fi
if [[ "${BOOLEAN_RSA_AUTH}" =~ true ]]
then
if [ -z "${RSA_PUBLIC_KEY}" ]
then
while [ -z "${RSA_PUBLIC_KEY}" ] || [[ ! "${RSA_PUBLIC_KEY}" =~ ^ssh-rsa.* ]]
do
echo -e "Paste your RSA public key, followed by [ENTER]:"
echo -en "> "
read RSA_PUBLIC_KEY
done
else
old_input_value=${RSA_PUBLIC_KEY}
yes_no_function "Can you confirm you want to modify current RSA public key" "yes"
if [ "${?}" == "0" ]
then
RSA_PUBLIC_KEY=
while [ -z "${RSA_PUBLIC_KEY}" ] || [[ ! "${RSA_PUBLIC_KEY}" =~ ^ssh-rsa.* ]]
do
echo -e "Paste your RSA public key, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read RSA_PUBLIC_KEY
if [ -z "${RSA_PUBLIC_KEY}" ]
then
RSA_PUBLIC_KEY=${old_input_value}
fi
done
else
RSA_PUBLIC_KEY=${old_input_value}
fi
fi
else
RSA_PUBLIC_KEY=
fi
echo "BOOLEAN_RSA_AUTH='${BOOLEAN_RSA_AUTH}'" >> ${installation_cfg_tmpfile}
echo "RSA_PUBLIC_KEY='${RSA_PUBLIC_KEY}'" >> ${installation_cfg_tmpfile}
if [ -z "${SERVER_TIME_ZONE}" ]
then
while [ -z "${SERVER_TIME_ZONE}" ]
do
echo -e "\nType timezone, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}Europe/Paris${SETCOLOR_NORMAL}]:"
echo -en "> "
read SERVER_TIME_ZONE
if [ -z "${SERVER_TIME_ZONE}" ]
then
SERVER_TIME_ZONE='Europe/Paris'
fi
done
else
old_input_value=${SERVER_TIME_ZONE}
yes_no_function "Can you confirm you want to modify current time zone ?" "yes"
if [ "${?}" == "0" ]
then
SERVER_TIME_ZONE=
while [ -z "${SERVER_TIME_ZONE}" ]
do
echo -e "\nType timezone, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read SERVER_TIME_ZONE
if [ -z "${SERVER_TIME_ZONE}" ]
then
SERVER_TIME_ZONE=${old_input_value}
fi
done
else
SERVER_TIME_ZONE=${old_input_value}
fi
fi
echo "SERVER_TIME_ZONE='${SERVER_TIME_ZONE}'" >> ${installation_cfg_tmpfile}
if [ -z "${BOOLEAN_NTP_CONFIGURE}" ]
then
yes_no_function "Do you want to configure NTP service ?" "yes"
if [ "${?}" == "0" ]
then
BOOLEAN_NTP_CONFIGURE="true"
else
BOOLEAN_NTP_CONFIGURE="false"
fi
else
if [[ "${BOOLEAN_NTP_CONFIGURE}" =~ true ]]
then
yes_no_function "Can you confirm you want to ${SETCOLOR_FAILURE}not configure${SETCOLOR_NORMAL} NTP service ?" "yes"
if [ "${?}" == "0" ]
then
BOOLEAN_NTP_CONFIGURE="false"
else
BOOLEAN_NTP_CONFIGURE=${BOOLEAN_NTP_CONFIGURE}
fi
else
yes_no_function "Can you confirm you want to ${SETCOLOR_FAILURE}configure${SETCOLOR_NORMAL} NTP service ?" "yes"
if [ "${?}" == "0" ]
then
BOOLEAN_NTP_CONFIGURE="true"
else
BOOLEAN_NTP_CONFIGURE=${BOOLEAN_NTP_CONFIGURE}
fi
fi
fi
if [[ "${BOOLEAN_NTP_CONFIGURE}" =~ true ]]
then
if [ -z "${NEW_NTP_ADDRESS}" ]
then
while [[ ! "${NEW_NTP_ADDRESS}" =~ ^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$ ]] && [[ ! "${NEW_NTP_ADDRESS}" =~ ^(([a-zA-Z0-9](-?[a-zA-Z0-9])*)\.)*[a-zA-Z0-9](-?[a-zA-Z0-9])+\.[a-zA-Z]{2,}$ ]] && [[ ! "${NEW_NTP_ADDRESS}" =~ ^localhost$ ]]
do
echo -e "\nType IP address or hostname of NTP server, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}ntp.test.fr${SETCOLOR_NORMAL}]:"
echo -en "> "
read NEW_NTP_ADDRESS
if [ -z "${NEW_NTP_ADDRESS}" ]
then
NEW_NTP_ADDRESS='ntp.test.fr'
fi
done
else
old_input_value=${NEW_NTP_ADDRESS}
yes_no_function "Can you confirm you want to modify current NTP server ?" "yes"
if [ "${?}" == "0" ]
then
NEW_NTP_ADDRESS=
while [[ ! "${NEW_NTP_ADDRESS}" =~ ^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$ ]] && [[ ! "${NEW_NTP_ADDRESS}" =~ ^(([a-zA-Z0-9](-?[a-zA-Z0-9])*)\.)*[a-zA-Z0-9](-?[a-zA-Z0-9])+\.[a-zA-Z]{2,}$ ]] && [[ ! "${NEW_NTP_ADDRESS}" =~ ^localhost$ ]]
do
echo -e "\nType IP address or hostname of NTP server, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read NEW_NTP_ADDRESS
if [ -z "${NEW_NTP_ADDRESS}" ]
then
NEW_NTP_ADDRESS=${old_input_value}
fi
done
else
NEW_NTP_ADDRESS=${old_input_value}
fi
fi
else
NEW_NTP_ADDRESS=
fi
echo "BOOLEAN_NTP_CONFIGURE='${BOOLEAN_NTP_CONFIGURE}'" >> ${installation_cfg_tmpfile}
echo "NEW_NTP_ADDRESS='${NEW_NTP_ADDRESS}'" >> ${installation_cfg_tmpfile}
if [ -z "${BOOLEAN_NTP_ONSTARTUP}" ]
then
yes_no_function "Do you want to add NTP service on startup ?" "yes"
if [ "${?}" == "0" ]
then
BOOLEAN_NTP_ONSTARTUP="true"
else
BOOLEAN_NTP_ONSTARTUP="false"
fi
else
if [[ "${BOOLEAN_NTP_ONSTARTUP}" =~ true ]]
then
yes_no_function "Can you confirm you want to ${SETCOLOR_FAILURE}disable${SETCOLOR_NORMAL} NTP service on startup ?" "yes"
if [ "${?}" == "0" ]
then
BOOLEAN_NTP_ONSTARTUP="false"
else
BOOLEAN_NTP_ONSTARTUP=${BOOLEAN_NTP_ONSTARTUP}
fi
else
yes_no_function "Can you confirm you want to ${SETCOLOR_SUCCESS}enable${SETCOLOR_NORMAL} NTP service on startup ?" "yes"
if [ "${?}" == "0" ]
then
BOOLEAN_NTP_ONSTARTUP="true"
else
BOOLEAN_NTP_ONSTARTUP=${BOOLEAN_NTP_ONSTARTUP}
fi
fi
fi
echo "BOOLEAN_NTP_ONSTARTUP='${BOOLEAN_NTP_ONSTARTUP}'" >> ${installation_cfg_tmpfile}
if [ -z "${MONGO_HOST_NAME}" ]
then
while [[ ! "${MONGO_HOST_NAME}" =~ ^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$ ]] && [[ ! "${MONGO_HOST_NAME}" =~ ^(([a-zA-Z0-9](-?[a-zA-Z0-9])*)\.)*[a-zA-Z0-9](-?[a-zA-Z0-9])+\.[a-zA-Z]{2,}$ ]] && [[ ! "${MONGO_HOST_NAME}" =~ ^localhost$ ]]
do
echo -e "\nType IP address or hostname of MONGO database server, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}127.0.0.1${SETCOLOR_NORMAL}]:"
echo -en "> "
read MONGO_HOST_NAME
if [ -z "${MONGO_HOST_NAME}" ]
then
MONGO_HOST_NAME='127.0.0.1'
fi
done
else
old_input_value=${MONGO_HOST_NAME}
yes_no_function "Can you confirm you want to modify current IP address or hostname of MONGO database server ?" "yes"
if [ "${?}" == "0" ]
then
MONGO_HOST_NAME=
while [[ ! "${MONGO_HOST_NAME}" =~ ^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$ ]] && [[ ! "${MONGO_HOST_NAME}" =~ ^(([a-zA-Z0-9](-?[a-zA-Z0-9])*)\.)*[a-zA-Z0-9](-?[a-zA-Z0-9])+\.[a-zA-Z]{2,}$ ]] && [[ ! "${MONGO_HOST_NAME}" =~ ^localhost$ ]]
do
echo -e "\nType IP address or hostname of MONGO database server, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read MONGO_HOST_NAME
if [ -z "${MONGO_HOST_NAME}" ]
then
MONGO_HOST_NAME=${old_input_value}
fi
done
else
MONGO_HOST_NAME=${old_input_value}
fi
fi
echo "MONGO_HOST_NAME='${MONGO_HOST_NAME}'" >> ${installation_cfg_tmpfile}
if [ -z "${MONGO_PORT_NUMBER}" ]
then
while [[ ! "${MONGO_PORT_NUMBER}" =~ (102[4-9]|10[3-9][0-9]|1[1-9][0-9]{2}|[2-9][0-9]{3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]) ]]
do
echo -e "\nType MONGO database server port number (possible values : ${SETCOLOR_FAILURE}1024${SETCOLOR_NORMAL} to ${SETCOLOR_FAILURE}63355${SETCOLOR_NORMAL}), followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}9000${SETCOLOR_NORMAL}]:"
echo -en "> "
read MONGO_PORT_NUMBER
if [ -z "${MONGO_PORT_NUMBER}" ]
then
MONGO_PORT_NUMBER='9000'
fi
done
else
old_input_value=${MONGO_PORT_NUMBER}
yes_no_function "Can you confirm you want to modify current port number of MONGO database server ?" "yes"
if [ "${?}" == "0" ]
then
MONGO_PORT_NUMBER=
while [[ ! "${MONGO_PORT_NUMBER}" =~ (102[4-9]|10[3-9][0-9]|1[1-9][0-9]{2}|[2-9][0-9]{3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]) ]]
do
echo -e "\nType MONGO database server port number (possible values : ${SETCOLOR_FAILURE}1024${SETCOLOR_NORMAL} to ${SETCOLOR_FAILURE}63355${SETCOLOR_NORMAL}), followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read MONGO_PORT_NUMBER
if [ -z "${MONGO_PORT_NUMBER}" ]
then
MONGO_PORT_NUMBER=${old_input_value}
fi
done
else
MONGO_PORT_NUMBER=${old_input_value}
fi
fi
echo "MONGO_PORT_NUMBER='${MONGO_PORT_NUMBER}'" >> ${installation_cfg_tmpfile}
if [ -z "${MONGO_ADMIN_PASSWORD}" ]
then
while [ -z "${MONGO_ADMIN_PASSWORD}" ]
do
echo -e "\nType password of Mongo administrator, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}admin4mongo${SETCOLOR_NORMAL}]:"
echo -en "> "
read MONGO_ADMIN_PASSWORD
if [ -z "${MONGO_ADMIN_PASSWORD}" ]
then
MONGO_ADMIN_PASSWORD='admin4mongo'
fi
done
else
old_input_value=${MONGO_ADMIN_PASSWORD}
yes_no_function "Can you confirm you want to modify current password of Mongo administrator ?" "yes"
if [ "${?}" == "0" ]
then
MONGO_ADMIN_PASSWORD=
while [ -z "${MONGO_ADMIN_PASSWORD}" ]
do
echo -e "\nType password of Mongo administrator, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read MONGO_ADMIN_PASSWORD
if [ -z "${MONGO_ADMIN_PASSWORD}" ]
then
MONGO_ADMIN_PASSWORD=${old_input_value}
fi
done
else
MONGO_ADMIN_PASSWORD=${old_input_value}
fi
fi
echo "MONGO_ADMIN_PASSWORD='${MONGO_ADMIN_PASSWORD}'" >> ${installation_cfg_tmpfile}
if [ -z "${MONGO_GRAYLOG_DATABASE}" ]
then
while [ -z "${MONGO_GRAYLOG_DATABASE}" ]
do
echo -e "\nType name of Graylog Mongo database, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}graylog${SETCOLOR_NORMAL}]:"
echo -en "> "
read MONGO_GRAYLOG_DATABASE
if [ -z "${MONGO_GRAYLOG_DATABASE}" ]
then
MONGO_GRAYLOG_DATABASE='graylog'
fi
done
else
old_input_value=${MONGO_GRAYLOG_DATABASE}
yes_no_function "Can you confirm you want to modify current name of Graylog Mongo database ?" "yes"
if [ "${?}" == "0" ]
then
MONGO_GRAYLOG_DATABASE=
while [ -z "${MONGO_GRAYLOG_DATABASE}" ]
do
echo -e "\nType name of Graylog Mongo database, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read MONGO_GRAYLOG_DATABASE
if [ -z "${MONGO_GRAYLOG_DATABASE}" ]
then
MONGO_GRAYLOG_DATABASE=${old_input_value}
fi
done
else
MONGO_GRAYLOG_DATABASE=${old_input_value}
fi
fi
echo "MONGO_GRAYLOG_DATABASE='${MONGO_GRAYLOG_DATABASE}'" >> ${installation_cfg_tmpfile}
if [ -z "${MONGO_GRAYLOG_USER}" ]
then
while [ -z "${MONGO_GRAYLOG_USER}" ]
do
echo -e "\nType login of Mongo Graylog user, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}grayloguser${SETCOLOR_NORMAL}]:"
echo -en "> "
read MONGO_GRAYLOG_USER
if [ -z "${MONGO_GRAYLOG_USER}" ]
then
MONGO_GRAYLOG_USER='grayloguser'
fi
done
else
old_input_value=${MONGO_GRAYLOG_USER}
yes_no_function "Can you confirm you want to modify current login of Mongo Graylog user ?" "yes"
if [ "${?}" == "0" ]
then
MONGO_GRAYLOG_USER=
while [ -z "${MONGO_GRAYLOG_USER}" ]
do
echo -e "\nType login of Mongo Graylog user, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read MONGO_GRAYLOG_USER
if [ -z "${MONGO_GRAYLOG_USER}" ]
then
MONGO_GRAYLOG_USER=${old_input_value}
fi
done
else
MONGO_GRAYLOG_USER=${old_input_value}
fi
fi
echo "MONGO_GRAYLOG_USER='${MONGO_GRAYLOG_USER}'" >> ${installation_cfg_tmpfile}
if [ -z "${MONGO_GRAYLOG_PASSWORD}" ]
then
while [ -z "${MONGO_GRAYLOG_PASSWORD}" ]
do
echo -e "\nType password of Mongo Graylog user, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}graylog4mongo${SETCOLOR_NORMAL}]:"
echo -en "> "
read MONGO_GRAYLOG_PASSWORD
if [ -z "${MONGO_GRAYLOG_PASSWORD}" ]
then
MONGO_GRAYLOG_PASSWORD='graylog4mongo'
fi
done
else
old_input_value=${MONGO_GRAYLOG_PASSWORD}
yes_no_function "Can you confirm you want to modify current password of Mongo Graylog user ?" "yes"
if [ "${?}" == "0" ]
then
MONGO_GRAYLOG_PASSWORD=
while [ -z "${MONGO_GRAYLOG_PASSWORD}" ]
do
echo -e "\nType password of Mongo Graylog user, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read MONGO_GRAYLOG_PASSWORD
if [ -z "${MONGO_GRAYLOG_PASSWORD}" ]
then
MONGO_GRAYLOG_PASSWORD=${old_input_value}
fi
done
else
MONGO_GRAYLOG_PASSWORD=${old_input_value}
fi
fi
echo "MONGO_GRAYLOG_PASSWORD='${MONGO_GRAYLOG_PASSWORD}'" >> ${installation_cfg_tmpfile}
if [ -z "${BOOLEAN_MONGO_ONSTARTUP}" ]
then
yes_no_function "Do you want to add Mongo database server on startup ?" "yes"
if [ "${?}" == "0" ]
then
BOOLEAN_MONGO_ONSTARTUP="true"
else
BOOLEAN_MONGO_ONSTARTUP="false"
fi
else
if [[ "${BOOLEAN_MONGO_ONSTARTUP}" =~ true ]]
then
yes_no_function "Can you confirm you want to ${SETCOLOR_FAILURE}disable${SETCOLOR_NORMAL} Mongo database server on startup ?" "yes"
if [ "${?}" == "0" ]
then
BOOLEAN_MONGO_ONSTARTUP="false"
else
BOOLEAN_MONGO_ONSTARTUP=${BOOLEAN_MONGO_ONSTARTUP}
fi
else
yes_no_function "Can you confirm you want to ${SETCOLOR_SUCCESS}enable${SETCOLOR_NORMAL} Mongo database server on startup ?" "yes"
if [ "${?}" == "0" ]
then
BOOLEAN_MONGO_ONSTARTUP="true"
else
BOOLEAN_MONGO_ONSTARTUP=${BOOLEAN_MONGO_ONSTARTUP}
fi
fi
fi
echo "BOOLEAN_MONGO_ONSTARTUP='${BOOLEAN_MONGO_ONSTARTUP}'" >> ${installation_cfg_tmpfile}
if [ -z "${SSL_KEY_SIZE}" ]
then
while [[ ! "${SSL_KEY_SIZE}" =~ 512|1024|2048|4096 ]]
do
echo -e "\nType size of SSL private key (possible values : ${SETCOLOR_FAILURE}512${SETCOLOR_NORMAL}|${SETCOLOR_FAILURE}1024${SETCOLOR_NORMAL}|${SETCOLOR_FAILURE}2048${SETCOLOR_NORMAL}|${SETCOLOR_FAILURE}4096${SETCOLOR_NORMAL}), followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}2048${SETCOLOR_NORMAL}]:"
echo -en "> "
read SSL_KEY_SIZE
if [ -z "${SSL_KEY_SIZE}" ]
then
SSL_KEY_SIZE='2048'
fi
done
else
old_input_value=${SSL_KEY_SIZE}
yes_no_function "Can you confirm you want to modify current size of SSL private key ?" "yes"
if [ "${?}" == "0" ]
then
SSL_KEY_SIZE=
while [[ ! "${SSL_KEY_SIZE}" =~ 512|1024|2048|4096 ]]
do
echo -e "\nType size of SSL private key (possible values : ${SETCOLOR_FAILURE}512${SETCOLOR_NORMAL}|${SETCOLOR_FAILURE}1024${SETCOLOR_NORMAL}|${SETCOLOR_FAILURE}2048${SETCOLOR_NORMAL}|${SETCOLOR_FAILURE}4096${SETCOLOR_NORMAL}), followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read SSL_KEY_SIZE
if [ -z "${SSL_KEY_SIZE}" ]
then
SSL_KEY_SIZE=${old_input_value}
fi
done
else
SSL_KEY_SIZE=${old_input_value}
fi
fi
echo "SSL_KEY_SIZE='${SSL_KEY_SIZE}'" >> ${installation_cfg_tmpfile}
if [ -z "${SSL_KEY_DURATION}" ]
then
while [[ ! "${SSL_KEY_DURATION}" =~ [0-9]{1,5} ]]
do
echo -e "\nType period of validity (in day) of SSL certificate, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}365${SETCOLOR_NORMAL}]:"
echo -en "> "
read SSL_KEY_DURATION
if [ -z "${SSL_KEY_DURATION}" ]
then
SSL_KEY_DURATION='365'
fi
done
else
old_input_value=${SSL_KEY_DURATION}
yes_no_function "Can you confirm you want to modify current period of validity of SSL Certificate ?" "yes"
if [ "${?}" == "0" ]
then
SSL_KEY_DURATION=
while [[ ! "${SSL_KEY_DURATION}" =~ [0-9]{1,5} ]]
do
echo -e "\nType period of validity (in day) of SSL certificate, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read SSL_KEY_DURATION
if [ -z "${SSL_KEY_DURATION}" ]
then
SSL_KEY_DURATION=${old_input_value}
fi
done
else
SSL_KEY_DURATION=${old_input_value}
fi
fi
echo "SSL_KEY_DURATION='${SSL_KEY_DURATION}'" >> ${installation_cfg_tmpfile}
if [ -z "${SSL_SUBJECT_COUNTRY}" ]
then
while [[ ! "${SSL_SUBJECT_COUNTRY}" =~ [A-Z]{2,3} ]]
do
echo -e "\nType country code of SSL certificate, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}FR${SETCOLOR_NORMAL}]:"
echo -en "> "
read SSL_SUBJECT_COUNTRY
if [ -z "${SSL_SUBJECT_COUNTRY}" ]
then
SSL_SUBJECT_COUNTRY='FR'
fi
done
else
old_input_value=${SSL_SUBJECT_COUNTRY}
yes_no_function "Can you confirm you want to modify current country code of SSL Certificate ?" "yes"
if [ "${?}" == "0" ]
then
SSL_SUBJECT_COUNTRY=
while [[ ! "${SSL_SUBJECT_COUNTRY}" =~ [A-Z]{2,3} ]]
do
echo -e "\nType country code of SSL certificate, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read SSL_SUBJECT_COUNTRY
if [ -z "${SSL_SUBJECT_COUNTRY}" ]
then
SSL_SUBJECT_COUNTRY=${old_input_value}
fi
done
else
SSL_SUBJECT_COUNTRY=${old_input_value}
fi
fi
echo "SSL_SUBJECT_COUNTRY='${SSL_SUBJECT_COUNTRY}'" >> ${installation_cfg_tmpfile}
if [ -z "${SSL_SUBJECT_STATE}" ]
then
while [ -z "${SSL_SUBJECT_STATE}" ]
do
echo -e "\nType state of SSL certificate, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}STATE${SETCOLOR_NORMAL}]:"
echo -en "> "
read SSL_SUBJECT_STATE
if [ -z "${SSL_SUBJECT_STATE}" ]
then
SSL_SUBJECT_STATE='STATE'
fi
done
else
old_input_value=${SSL_SUBJECT_STATE}
yes_no_function "Can you confirm you want to modify current state of SSL Certificate ?" "yes"
if [ "${?}" == "0" ]
then
SSL_SUBJECT_STATE=
while [ -z "${SSL_SUBJECT_STATE}" ]
do
echo -e "\nType state of SSL certificate, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read SSL_SUBJECT_STATE
if [ -z "${SSL_SUBJECT_STATE}" ]
then
SSL_SUBJECT_STATE=${old_input_value}
fi
done
else
SSL_SUBJECT_STATE=${old_input_value}
fi
fi
echo "SSL_SUBJECT_STATE='${SSL_SUBJECT_STATE}'" >> ${installation_cfg_tmpfile}
if [ -z "${SSL_SUBJECT_LOCALITY}" ]
then
while [ -z "${SSL_SUBJECT_LOCALITY}" ]
do
echo -e "\nType state of SSL certificate, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}LOCALITY${SETCOLOR_NORMAL}]:"
echo -en "> "
read SSL_SUBJECT_LOCALITY
if [ -z "${SSL_SUBJECT_LOCALITY}" ]
then
SSL_SUBJECT_LOCALITY='LOCALITY'
fi
done
else
old_input_value=${SSL_SUBJECT_LOCALITY}
yes_no_function "Can you confirm you want to modify current locality of SSL Certificate ?" "yes"
if [ "${?}" == "0" ]
then
SSL_SUBJECT_LOCALITY=
while [ -z "${SSL_SUBJECT_LOCALITY}" ]
do
echo -e "\nType state of SSL certificate, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read SSL_SUBJECT_LOCALITY
if [ -z "${SSL_SUBJECT_LOCALITY}" ]
then
SSL_SUBJECT_LOCALITY=${old_input_value}
fi
done
else
SSL_SUBJECT_LOCALITY=${old_input_value}
fi
fi
echo "SSL_SUBJECT_LOCALITY='${SSL_SUBJECT_LOCALITY}'" >> ${installation_cfg_tmpfile}
if [ -z "${SSL_SUBJECT_ORGANIZATION}" ]
then
while [ -z "${SSL_SUBJECT_ORGANIZATION}" ]
do
echo -e "\nType organization name of SSL certificate, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}ORGANIZATION${SETCOLOR_NORMAL}]:"
echo -en "> "
read SSL_SUBJECT_ORGANIZATION
if [ -z "${SSL_SUBJECT_ORGANIZATION}" ]
then
SSL_SUBJECT_ORGANIZATION='ORGANIZATION'
fi
done
else
old_input_value=${SSL_SUBJECT_ORGANIZATION}
yes_no_function "Can you confirm you want to modify current organization name of SSL Certificate ?" "yes"
if [ "${?}" == "0" ]
then
SSL_SUBJECT_ORGANIZATION=
while [ -z "${SSL_SUBJECT_ORGANIZATION}" ]
do
echo -e "\nType organization name of SSL certificate, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read SSL_SUBJECT_ORGANIZATION
if [ -z "${SSL_SUBJECT_ORGANIZATION}" ]
then
SSL_SUBJECT_ORGANIZATION=${old_input_value}
fi
done
else
SSL_SUBJECT_ORGANIZATION=${old_input_value}
fi
fi
echo "SSL_SUBJECT_ORGANIZATION='${SSL_SUBJECT_ORGANIZATION}'" >> ${installation_cfg_tmpfile}
if [ -z "${SSL_SUBJECT_ORGANIZATIONUNIT}" ]
then
while [ -z "${SSL_SUBJECT_ORGANIZATIONUNIT}" ]
do
echo -e "\nType organization unit name of SSL certificate, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}ORGANIZATION UNIT${SETCOLOR_NORMAL}]:"
echo -en "> "
read SSL_SUBJECT_ORGANIZATIONUNIT
if [ -z "${SSL_SUBJECT_ORGANIZATIONUNIT}" ]
then
SSL_SUBJECT_ORGANIZATIONUNIT='ORGANIZATION UNIT'
fi
done
else
old_input_value=${SSL_SUBJECT_ORGANIZATIONUNIT}
yes_no_function "Can you confirm you want to modify current organization unit name of SSL Certificate ?" "yes"
if [ "${?}" == "0" ]
then
SSL_SUBJECT_ORGANIZATIONUNIT=
while [ -z "${SSL_SUBJECT_ORGANIZATIONUNIT}" ]
do
echo -e "\nType organization unit name of SSL certificate, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_WARNING}${old_input_value}${SETCOLOR_NORMAL}]:"
echo -en "> "
read SSL_SUBJECT_ORGANIZATIONUNIT
if [ -z "${SSL_SUBJECT_ORGANIZATIONUNIT}" ]
then
SSL_SUBJECT_ORGANIZATIONUNIT=${old_input_value}
fi
done
else
SSL_SUBJECT_ORGANIZATIONUNIT=${old_input_value}
fi
fi
echo "SSL_SUBJECT_ORGANIZATIONUNIT='${SSL_SUBJECT_ORGANIZATIONUNIT}'" >> ${installation_cfg_tmpfile}
if [ -z "${SSL_SUBJECT_EMAIL}" ]
then
while [[ ! "${SSL_SUBJECT_EMAIL}" =~ ${mailaddress_regular_expression} ]]
do
echo -e "\nType organization unit name of SSL certificate, followed by [ENTER]"
echo -e "Default to [${SETCOLOR_INFO}[email protected]${SETCOLOR_NORMAL}]:"