-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloud_init_vip.yaml
1183 lines (1013 loc) · 44.2 KB
/
cloud_init_vip.yaml
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
#cloud-config
# cloud_init_vip.yaml
# vim: syntax=yaml
# This image is used by FG_Sol project to host its VIP portal from:
# https://github.com/virtual-imaging-platform/VIP-portal
# Update the content of the configuration file
# "/root/global_configuration.txt" to your server. This is the first
# file created by the "write_files" entry below.
# flavor: m1.small
# image: CentOS-7-x86_64-GenericCloud-1608
# image id: 5150b27f-42eb-4114-8bec-d8b195ea50e8
# Complete command:
# openstack --insecure server create --key-name cloudkey --image CentOS-7-x86_64-GenericCloud-1608 --flavor m1.small --nic net-id=d487a5d6-7ae3-4a77-a735-c62662da3660 --user-data ~/datas/vip/cloud_init_vip.yaml vip-test
# Add EPEL repo
yum_repos:
epel-release:
baseurl: http://download.fedoraproject.org/pub/epel/7/$basearch
enabled: true
failovermethod: priority
gpgcheck: true
gpgkey: https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
name: Extra Packages for Enterprise Linux 7 - Release
# Add users & groups
groups:
- vip
users:
- name: vip
primary-group: vip
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys:
- MODIFY
# The 2 lines below (hostname and fqdn) and the content of the file
# global_configuration.txt (the first one in the section write_files)
# should be edited to adapt to your server. All values should
# probably be changed, not only those marked MODIFY. No configuration
# is needed in the rest of this file.
# Update the variable HOSTNAME in the file global_configuration.txt,
# just a few lines below.
hostname: sbgvm-151-50
fqdn: sbgvm-151-50.in2p3.fr
manage_etc_hosts: true
# Write file is done BEFORE the creation of users and groups. So we
# can't set the owners to vip:vip (which does not yet exist).
write_files:
# DB_ROOT_PASSWD is a random generated password.
# DB username and password are those given in the script vip.sql,
# which creates the user and the databases.
- path: /root/global_configuration.txt
content: |
HOSTNAME=sbgvm-151-50.in2p3.fr
SMTP_SERVER=sbgsmtp1.in2p3.fr
ADMIN_FIRST_NAME=Administrator
ADMIN_LAST_NAME=IPHC
ADMIN_EMAIL=MODIFY
MYPROXY_USER=MODIFY
MYPROXY_PASSWORD=MODIFY
VO_NAME=biomed
VO_ROOT=/grid/biomed
LFC_HOST=lfc-biomed.in2p3.fr
LFC_PORT=5010
LCG_GFAL_INFOSYS_HOST=cclcgtopbdii02.in2p3.fr
LCG_GFAL_INFOSYS_PORT=2170
LFC_VIP_ROOT_DIR=MODIFY
SE_LIST=sbgse1.in2p3.fr
DB_ROOT_PASSWD="4fa59a1d7adc7e448328f7b6f9a08366"
DB_VIP_USERNAME=vip
DB_VIP_PASSWORD=MODIFY
permissions: '0600'
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# There is nothing to modify by the user below this line. There are
# some "modify" text, but these will be updated by scripts.
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- path: /home/vip/.bashrc
permissions: '0644'
content: |
alias la='ls -lah'
alias lt='ls -lrt'
alias ..='cd ..'
alias -- -='cd -'
export LANG=fr_FR.UTF-8
- path: /home/vip/.bash_profile
permissions: '0644'
content: |
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
- path: /home/vip/.bash_history
permissions: '0644'
content: |
sudo su -
- path: /root/.bashrc
permissions: '0644'
content: |
alias la='ls -lah'
alias lt='ls -lrt'
alias ..='cd ..'
alias -- -='cd -'
export LANG=fr_FR.UTF-8
- path: /root/.bash_profile
permissions: '0644'
content: |
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
- path: /root/.bash_history
permissions: '0644'
content: |
~/sbin/status
less /var/log/cloud-init.log
tail -f /var/log/cloud-init.log
- path: /etc/my.cnf.d/vip.cnf
content: |
[mysqld]
bind-address = 127.0.0.1
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
#collation-server = utf8_general_ci
#character-set-server = utf8
permissions: '0644'
- path: /usr/share/tomcat/.vip/vip.conf
content: |
# MariaDB
database.server.host = localhost
database.server.port = 3306
# VIP Admin account, automatically created, the password is set
# to "tototo" (the string below is the encoded form). The
# account is not put in any group, it is added manually in
# "Support" group via DB surgery.
admin.first.name = <ADMIN_FIRST_NAME>
admin.last.name = <ADMIN_LAST_NAME>
admin.email = <ADMIN_EMAIL>
admin.institution = IPHC
admin.phone = N/A
admin.pass = 21291505ea7d2cc217ee680b1a611f4a
# VO info
vo.name=<VO_NAME>
vo.root=<VO_ROOT>
# MyProxy config
myproxy.host = <HOSTNAME>
myproxy.vo = <VO_NAME>
myproxy.port = 7512
myproxy.user = <MYPROXY_USER>
myproxy.pass = <MYPROXY_PASSWORD>
myproxy.lifetime = 86400
myproxy.min.hours = 12
mail.host = localhost
mail.transport.protocol = smtp
mail.from = <ADMIN_EMAIL>
grida.server.host = <HOSTNAME>
grida.server.port = 5006
# This is also for grida
# LFC pathes
datamanager.users.home = <LFC_VIP_ROOT_DIR>/users
datamanager.groups.home = <LFC_VIP_ROOT_DIR>/groups
# Local (on VIP server) path
datamanager.path = /home/vip/grida
datamanager.lfc.host = <LFC_HOST>
datamanager.lfc.port = <LFC_PORT>
# This looks unused in the code, they use engines with endpoint URIs,
# from a DB table.
# Workflow engine (local apache + CGI)
#moteur.host = http://sbgsol.in2p3.fr/cgi-bin/m2Server-gasw3/moteur_server
# TODO: HTTPS + localhost listening
#moteur.host = https://localhost:443/moteur_server
moteur.host = UNUSED
# Tomcat's $TOMCAT_HOME/conf/truststore.jks
truststore.file = MODIFY
truststore.password = MODIFY
workflows.directory = /var/www/html/workflows
workflows.db.host = localhost
workflows.db.port = 9012
workflows.exec.mode = ws
# TODO: check this is still needed
workflows.db.name = UNUSED
apache.host = localhost
apache.ssl.port = 443
cas.url = https://ng-cas.maatg.fr/pandora-gateway-sl-cas
cas.accounttype = Neuroimaging
# Mail redirection agent
sma.host = <HOSTNAME>
sma.port = 8084
simulation.max.beginner = 1
simulation.max.advanced = 20
simulation.max.platfrom = 25
query.classes = PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> select * from <http://e-ginseng.org/graph/ontology/semEHR> where {?x a rdfs:Class . ?x rdfs:label ?label}
expressLaneToVip.application.class = TestN4U
expressLaneToVip.upload.repository = /home/vip/expresslane2vip/uploads
expressLaneToVip.upload.deleteFile = yes
# Grida service
n4u.grida.server.host = <HOSTNAME>
n4u.grida.server.port = 5006
appletGatelab.classes =
#GateLab,GateLab Test
appletGatelabTest.classes =
#GateLab Test
# Do not let those be empty, put dummy entries
account.undesiredEmailDomains = t.com
account.undesiredCountries = cn
saml.trusted.certificates =
saml.accounttype = Neuroimaging
last.publication.update = 6
boutiques.upload.repository = /tmp/boutiques-cache
boutiques.upload.deleteFile = yes
ssh.publickey = ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuNjIXlgjuBR+WfjGtkieecZfe/ZL6EyNJTbL14bn3/Soof0kFSshDJvFgSH1hNwMMU1hynLbzcEbLTyVMoGQKfQkq7mJPajy9g8878WCKxCRbXv3W1/HT9iab/qqt2dcRYnDEruHwgyELBhQuMAe2W2/mgjd7Y5PxE01bwDcenYl3cU3iJk1sAOHao6P+3xU6Ov+TD8K9aC0LzZpM+rzAmS9HOZ9nvzERExd7k4TUpyffQV9Dpb5jEnEViF3VHqplB8AbWDdcJbiVkUBUe4hQb7nmWP0kHl1+v5SQJ1B4mWCZ+35Rc/9b1GsmPnXg3qqhjeKbrim/NbcUwKr9NPWjQ== [email protected]
permissions: '0644'
- path: /home/vip/.vip/vip.sql
content: |
# The following is mysql_secure_installation
DELETE FROM mysql.user WHERE User='';
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DROP DATABASE test;
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';
# VIP user
CREATE USER '<DB_VIP_USERNAME>'@'localhost' IDENTIFIED BY '<DB_VIP_PASSWORD>';
# Create the databases for VIP
# Charset cannot be utf8 characters as it takes 3 times the space (max
# DB row size is 64 kB)
CREATE DATABASE vip;
ALTER DATABASE vip CHARACTER SET=latin1;
GRANT ALL PRIVILEGES ON vip.* TO '<DB_VIP_USERNAME>'@'localhost';
CREATE DATABASE workflowsdb;
ALTER DATABASE workflowsdb CHARACTER SET=latin1;
GRANT ALL PRIVILEGES ON workflowsdb.* TO '<DB_VIP_USERNAME>'@'localhost';
FLUSH PRIVILEGES;
use workflowsdb;
CREATE TABLE `Inputs` (
`workflow_id` varchar(255) NOT NULL DEFAULT '',
`path` varchar(255) NOT NULL DEFAULT '',
`processor` varchar(255) NOT NULL DEFAULT '',
`type` varchar(50) DEFAULT NULL,
PRIMARY KEY (`workflow_id`,`path`,`processor`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `Outputs` (
`workflow_id` varchar(255) NOT NULL DEFAULT '',
`path` varchar(400) NOT NULL DEFAULT '',
`processor` varchar(255) NOT NULL DEFAULT '',
`type` varchar(50) DEFAULT NULL,
`port` varchar(255) DEFAULT NULL,
PRIMARY KEY (`workflow_id`,`path`,`processor`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `Processors` (
`workflow_id` varchar(255) NOT NULL DEFAULT '',
`processor` varchar(255) NOT NULL DEFAULT '',
`completed` int(11) DEFAULT NULL,
`queued` int(11) DEFAULT NULL,
`failed` int(11) DEFAULT NULL,
PRIMARY KEY (`workflow_id`,`processor`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `Stats` (
`workflow_id` varchar(255) NOT NULL DEFAULT '',
`completed` int(11) DEFAULT NULL,
`completed_wt` bigint(20) DEFAULT NULL,
`completed_et` bigint(20) DEFAULT NULL,
`completed_it` bigint(20) DEFAULT NULL,
`completed_ot` bigint(20) DEFAULT NULL,
`cancelled` int(11) DEFAULT NULL,
`cancelled_wt` bigint(20) DEFAULT NULL,
`cancelled_et` bigint(20) DEFAULT NULL,
`cancelled_it` bigint(20) DEFAULT NULL,
`cancelled_ot` bigint(20) DEFAULT NULL,
`failed_app` int(11) DEFAULT NULL,
`failed_app_wt` bigint(20) DEFAULT NULL,
`failed_app_et` bigint(20) DEFAULT NULL,
`failed_app_it` bigint(20) DEFAULT NULL,
`failed_app_ot` bigint(20) DEFAULT NULL,
`failed_in` int(11) DEFAULT NULL,
`failed_in_wt` bigint(20) DEFAULT NULL,
`failed_in_et` bigint(20) DEFAULT NULL,
`failed_in_it` bigint(20) DEFAULT NULL,
`failed_in_ot` bigint(20) DEFAULT NULL,
`failed_out` int(11) DEFAULT NULL,
`failed_out_wt` bigint(20) DEFAULT NULL,
`failed_out_et` bigint(20) DEFAULT NULL,
`failed_out_it` bigint(20) DEFAULT NULL,
`failed_out_ot` bigint(20) DEFAULT NULL,
`failed_sta` int(11) DEFAULT NULL,
`failed_sta_wt` bigint(20) DEFAULT NULL,
`failed_sta_et` bigint(20) DEFAULT NULL,
`failed_sta_it` bigint(20) DEFAULT NULL,
`failed_sta_ot` bigint(20) DEFAULT NULL,
PRIMARY KEY (`workflow_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `Workflows` (
`id` varchar(255) NOT NULL DEFAULT '',
`username` varchar(255) DEFAULT NULL,
`status` varchar(50) DEFAULT NULL,
`launched` timestamp NULL DEFAULT NULL,
`finish_time` timestamp NULL DEFAULT NULL,
`simulation_name` varchar(255) DEFAULT NULL,
`application` varchar(255) DEFAULT NULL,
`application_version` varchar(255) DEFAULT NULL,
`application_class` varchar(255) DEFAULT NULL,
`engine` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
permissions: '0644'
- path: /etc/systemd/system/grida.service
content: |
[Unit]
Description=Grida server
After=network.target
[Service]
User=vip
Type=simple
WorkingDirectory=/home/vip/grida
# Needed for: /usr/bin/which, lcg-cp & lcg-cr
Environment=PATH=$PATH:/bin:/usr/bin:/usr/share/lcgBundles/Linux_x86_64_glibc-2.12/bin
Environment=LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/share/lcgBundles/Linux_x86_64_glibc-2.12/lib
Environment=JAVA_HOME=/etc/alternatives/jre_1.8.0
ExecStart=/etc/alternatives/jre_1.8.0/bin/java -jar /home/vip/grida/grida-server-1.4.1.jar
Environment=LFC_HOST=<LFC_HOST>
Environment=LCG_GFAL_INFOSYS=<LCG_GFAL_INFOSYS_HOST>:<LCG_GFAL_INFOSYS_PORT>
Environment=LCG_GFAL_VO=<VO_NAME>
[Install]
WantedBy=multi-user.target
permissions: '0664'
- path: /home/vip/grida/grida-server.conf
content: |
agent.port = 5006
agent.retrycount = 5
agent.min.available.diskspace = 0.02
lfc.host = <LFC_HOST>
lfc.preferredSEsList = <SE_LIST>
vo = <VO_NAME>
bdii.host = <LCG_GFAL_INFOSYS_HOST>
bdii.port = <LCG_GFAL_INFOSYS_PORT>
cache.list.max.entries = 30
cache.list.max.hours = 12
cache.files.max.size = 100.0
cache.files.path = /home/vip/grida/cache
pool.max.download = 10
pool.max.upload = 10
pool.max.delete = 5
pool.max.replication = 5
pool.max.history = 15
permissions: '0644'
- path: /etc/systemd/system/sma.service
content: |
[Unit]
Description=SMA (Simple Mail Agent) server
After=network.target
[Service]
User=vip
Type=simple
WorkingDirectory=/home/vip/sma
Environment=JAVA_HOME=/etc/alternatives/jre_1.8.0
ExecStart=/etc/alternatives/jre_1.8.0/bin/java -jar /home/vip/sma/sma-server-0.1.jar
[Install]
WantedBy=multi-user.target
permissions: '0664'
- path: /home/vip/sma/sma-server.conf
content: |
sma.port = 8084
sma.retrycount = 5
mail.host = <SMTP_SERVER>
mail.transport.protocol = smtp
mail.from = <ADMIN_EMAIL>
mail.from.name = VIP
mail.max.simultaneous.runs = 5
sma.max.history = 90
permissions: '0664'
- path: /etc/systemd/system/h2.service
content: |
[Unit]
Description=VIP H2 server
[Service]
User=apache
Type=simple
WorkingDirectory=/home/vip/h2
Environment=JAVA_HOME=/etc/alternatives/jre_1.8.0
ExecStart=/etc/alternatives/jre_1.8.0/bin/java -cp bin/h2-1.3.167.jar org.h2.tools.Server -tcp -tcpAllowOthers
[Install]
WantedBy=multi-user.target
permissions: '0664'
- path: /etc/httpd/conf.d/tomcat.conf
content: |
<VirtualHost *:80>
ServerName <HOSTNAME>
Redirect permanent /vip-portal https://<HOSTNAME>/vip-portal
Redirect permanent /vip https://<HOSTNAME>/vip-portal
</VirtualHost>
<VirtualHost *:443>
ServerName <HOSTNAME>
Redirect permanent /vip https://sbgsol.in2p3.fr/vip-portal
Header always set Strict-Transport-Security "max-age=63072000;"
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM \
EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 \
EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 \
EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 \
!aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK \
!SRP !DSS"
SSLCertificateFile /etc/pki/tls/certs/<_HOSTNAME_>.crt
SSLCertificateKeyFile /etc/pki/tls/private/<_HOSTNAME_>.key
ProxyRequests Off
ProxyPreserveHost On
ErrorLog /var/log/httpd/tomcat.error.log
CustomLog /var/log/httpd/tomcat.log combined
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /vip-portal ajp://localhost:8009/vip-portal
ProxyPassReverse /vip-portal ajp://localhost:8009/vip-portal
</VirtualHost>
permissions: '0644'
- path: /home/vip/tomcat-server.xml
content: |
<GlobalNamingResources>
<Resource name="jdbc/vip"
auth="Container"
type="javax.sql.DataSource"
username="<DB_VIP_USERNAME>"
password="<DB_VIP_PASSWORD>"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/vip"
factory="org.apache.commons.dbcp.BasicDataSourceFactory"
validationQuery="select 1"
testOnBorrow="true"
maxTotal="100"
maxIdle="50" />
permissions: '0644'
- path: /root/sbin/update-conf.sh
content: |
#!/bin/sh
conf_file=$1
file=$2
script_file=/tmp/update-conf-script-$$
cat ${conf_file} | while read line
do
var=`echo $line | cut -d= -f1`
value=`echo $line | cut -d= -f2- | sed -e 's/^"\(.*\)"$/\1/'`
# Use # as separators as / may be in the values.
echo "s#<${var}>#${value}#" >> ${script_file}
done
echo "s#<_HOSTNAME_>#`grep HOSTNAME ${conf_file} | sed 's/HOSTNAME=//' | sed 's/\./_/g'`#" >> ${script_file}
sed -i -f ${script_file} ${file}
rm ${script_file}
permissions: '0744'
- path: /root/sbin/update_java_security.sh
content: |
#!/bin/sh
FILE=`set -- /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.*.x86_64/jre/lib/security/java.security; echo $1`
echo "security.provider.10=org.bouncycastle.jce.provider.BouncyCastleProvider" >> ${FILE}
unset FILE
permissions: '0744'
- path: /root/sbin/update_env_sh.sh
content: |
#!/bin/sh
source /root/global_configuration.txt
TMP_FILE=/tmp/update_env-$$.txt
cat > ${TMP_FILE} <<EOF
s#export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64#export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk#
s/export LFC_HOST=.*/export LFC_HOST=${LFC_HOST}/
s/export LCG_GFAL_INFOSYS=.*/export LCG_GFAL_INFOSYS=${LCG_GFAL_INFOSYS_HOST}:${LCG_GFAL_INFOSYS_PORT}/
s#export ROBOT_PROXY=.*#export ROBOT_PROXY=/var/www/html/workflows/dirac-robot-${VO_NAME}#
s#source \${MOTEUR_HOME}/dirac-client/.*#source /var/www/cgi-bin/m2Server-gasw3/dirac/bashrc \&>/tmp/dirac-env1.err#
EOF
sed -i -f ${TMP_FILE} /var/www/cgi-bin/m2Server-gasw3/env.sh
rm ${TMP_FILE}
cat >> /var/www/cgi-bin/m2Server-gasw3/env.sh <<EOF
# Give access to lcg-* binaries. This must be done at the end
# of the file, after the PATH has been updated by bashrc, which
# adds the not working binaries coming with dirac.
#export PATH=\$PATH:/usr/share/lcgBundles/Linux_x86_64_glibc-2.12/bin
#export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/share/lcgBundles/Linux_x86_64_glibc-2.12/lib
export PATH=/var/www/cgi-bin/m2Server-gasw3/bin:\$PATH
EOF
permissions: '0744'
- path: /root/sbin/update_workflow_agent_conf.sh
content: |
#!/bin/sh
rm /var/www/cgi-bin/m2Server-gasw3/worflow-agent-0.2/workflow-agent.conf
echo "db.h2.server=localhost" > /var/www/cgi-bin/m2Server-gasw3/worflow-agent-0.2/workflow-agent.conf
echo "db.h2.port=9092" >> /var/www/cgi-bin/m2Server-gasw3/worflow-agent-0.2/workflow-agent.conf
permissions: '0744'
- path: /root/sbin/update_moteur2_conf.sh
content: |
#!/bin/sh
source /root/global_configuration.txt
TMP_FILE=/tmp/update_moteur2-$$.txt
cat > ${TMP_FILE} << EOF
s/myproxy-server="MODIFY"/myproxy-server="${HOSTNAME}"/g
s/myproxy-port="MODIFY"/myproxy-port="7512"/g
s/vo="MODIFY"/vo="${VO_NAME}"/g
EOF
sed -i -f ${TMP_FILE} /var/www/cgi-bin/m2Server-gasw3/.moteur2/moteur2.conf
rm ${TMP_FILE}
permissions: '0744'
- path: /root/sbin/update_moteur_default_conf.sh
content: |
#!/bin/sh
source /root/global_configuration.txt
TMP_FILE=/tmp/update_moteur_default_conf-$$.txt
cat > ${TMP_FILE} << EOF
s#LFC_HOME=[^ ]*#LFC_HOME=${LFC_HOST}${LFC_VIP_ROOT_DIR}#g
s/LFC_HOST=[^ ]*/LFC_HOST=${LFC_HOST}/g
s/LCG_GFAL_VO=[^ ]*/LCG_GFAL_VO=${VO_NAME}/g
s/vo\.default\.se.*$/vo.default.se=${SE_LIST}/g
s/plugin\.dirac\.host.*$/plugin.dirac.host = localhost/g
s/plugin\.dirac\.default\.pool.*$/plugin.dirac.default.pool=biomedPool/g
s/plugin\.dirac\.mysql\.host.*$//g
s/plugin\.dirac\.mysql\.port.*$//g
s/plugin\.dirac\.mysql\.user.*$//g
s/plugin\.h2\.server\.host.*$/plugin.h2.server.host = localhost/g
s/plugin\.h2\.server\.port.*$/plugin.h2.server.port = 9092/g
s/plugin\.h2\.user.*$/plugin.h2.user = gasw/g
s/plugin\.h2\.password.*$/plugin.h2.password = gasw/g
s/minorstatus\.service\.enabled = true/minorstatus\.service\.enabled = false/g
EOF
sed -i -f ${TMP_FILE} /var/www/cgi-bin/m2Server-gasw3/conf/default.conf
rm ${TMP_FILE}
permissions: '0744'
- path: /root/sbin/update_moteur_override_conf.sh
content: |
#!/bin/sh
source /root/global_configuration.txt
sed -i -e "s/SE=.*$/SE=\"${SE_LIST}\"/" -e "s/VO=.*$/VO=${VO_NAME}/" /var/www/cgi-bin/m2Server-gasw3/conf/override.conf
permissions: '0744'
- path: /root/sbin/update_proxy_for_vip_moteur_dirac.sh
content: |
#!/bin/sh
# This script supposes the existence of a valid proxy in /tmp/dirac-robot.
# This proxy should be updated by some external means.
echo "---------------------------------------------------------------"
date
echo "Add <VO_NAME> VOMS"
ORIG_FILE=/tmp/dirac-robot
DEST_FILE=/var/www/html/workflows/dirac-robot-<VO_NAME>
X509_USER_PROXY=${ORIG_FILE} voms-proxy-init -n --out $DEST_FILE --voms <VO_NAME>
chmod 600 $DEST_FILE
chown apache:apache $DEST_FILE
/usr/sbin/restorecon $DEST_FILE
echo "Set vip proxy file"
VIP_PROXY_FILE=/usr/share/tomcat/.vip/proxies/x509up_server
cp ${ORIG_FILE} ${VIP_PROXY_FILE}
chmod 600 ${VIP_PROXY_FILE}
chown tomcat:tomcat ${VIP_PROXY_FILE}
/usr/sbin/restorecon ${VIP_PROXY_FILE}
echo "Set vip proxy file with voms"
VIP_PROXY_FILE_VOMS=/usr/share/tomcat/.vip/proxies/<VO_NAME>/x509up_server
cp ${DEST_FILE} ${VIP_PROXY_FILE_VOMS}
chmod 600 ${VIP_PROXY_FILE_VOMS}
chown tomcat:tomcat ${VIP_PROXY_FILE_VOMS}
/usr/sbin/restorecon ${VIP_PROXY_FILE_VOMS}
if [ "$#" -lt 1 ] || [ "$1" != "--no-dirac" ]
then
echo "Set dirac proxy"
source /var/www/cgi-bin/m2Server-gasw3/dirac/bashrc
X509_USER_PROXY=${ORIG_FILE} dirac-admin-proxy-upload -P ${ORIG_FILE} -g <VO_NAME>_user
fi
permissions: '0744'
- path: /root/sbin/update_moteur2_plugin_conf.sh
content: |
#!/bin/sh
source /root/global_configuration.txt
TMP_FILE=/tmp/update_moteur2_plugin_conf-$$.txt
# \ is needed before $#, otherwise the is shell replacement.
cat > ${TMP_FILE} << EOF
s/connection\.username.*$/connection\.username = ${DB_VIP_USERNAME}/
s/connection\.password.*$/connection\.password = ${DB_VIP_PASSWORD}/
s#connection\.url.*\$#connection\.url = jdbc:mysql://localhost:3306/workflowsdb#
EOF
sed -i -f ${TMP_FILE} /var/www/.moteur2/moteur2plugins.conf
sed -i -f ${TMP_FILE} /var/www/prod/.moteur2/moteur2plugins.conf
rm ${TMP_FILE}
permissions: '0744'
- path: /root/sbin/create-lsc-file-and-voms.sh
content: |
#!/bin/sh
source /root/global_configuration.txt
TMP_FILE=/tmp/create-lsc-file-and-voms-$$
wget -q http://operations-portal.egi.eu/xml/voIDCard/public/voname/${VO_NAME} -O ${TMP_FILE}
VOMS_HOSTNAME=`xmllint --xpath '/VoDump/IDCard/gLiteConf/VOMSServers/VOMS_Server/hostname/text()' ${TMP_FILE}`
VOMS_PORT=`xmllint --xpath 'string(/VoDump/IDCard/gLiteConf/VOMSServers/VOMS_Server/@VomsesPort)' ${TMP_FILE}`
DN=`xmllint --xpath '/VoDump/IDCard/gLiteConf/VOMSServers/VOMS_Server/X509Cert/DN/text()' ${TMP_FILE}`
CA_DN=`xmllint --xpath '/VoDump/IDCard/gLiteConf/VOMSServers/VOMS_Server/X509Cert/CA_DN/text()' ${TMP_FILE}`
mkdir -p /etc/grid-security/vomsdir/${VO_NAME}
FILENAME=/etc/grid-security/vomsdir/${VO_NAME}/${VOMS_HOSTNAME}.lsc
echo $DN > ${FILENAME}
echo ${CA_DN} >> ${FILENAME}
mkdir -p /etc/vomses
chmod 755 /etc/vomses
VOMS_FILENAME=/etc/vomses/${VO_NAME}-${VOMS_HOSTNAME}.vo.ncm-vomsclient
echo "\"${VO_NAME}\" \"${VOMS_HOSTNAME}\" \"${VOMS_PORT}\" \"${DN}\" \"${VO_NAME}\"" > ${VOMS_FILENAME}
rm -f ${TMP_FILE}
permissions: '0744'
- path: /root/sbin/update-vip-database.sh
content: |
#!/bin/sh
script_name=$0
source /root/global_configuration.txt
check() {
t1=`mysql -Ns --user=root --password=$DB_ROOT_PASSWD -e "select count(*) from information_schema.tables where table_schema='vip' and table_name = 'VIPUsersGroups';"`
t2=`mysql -Ns --user=root --password=$DB_ROOT_PASSWD -e "select count(*) from information_schema.tables where table_schema='vip' and table_name = 'VIPUsers';"`
if [ $t1 = "1" ] && [ $t2 = "1" ]
then
if [ `mysql -Ns --user=root --password=$DB_ROOT_PASSWD -e "use vip; select count(*) from VIPUsers;"` = "1" ]
then
return 0
fi
fi
return 1
}
waited=false
while ! check
do
echo "Waiting 5s in ${script_name}"
waited=true
sleep 5
done
mysql --user=root --password=$DB_ROOT_PASSWD -e "use vip;insert into VIPUsersGroups values ('$ADMIN_EMAIL', 'Support', 'User');insert into VIPTermsOfuse (date, text) values (now(), 'the text');"
if [ "$waited" = "true" ]
then
echo "${script_name} now done"
fi
permissions: '0744'
- path: /root/sbin/status
content: |
#!/bin/sh
#set -x
# voir les couleurs ici :
# https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
#
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
WHITE='\033[1,37'
NOCOLOR='\033[0m'
check_services() {
services=$*
for service in $services
do
status=`systemctl is-active $service`
if [ "$status" != "active" ]
then
prefix=$RED
else
prefix=$GREEN
fi
echo -e "$service ${prefix}${status}${NOCOLOR}"
done
}
check_audit() {
audit="/var/log/audit/audit.log"
nbDenied=`grep -c denied $audit`
if [ "$nbDenied" -gt 0 ]
then
lastDenied=`grep denied $audit | tail -1`
type=`echo $lastDenied | sed -e 's/.*denied . \([^ ]*\) ..*/\1/'`
date=`echo $lastDenied | sed -e 's/.*(\([0-9]*\).*/\1/'`
if [ "$type" = "read" -o "$type" = "execute" ]
then
fichier=", `echo $lastDenied | sed -e 's/.*name=\"\([^\"]*\)\".*/\1/'`"
else
fichier=""
fi
echo -e "audit.log contains ${RED}${nbDenied} denied${NOCOLOR} (the last is: $type, `date -d @${date}`${fichier})"
else
echo -e "audit.log : ${GREEN}OK${NOCOLOR}"
fi
}
check_enforce_mode() {
mode=`getenforce`
if [ "$mode" = Enforcing" ]
then
prefix=$GREEN
else
prefix=$RED
fi
echo -e "Enforce mode is ${prefix}${mode}${NOCOLOR}"
}
services="fail2ban fetch-crl-cron grida h2 haveged httpd mariadb postfix sma tomcat"
check_services $services
check_audit
check_enforce_mode
permissions: '0744'
runcmd:
###############################
# Setup some usefull aliases
- echo "-------------- Setup some usefull aliases --------------"
- chown vip:vip /home/vip/.bashrc /home/vip/.bash_profile /home/vip/.bash_history
#############################
# Give access to global variables.
- echo "-------------- Give access to global variables --------------"
- . /root/global_configuration.txt
###############################
# Install deltarpm
# Do this early as it helps speed the whole process
- echo "-------------- Install deltarpm --------------"
- yum clean expire-cache
- yum -y -q install deltarpm
###############################
# Enable & start havege & fail2ban daemons (early for security)
# haveged : ameliore random number generator on headless server
# fail2ban : scanne les logs et ban des IP si necessaire.
- echo "-------------- Install haveged and fail2ban --------------"
- yum -y -q install haveged fail2ban
- for s in haveged fail2ban; do systemctl enable $s.service; done
- for s in haveged fail2ban; do systemctl start $s.service; done
###############################
# Update OS
- echo "-------------- yum update and upgrade --------------"
- yum -y update
- yum -y upgrade
###############################
# Get some other useful packages, before installing the rest.
- echo "-------------- Install many usefull package with yum --------------"
- yum -y -q install cryptsetup curl fuse-sshfs iotop lsof mailx net-tools
- yum -y -q install psmisc strace sysstat traceroute unzip wget
###############################
# Mysql
- echo "-------------- mysql --------------"
- yum -y -q install mariadb mariadb-server
- systemctl enable mariadb.service
- systemctl start mariadb.service
- mysqladmin password $DB_ROOT_PASSWD
- /root/sbin/update-conf.sh /root/global_configuration.txt /home/vip/.vip/vip.sql
- mysql --user=root --password=$DB_ROOT_PASSWD < /home/vip/.vip/vip.sql
###############################
# Java => avant apache, h2, ...
- echo "-------------- java --------------"
- yum -y -q install java-1.8.0-openjdk
###############################
# Create auto-signed certificate => to be replaced by correct
# certificate. Before httpd, which needs the certificate.
- echo "-------------- autosigned certificates --------------"
- HOSTNAME_FILE=`echo ${HOSTNAME} | sed -e 's/\./_/g'`
- TMP_FILE=/tmp/server-$$.csr
- openssl genrsa -out /etc/pki/tls/private/${HOSTNAME_FILE}.key 4096
- openssl req -new -subj "/C=FR/O=CNRS/CN=GRID-FR/OU=IPHC/CN=${HOSTNAME}" -key /etc/pki/tls/private/${HOSTNAME_FILE}.key -out ${TMP_FILE}
- openssl x509 -req -days 365 -in ${TMP_FILE} -signkey /etc/pki/tls/private/${HOSTNAME_FILE}.key -out /etc/pki/tls/certs/${HOSTNAME_FILE}.crt
- rm -f ${TMP_FILE}
- unset TMP_FILE
- unset HOSTNAME_FILE
###############################
# Apache
- echo "-------------- httpd / apache --------------"
# First allow access to /etc/httpd/conf/httpd.conf
- setenforce Permissive
# Then install Apache, and module for https.
- yum -y -q install httpd mod_ssl
# Forbid directory listings. Usefull for moteur files.
- sed -i -e 's/Options Indexes/Options/' /etc/httpd/conf/httpd.conf
# Remove configuration of VirtualHost 443 as it is in tomcat.conf
- sed -i '/<VirtualHost/,/\/VirtualHost>/d' /etc/httpd/conf.d/ssl.conf
- /root/sbin/update-conf.sh /root/global_configuration.txt /etc/httpd/conf.d/tomcat.conf
- systemctl enable httpd
- systemctl start httpd
- systemctl status httpd
###############################
# H2
# Version 1.4.x has changed the database format. This means we must
# use a version 1.3.x. Version 1.3.167 is used by VIP server. So we
# use this same version. It can be downloaded with the file
# https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/h2database/h2-2012-05-23.zip
- echo "-------------- h2 --------------"
- export H2_ZIP=h2-2012-05-23.zip
- wget -q https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/h2database/${H2_ZIP} -O /home/vip/${H2_ZIP}
- cd /home/vip && unzip -q /home/vip/${H2_ZIP}
- rm -f /home/vip/${H2_ZIP}
- unset H2_ZIP
- chown -R vip:vip /home/vip/h2
# h2 is run with apache user. It must be accessible.
- chmod 755 /home/vip
- systemctl enable h2.service
- systemctl start h2.service
###############################
# Disable firewall for now
# - echo "-------------- Disable firewall --------------"
#~ - systemctl stop firewalld.service
#~ - systemctl mask firewalld.service
###############################
# Create datamanager dirs. They seem to be unused !?
# - echo "-------------- Create datamanager dirs --------------"
# - mkdir -p /home/vip/datamanager/users
# - mkdir -p /home/vip/datamanager/groups
#~ - mkdir -p /home/vip/expresslane2vip/uploads
###############################
# Enable bouncycastle security provider java classes
- echo "-------------- bouncycastle --------------"
- yum -y -q install bouncycastle
- /root/sbin/update_java_security.sh
###############################
# UMD4
- echo "-------------- umd4 --------------"
- yum -y -q install yum-priorities yum-protectbase
- rpm --import http://repository.egi.eu/sw/production/umd/UMD-RPM-PGP-KEY
- yum -y -q install http://repository.egi.eu/sw/production/umd/4/centos7/x86_64/updates/umd-release-4.1.3-1.el7.centos.noarch.rpm
- wget -q http://repository.egi.eu/sw/production/cas/1/current/repo-files/EGI-trustanchors.repo -O /etc/yum.repos.d/EGI-trustanchors.repo
###############################
# Tools for VIP
- echo "-------------- yum, more tools for vip --------------"
- yum -y -q install ca-policy-egi-core emi-ui openldap-clients glite-lb-client-progs perl-dpm perl-lfc dpm-devel lfc-devel voms*
###############################
# LCG software bundle. This is a least used by grida. moteur may
# also use it, depending on how it is configured.
- echo "-------------- LCG software bundle --------------"
- mkdir -p /usr/share/lcgBundles
- curl -sS http://lhcbproject.web.cern.ch/lhcbproject/dist/Dirac_project/lcgBundles/DIRAC-lcg-1970-01-01-Linux_x86_64_glibc-2.12-python26.tar.gz | tar -C /usr/share/lcgBundles -zxf -
- chown -R root:root /usr/share/lcgBundles
###############################
# SMA (un simple .jar java8)
- echo "-------------- sma --------------"
- mkdir -p /home/vip/sma
- cd /home/vip/sma && wget -q https://github.com/virtual-imaging-platform/SMA/releases/download/r_0_1/sma-server-0.1.zip
- cd /home/vip/sma && unzip -q sma-server-0.1.zip
- rm -f sma-server-0.1.zip
- chown -R vip:vip /home/vip/sma
- /root/sbin/update-conf.sh /root/global_configuration.txt /home/vip/sma/sma-server.conf
- systemctl enable sma.service
- systemctl start sma.service
###############################
# Start and enable cron for fetch-crl
- echo "-------------- fetch-crl --------------"
- yum -y -q install fetch-crl
- systemctl enable fetch-crl-cron
- systemctl start fetch-crl-cron
###############################
# GRIDA (un simple .jar java8)
- echo "-------------- grida --------------"
- mkdir -p /home/vip/grida/cache
- wget -q https://github.com/virtual-imaging-platform/GRIDA/releases/download/1.4.1/grida-server-1.4.1.jar -O /home/vip/grida/grida-server-1.4.1.jar
- /root/sbin/update-conf.sh /root/global_configuration.txt /etc/systemd/system/grida.service
- /root/sbin/update-conf.sh /root/global_configuration.txt /home/vip/grida/grida-server.conf
- systemctl enable grida.service
- systemctl start grida.service
###############################
# Tomcat : needs grida, sma, httpd.
- echo "-------------- tomcat --------------"
- yum -y -q install tomcat
- wget -q https://github.com/virtual-imaging-platform/VIP-portal/releases/download/1.21/vip-portal-1.21.war -O /var/lib/tomcat/webapps/vip-portal.war
- chown -R root:tomcat /var/lib/tomcat/webapps
- mkdir -p /usr/share/tomcat/.vip/proxies/${VO_NAME}
# The HOME of tomcat is /usr/share/tomcat. This is where vip will
# search its configuration and log directory.
# write_files cannot do the chown.
- chown -R tomcat:tomcat /usr/share/tomcat/.vip
- /root/sbin/update-conf.sh /root/global_configuration.txt /usr/share/tomcat/.vip/vip.conf
- touch /usr/share/tomcat/.vip/vip.log
- chown tomcat:tomcat /usr/share/tomcat/.vip/vip.log
- /root/sbin/update-conf.sh /root/global_configuration.txt /home/vip/tomcat-server.xml
- awk -v r="`cat /home/vip/tomcat-server.xml`" '{sub(/.*<GlobalNamingResources>.*$/, r)}1' /etc/tomcat/server.xml > /tmp/tomcat-server-$$.xml
- mv /tmp/tomcat-server-$$.xml /etc/tomcat/server.xml
- systemctl enable tomcat
# tomcat is started at the end of the script, when selinux security
# is configured.
# We restart tomcat each night. It regularly looses the connexion to
# the database.
- echo "30 4 * * * systemctl restart tomcat" >> /var/spool/cron/root
###############################
# Install docker, which may be used by moteur to run local applications.
# - echo "-------------- docker --------------"
# - yum -y -q install docker docker-register
# - systemctl enable docker
# - systemctl start docker
###############################
# Dirac
- echo "-------------- dirac --------------"
- DIRAC_INSTALL_DIR=/var/www/cgi-bin/m2Server-gasw3/dirac
- mkdir -p ${DIRAC_INSTALL_DIR}