-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstallplugin
executable file
·154 lines (125 loc) · 6.73 KB
/
installplugin
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
#!/bin/bash -x
machine_list=('x2270-01' 'x2270-02' 'x2250-02')
base=$HOME/versions
zip_name=com.example.notificationManager-1.0.zip
zip_origin=$( find $base -type d -iname unboundid-server-sdk-* )
zip_location=$zip_origin/build/$zip_name
#zip_origin=~/versions/scripts/installplugin/$zip_name
#zip_destination=/ds/aponcy/$zip_name
home=/ds/alu-vsdm/
host_base=/ds/alu-*
upload_base=/ds/aponcy
my_machine=$HOSTNAME
log=script.out
script_location="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
script_name=installplugin
function install_plugin () {
$1/bin/manage-extension --install $upload_base/$zip_name --no-prompt
$1/bin/dsconfig set-backend-prop \
--backend-name changelog \
--set enabled:true \
--set "changelog-maximum-age:2 d" \
--no-prompt
$1/bin/dsconfig create-notification-manager \
--type third-party \
--manager-name "Example Notification Manager" \
--set enabled:true \
--set "subscription-base-dn:ou=subscriptions,ou=people,dc=example,dc=com" \
--set extension-class:com.unboundid.directory.sdk.examples.ExampleNotificationManager \
--no-prompt
$1/bin/dsconfig set-backend-prop --backend-name dataset --set "notification-manager:Example Notification Manager" --no-prompt
$1/bin/dsconfig set-password-policy-prop --policy-name "Default Password Policy" --set allow-pre-encoded-passwords:true --no-prompt
$1/bin/dsconfig set-log-publisher-prop --publisher-name "Server SDK Extension Debug Logger" --set enabled:true --no-prompt
$1/bin/dsconfig set-log-publisher-prop --publisher-name "File-Based Access Logger" --set log-intermediate-responses:true --no-prompt
$1/bin/dsconfig set-log-publisher-prop --publisher-name "File-Based Access Logger" --set suppress-internal-operations:false --no-prompt
$1/bin/dsconfig create-gauge-data-source \
--source-name "Notification Destination Missed Changes" \
--type indicator \
--set monitor-objectclass:ds-notification-destination-monitor-entry \
--set monitor-attribute:ds-notification-missed-changes \
--set "resource-type:Notification Destination" \
--set "description:Indicates whether a notification destination has missed any changes." \
--no-prompt
$1/bin/dsconfig create-gauge \
--gauge-name "Notification Destination Missed Changes" \
--type indicator \
--set enabled:false \
--set "update-interval:5 s" \
--set samples-per-update-interval:2 \
--set "gauge-data-source:Notification Destination Missed Changes" \
--set warning-value:true \
--set "description:Indicates whether a notification destination has missed any changes from this server." \
--no-prompt
$1/bin/dsconfig create-gauge-data-source \
--source-name "Notification Destination Pending Change Age" \
--type numeric \
--set monitor-objectclass:ds-notification-destination-monitor-entry \
--set monitor-attribute:ds-notification-age-of-next-pending-change-seconds \
--set "resource-type:Notification Destination" \
--set statistic-type:minimum \
--set "description:Indicates whether a notification destination is too far behind" \
--no-prompt
$1/bin/dsconfig create-gauge \
--gauge-name "Notification Destination Pending Change Age" \
--type numeric \
--set "update-interval:5 s" \
--set samples-per-update-interval:1 \
--set "gauge-data-source:Notification Destination Pending Change Age" \
--set warning-value:10 \
--set "description:Indicates whether a notification destination is far behind in delivering changes." \
--no-prompt
$1/bin/dsconfig set-access-control-handler-prop --add 'global-aci:(extop="1.3.6.1.4.1.30221.2.6.42 || 1.3.6.1.4.1.30221.2.6.41 || 1.3.6.1.4.1.30221.2.6.40 || 1.3.6.1.4.1.30221.2.6.39 || 1.3.6.1.4.1.30221.2.6.38 || 1.3.6.1.4.1.30221.2.6.37 || 1.3.6.1.4.1.30221.2.6.36")(version 3.0; acl "Extended Operations for Notification Management"; allow (read) userdn="ldap:///all";)' --no-prompt
$1/bin/dsconfig set-access-control-handler-prop --add 'global-aci:(extop="1.3.6.1.4.1.30221.2.6.10")(version 3.0; acl "Proxy User Access to selected extended operations"; allow (read) userdn="ldap:///cn=Proxy User,cn=Root DNs,cn=config";)' --add 'global-aci:(targetattr="*")(version 3.0; acl "Proxy User Access"; allow(proxy) userdn="ldap:///cn=Proxy User,cn=Root DNs,cn=config";)' --add 'global-aci:(targetattr="entryUUID || entryDN || ds-entry-unique-id || createTimestamp || ds-create-time || modifyTimestamp || ds-update-time || ds-entry-checksum")(version 3.0;acl "Authenticated read access to operational attributes used by the SCIM servlet extension"; allow (read,search,compare) userdn="ldap:///all";)' --add 'global-aci:(targetcontrol="1.3.6.1.1.13.2 || 1.2.840.113556.1.4.473 || 1.2.840.113556.1.4.319 || 2.16.840.1.113730.3.4.9 || 1.3.6.1.1.12")(version 3.0;acl "Authenticated access to controls used by the SCIM servlet extension"; allow (all) userdn="ldap:///all";)' --no-prompt
$1/bin/stop-ds --restart --quiet
echo "Install complete"
}
function setup_proxy () {
$1/bin/dsconfig set-access-control-handler-prop --add 'global-aci:(extop="1.3.6.1.4.1.30221.2.6.42 || 1.3.6.1.4.1.30221.2.6.41 || 1.3.6.1.4.1.30221.2.6.40 || 1.3.6.1.4.1.30221.2.6.39 || 1.3.6.1.4.1.30221.2.6.38 || 1.3.6.1.4.1.30221.2.6.37 || 1.3.6.1.4.1.30221.2.6.36")(version 3.0; acl "Extended Operations for Notification Management"; allow (read) userdn="ldap:///all";)' --applyChangeTo single-server --no-prompt
$1/bin/dsconfig create-extended-operation-handler \
--handler-name "Proxied Notification Subscription" \
--type third-party-proxied \
--set enabled:true \
--set extension-class:com.unboundid.directory.proxy.extensions.ProxiedNotificationSubscriptionExtendedOperation \
--applyChangeTo single-server \
--no-prompt
}
function update_plugin () {
$1/bin/manage-extension --update $zip_destination --no-prompt
$1/bin/stop-ds --restart --quiet
}
function machine_steps () {
echo "*** Doing work to $1"
scp -c blowfish $script_location/$script_name $zip_location root@$1:$upload_base
ssh root@$1 "$upload_base/$script_name -s"
}
# if this script is run as the slave then execute the install
if [[ "$1" =~ (-+([sS]|[sS]lave)) ]] ; then
echo "*** Executing as slave ***"
cd /
for directory in $( find $home -type d -iname ds-* )
do
install_plugin $directory
done
for proxy in $( find $home -type d -iname proxyserver* )
do
setup_proxy $proxy
done
# Update the plugin
elif [[ "$1" =~ (-+([uU]|[uU]pdate)) ]] ; then
echo "*** Executing as update ***"
cd /
for directory in $( find $home -type d -iname ds-* )
do
update_plugin $directory
done
# if this script is run as the master
elif [[ "$1" =~ (-+([mM]|[mM]aster)) ]] ; then
echo "*** Executing as master ***"
for machine in ${machine_list[*]}
do
( machine_steps $machine & ) > $machine.log 2>&1
#machine_steps $machine
done
else
echo "Please provide an argument --slave or --master"
fi