forked from NethServer/nethserver-samba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
createlinks
executable file
·223 lines (188 loc) · 5.23 KB
/
createlinks
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
#!/usr/bin/perl -w
#
# Copyright (C) 2012 Nethesis S.r.l.
# http://www.nethesis.it - [email protected]
#
# This script is part of NethServer.
#
# NethServer is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License,
# or any later version.
#
# NethServer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NethServer. If not, see <http://www.gnu.org/licenses/>.
#
use esmith::Build::CreateLinks qw(:all);
use File::Path;
#
# Many events expand smb.conf:
#
templates2events("/etc/samba/smb.conf", qw(
nethserver-samba-update
nethserver-samba-save
ibay-create
ibay-delete
ibay-modify
));
#
# nethserver-samba-update event (smb.conf template expanded above)
#
event_templates('nethserver-samba-update', qw(
/etc/httpd/admin-conf/httpd.conf
/etc/pam.d/system-auth-nh
/etc/pam.d/password-auth-nh
/etc/krb5.conf
/etc/nsswitch.conf
/etc/sudoers
/etc/hosts
));
event_actions('nethserver-samba-update', qw(
initialize-default-databases 00
nethserver-samba-conf 20
nethserver-samba-profile-create 25
nethserver-samba-netcacheflush 99
));
# The httpd-admin reload action is mapped to "graceful" restart since
# nethserver-lib:1c52af5 See #2014
event_services('nethserver-samba-update', qw(
smb restart
nmb restart
winbind restart
httpd-admin reload
));
#
# nethserver-samba-save event (smb.conf template expanded above)
#
event_templates('nethserver-samba-save', qw(
/etc/pam.d/system-auth-nh
/etc/pam.d/password-auth-nh
/etc/krb5.conf
/etc/nsswitch.conf
/etc/hosts
));
event_actions('nethserver-samba-save', qw(
nethserver-samba-clearsid 00
nethserver-samba-netcacheflush 99
));
event_services('nethserver-samba-save', qw(
smb restart
nmb restart
winbind restart
));
# actions for group-create event:
event_actions('group-create', qw(
nethserver-samba-group-sync 30
));
# actions for group-modify event:
event_actions('group-modify', qw(
nethserver-samba-group-sync 30
));
# All of these events require smbd to reload the smb.conf file:
event_actions($_,
"nethserver-samba-smbd-adjust" => '95'
) foreach (qw(
group-create
group-delete
group-modify
ibay-create
ibay-delete
ibay-modify
printer-create
printer-delete
));
event_actions('user-create',
"nethserver-samba-user-create" => '20',
"nethserver-samba-profile-create" => '25',
"nethserver-samba-user-modify" => '30',
);
event_actions('user-delete',
'nethserver-samba-smbd-adjust' => '30',
'nethserver-samba-profile-delete' => '40',
);
event_actions('user-modify',
"nethserver-samba-user-modify" => '30',
);
event_actions('user-lock',
"nethserver-samba-user-modify" => '30',
"nethserver-samba-smbd-adjust" => '95',
);
event_actions('user-unlock',
"nethserver-samba-user-modify" => '30',
"nethserver-samba-smbd-adjust" => '95',
);
event_actions("nethserver-samba-machine-create",
"nethserver-samba-machine-create" => '10',
);
event_actions('password-modify', qw(
nethserver-samba-password-modify 40
nethserver-samba-user-modify 50
));
#--------------------------------------------------
# actions for trusted-networks-modify event
#--------------------------------------------------
event_templates('trusted-networks-modify',
'/etc/samba/smb.conf');
event_services('trusted-networks-modify', qw(
smb restart
nmb restart
));
#--------------------------------------------------
# actions for post-restore-config event
#--------------------------------------------------
event_actions('post-restore-config', qw(
nethserver-samba-restore-tdb 40
));
#--------------------------------------------------
# actions for pre-backup-config event
#--------------------------------------------------
event_actions('pre-backup-config', qw(
nethserver-samba-backup-tdb 40
));
#
# migration-import event (refs #1657)
#
event_actions('migration-import', qw(
nethserver-samba-migrate-sam 30
nethserver-samba-migrate-data 40
nethserver-samba-migrate-ibays 40
));
event_services('migration-import', qw(
winbind restart
smb restart
nmb restart
));
#
# nethserver-samba-adsjoin (refs #1746) This event must be signalled
# after nethserver-samba-save: it is assumed that smb.conf is properly
# configured
#
event_templates('nethserver-samba-adsjoin', qw(
/etc/hosts
));
event_actions('nethserver-samba-adsjoin', qw(
nethserver-samba-smbads 01
));
event_services('nethserver-samba-adsjoin', qw(
winbind restart
));
#
# Initialize SAM DB
#
event_actions('runlevel-adjust', qw(
nethserver-samba-user-create 96
nethserver-samba-sam-conf 97
nethserver-samba-group-sync 98
nethserver-samba-netcacheflush 99
));
#
# Event hostname-modify
#
event_actions('hostname-modify', qw(
nethserver-samba-setsidfromdb 40
));