-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path_Acertos_COS_Default
324 lines (269 loc) · 14.8 KB
/
_Acertos_COS_Default
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
#!/bin/bash
#+----------------GERANDO LOG-----------------------+OK"
SCRIPT=`basename $0`
LOG=`echo /Scripts_Zimbra/$SCRIPT.log | sed s/'.sh'/'.log'/g`
exec &> >(tee -a "$LOG")
echo "[`date`] ==== Inicio de rotina..."
#+----------------GERANDO LOG-----------------------+OK"
clear
#Checa se o usuario é root
LOCAL_USER=`id -u -n`
if [ $LOCAL_USER != "root" ] ; then
echo " Rodar como usuario root"
echo " saindo..."
echo ""
exit
fi
dir="Diretorio Atual : `pwd`"
hostname="Hostname : `hostname --fqdn`"
ip="IP : `ifconfig | awk 'NR>=2 && NR<=2' | awk '{print $3}'`"
versaoso="Versao S.O. : `lsb_release -d | cut -d : -f 2- | sed 's/^[ \t]*//;s/[ \t]*$//'`"
release="Release : `lsb_release -r | cut -d : -f 2- | sed 's/^[ \t]*//;s/[ \t]*$//'`"
codename="Codename : `lsb_release -c | cut -d : -f 2- | sed 's/^[ \t]*//;s/[ \t]*$//'`"
kernel="Kernel : `uname -r`"
arquitetura="Arquitetura : `uname -m`"
versaozimbra="Versao Zimbra : `su - zimbra -c 'zmcontrol -v'`"
echo "+-------------------------------------------------+"
echo "| Utilitario para Zimbra v1.35 |"
echo "+-------------------------------------------------+"
echo "+-------------------------------------------------+"
echo "| Escrito por: |"
echo "| Thiago Castro - www.hostlp.net |"
echo "+-------------------------------------------------+"
echo
echo $dir
echo "+-------------------------------------------------+"
echo $hostname
echo "+-------------------------------------------------+"
echo $ip
echo "+-------------------------------------------------+"
echo $versaoso
echo "+-------------------------------------------------+"
echo $release
echo "+-------------------------------------------------+"
echo $codename
echo "+-------------------------------------------------+"
echo $kernel
echo "+-------------------------------------------------+"
echo $arquitetura
echo "+-------------------------------------------------+"
echo $versaozimbra
echo "+-------------------------------------------------+"
echo
echo "Aperte <ENTER> para continuar e começar..."
read
echo
echo "==================EXECUTANDO======================="
echo
#Variavel
UsrZ="su - zimbra -c"
echo "Alterar Quota padrão por usuario do dominio em bytes (1073741824 = 1GB / 2147483648 = 2GB / 3221225472 = 3GB / 4294967296 = 4GB / 5368709120 = 5GB / 0 = ILIMITADO)"
echo -n "Digite em bytes a quota do novo Dominio: "
read USRQUOTA
$UsrZ 'zmprov mc default zimbraMailQuota "'$USRQUOTA'"'
echo "+-------------------------------------------------+OK"
echo "Ajustando o tempo de vida dos e-mails (0 = ILIMITADO / Padrão HOSTLP 7200)"
echo -n "Digite em dias o tempo de vida dos e-mails do Dominio: "
read LIFETIME
$UsrZ 'zmprov mc default zimbraMailMessageLifetime "'$LIFETIME'"'
$UsrZ 'zmprov ms `zmhostname` zimbraMailPurgeSleepInterval 1m'
echo "+-------------------------------------------------+OK"
echo "Adicioando todos os Dominios para o COS default"
COSID="`su - zimbra -c "zmprov gc default zimbraId|cut -d' ' -f2|egrep -v 'name|$^'"`"
$UsrZ 'for dominios in $(zmprov gad); do zmprov md $dominios zimbraDomainDefaultCOSId "'$COSID'"; done'
echo "+-------------------------------------------------+OK"
echo "Adicioando Conjunto de serivodres"
COSCS="`su - zimbra -c "zmprov gc default zimbraMailHostPool|cut -d' ' -f2|egrep -v 'name|$^'"`"
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos zimbraMailHostPool "'$COSCS'"; done'
echo "+-------------------------------------------------+OK"
echo "Alterando Aviso de Quota para 90%"
$UsrZ 'for dominios in $(zmprov gad); do zmprov md $dominios zimbraDomainAggregateQuotaWarnPercent 90; done'
echo "+-------------------------------------------------+OK"
echo "Acertando Fuso Horario -0300"
$UsrZ 'for dominios in $(zmprov gad); do zmprov md $dominios zimbraPrefTimeZoneId America/Sao_Paulo; done'
echo "+-------------------------------------------------+OK"
echo "Acertando Protocolo"
$UsrZ 'for dominios in $(zmprov gad); do zmprov md $dominios zimbraPublicServiceProtocol https; done'
echo "+-------------------------------------------------+OK"
echo "Alterar Quota do dominio em bytes (10737418240 = 10GB / 21474836480 = 20GB / 32212254720 = 30GB / 42949672960 = 40GB / 53687091200 = 50GB)"
echo "Ou ENTER para ilimitado"
echo -n "Digite em bytes a quota do novo Dominio: "
read DOMANINQUOTA
$UsrZ 'for dominios in $(zmprov gad); do zmprov md $dominios zimbraMailDomainQuota "'$DOMANINQUOTA'"; done'
echo "+-------------------------------------------------+OK"
echo "Enviar e-mail de aviso de Quota para: "
echo -n "Digite o e-mail Completo: "
read EMAILQUOTA
$UsrZ 'for dominios in $(zmprov gad); do zmprov md $dominios zimbraDomainAggregateQuotaWarnEmailRecipient "'$EMAILQUOTA'"; done'
echo "+-------------------------------------------------+OK"
echo "Politica de Quota agregada ao Dominio: "
$UsrZ 'for dominios in $(zmprov gad); do zmprov md $dominios zimbraDomainAggregateQuotaPolicy BLOCKSENDRECEIVE; done'
echo "+-------------------------------------------------+OK"
echo "Alterando nome do Compartilhamento do Porta Arquivos"
echo -n "Digite o nome do Compartilhamento do Porta Arquivos: "
read PORTAARQ
$UsrZ 'for dominios in $(zmprov gad); do zmprov md $dominios zimbraBasicAuthRealm "'$PORTAARQ'"; done'
echo "+-------------------------------------------------+OK"
echo "Criando usuario GALSYNC: "
$UsrZ 'for dominios in $(zmprov gad); do zmgsautil createAccount -a galsync@$dominios -n default --domain $dominios -t zimbra -s `hostname --fqdn` -f default; done'
$UsrZ 'for dominios in $(zmprov gad); do zmgsautil forceSync -a galsync@$dominios -n default; done'
$UsrZ 'for dominios in $(zmprov gad); do zmprov mds galsync@$dominios default zimbraDataSourcePollingInterval 12h; done'
echo "+-------------------------------------------------+OK"
echo "Alterando Logo"
$UsrZ 'for dominios in $(zmprov gad); do zmprov md $dominios zimbraSkinLogoURL https://site.hostlp.com.br; done'
$UsrZ 'for dominios in $(zmprov gad); do zmprov md $dominios zimbraSkinLogoLoginBanner https://site.hostlp.com.br/imagens/zimbra/Logotipo_Novo_130x58.png; done'
$UsrZ 'for dominios in $(zmprov gad); do zmprov md $dominios zimbraSkinLogoAppBanner https://site.hostlp.com.br/imagens/zimbra/Logotipo_Novo_80x36.png; done'
echo "+-------------------------------------------------+OK"
echo "Limitar usuarios para o Dominio"
echo "Ou ENTER para ilimitado"
echo -n "Quantas contas? "
read QTSCONTAS
$UsrZ 'for dominios in $(zmprov gad); do zmprov md $dominios zimbraDomainMaxAccounts "'$QTSCONTAS'"; done'
echo "+-------------------------------------------------+OK"
echo "Alterando CharSet do COS"
$UsrZ 'for dominios in $(zmprov gad); do zmprov mc default zimbraPrefMailDefaultCharset UTF-8; done'
echo "+-------------------------------------------------+OK"
echo "Bloqueia alteração de temas"
$UsrZ 'zmprov mc default zimbraFeatureSkinChangeEnabled FALSE'
echo "+-------------------------------------------------+OK"
echo "Bloqueia gerenciar Zimlets"
$UsrZ 'zmprov mc default zimbraFeatureManageZimlets FALSE'
echo "+-------------------------------------------------+OK"
echo "Habilite Client Touch de Celular"
$UsrZ 'zmprov mc default zimbraFeatureTouchClientEnabled TRUE'
echo "+-------------------------------------------------+OK"
echo "Ativa Lixeira"
$UsrZ 'zmprov mc default zimbraDumpsterEnabled TRUE'
echo "+-------------------------------------------------+OK"
echo "Habilita limpar a pasta da lixeira"
$UsrZ 'zmprov mc default zimbraDumpsterPurgeEnabled TRUE'
echo "+-------------------------------------------------+OK"
echo "Libera acesso a IMAP"
$UsrZ 'zmprov mc default zimbraImapEnabled TRUE'
echo "+-------------------------------------------------+OK"
echo "Bloqueia acesso a IMAP externo"
$UsrZ 'zmprov mc default zimbraFeatureImapDataSourceEnabled FALSE'
echo "+-------------------------------------------------+OK"
echo "Bloqueia acesso a POP externo"
$UsrZ 'zmprov mc default zimbraFeaturePop3DataSourceEnabled FALSE'
echo "+-------------------------------------------------+OK"
echo "Libera acesso a POP"
$UsrZ 'zmprov mc default zimbraPop3Enabled TRUE'
echo "+-------------------------------------------------+OK"
echo "Ativa lembrete por SMS"
$UsrZ 'zmprov mc default zimbraFeatureCalendarReminderDeviceEmailEnabled TRUE'
echo "+-------------------------------------------------+OK"
echo "Ativa operação em lote"
$UsrZ 'zmprov mc default zimbraPrefShowSelectionCheckbox TRUE'
echo "+-------------------------------------------------+OK"
echo "Altera Idioma para pt_BR"
$UsrZ 'zmprov mc default zimbraPrefLocale pt_BR'
echo "+-------------------------------------------------+OK"
echo "Desativa Mini Calendario"
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos zimbraPrefCalendarAlwaysShowMiniCal FALSE; done'
echo "Altera Fuso Horario para Sao_Paulo"
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos zimbraPrefTimeZoneId America/Sao_Paulo; done'
echo "Agrupar e-mail por mensagem"
$UsrZ 'zmprov mc default zimbraPrefGroupMailBy message'
echo "+-------------------------------------------------+OK"
echo "Exibe imagens externas"
$UsrZ 'zmprov mc default zimbraPrefDisplayExternalImages TRUE'
echo "+-------------------------------------------------+OK"
echo "Ativa notificação de mensagens novas"
$UsrZ 'zmprov mc default zimbraPrefMailToasterEnabled TRUE'
echo "+-------------------------------------------------+OK"
echo "Tocar som ao receber mensagem"
$UsrZ 'zmprov mc default zimbraPrefMailSoundsEnabled TRUE'
echo "+-------------------------------------------------+OK"
echo "Destaca aba quando houver novas mensagens"
$UsrZ 'zmprov mc default zimbraPrefMailFlashTitle TRUE'
echo "+-------------------------------------------------+OK"
echo "Piscar navegador quando houver novas mensagens"
$UsrZ 'zmprov mc default zimbraPrefMailFlashIcon TRUE'
echo "+-------------------------------------------------+OK"
echo "AAtiva notificação para novos eventos"
$UsrZ 'zmprov mc default zimbraPrefCalendarToasterEnabled TRUE'
echo "+-------------------------------------------------+OK"
echo "Skin padrão HARMONY"
$UsrZ 'zmprov mc default zimbraPrefSkin harmony'
$UsrZ 'zmprov mc default zimbraAvailableSkin harmony'
echo "+-------------------------------------------------+OK"
echo "Habilita enviar e-mail depois"
$UsrZ 'zmprov mc default zimbraFeatureMailSendLaterEnabled TRUE'
echo "+-------------------------------------------------+OK"
echo "Habilita S/MIME"
$UsrZ 'zmprov mc default zimbraFeatureSMIMEEnabled TRUE'
echo "+-------------------------------------------------+OK"
echo "Mensagem de aviso de cota"
$UsrZ 'zmprov mc default zimbraQuotaWarnMessage 'From: Postmaster <postmaster@${RECIPIENT_DOMAIN}>${NEWLINE}To: ${RECIPIENT_NAME} <${RECIPIENT_ADDRESS}>${NEWLINE}Subject: Aviso de cota${NEWLINE}Data: ${DATE}${NEWLINE}Content-Type: text/plain${NEWLINE}${NEWLINE}O tamanho da sua caixa de correio atingiu ${MBOX_SIZE_MB}MB, que acabou ${WARN_PERCENT}% do seu ${QUOTA_MB}MB quota.${NEWLINE}Exclua algumas mensagens para evitar exceder sua cota.${NEWLINE}''
echo "+-------------------------------------------------+OK"
echo "Habilita segurança de senha"
$UsrZ 'zmprov mc default zimbraPasswordMinUpperCaseChars 1'
$UsrZ 'zmprov mc default zimbraPasswordMinLowerCaseChars 1'
$UsrZ 'zmprov mc default zimbraPasswordMinPunctuationChars 1'
$UsrZ 'zmprov mc default zimbraPasswordMinNumericChars 1'
$UsrZ 'zmprov mc default zimbraPasswordMinUpperCaseChars 1'
$UsrZ 'zmprov mc $cos zimbraPasswordEnforceHistory 1'
echo "+-------------------------------------------------+OK"
echo "Ativa e desativa alguns Zimlets"
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos zimbraZimletAvailableZimlets ''; done'
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos +zimbraZimletAvailableZimlets 'com_zimbra_attachcontacts'; done'
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos +zimbraZimletAvailableZimlets 'com_zimbra_attachmail'; done'
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos +zimbraZimletAvailableZimlets 'com_zimbra_date'; done'
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos +zimbraZimletAvailableZimlets 'com_zimbra_email'; done'
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos +zimbraZimletAvailableZimlets 'com_zimbra_mailarchive'; done'
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos +zimbraZimletAvailableZimlets 'com_zimbra_srchhighlighter'; done'
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos +zimbraZimletAvailableZimlets 'com_zimbra_url'; done'
echo "+-------------------------------------------------+OK"
echo "Desativa Zimbra-Drive - Sim/Nao"
read CONFIRMA
case $CONFIRMA in
s|S|Sim|sim)
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos -zimbraZimletAvailableZimlets 'com_zextras_drive_open'; done'
echo "+-------------------------------------------------+OK"
;;
n|N|Nao|nao)
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos +zimbraZimletAvailableZimlets 'com_zextras_drive_open'; done'
echo "+-------------------------------------------------+OK"
;;
*) echo "Opcao Invalida" ;; esac
echo "Desativa Zimbra-Chat - Sim/Nao"
read CONFIRMA
case $CONFIRMA in
s|S|Sim|sim)
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos -zimbraZimletAvailableZimlets 'com_zextras_chat_open'; done'
echo "+-------------------------------------------------+OK"
;;
n|N|Nao|nao)
$UsrZ 'for cos in $(zmprov gac); do zmprov mc $cos +zimbraZimletAvailableZimlets 'com_zextras_chat_open'; done'
echo "+-------------------------------------------------+OK"
;;
*) echo "Opcao Invalida" ;; esac
echo "Ativa bloqueio por login incorreto"
$UsrZ 'zmprov mc default zimbraPasswordLockoutEnabled TRUE'
echo "+-------------------------------------------------+OK"
echo "Maximo de 10 login incorrretos"
echo "Bloqueia por 3min"
echo "20seg entre as tentativas"
$UsrZ 'zmprov mc default zimbraPasswordLockoutMaxFailures 10'
$UsrZ 'zmprov mc default zimbraPasswordLockoutDuration 3m'
$UsrZ 'zmprov mc default zimbraPasswordLockoutFailureLifetime 20s'
echo "+-------------------------------------------------+OK"
echo "Maximo 3h do token do Console Admin"
echo "Maximo 2h do token de Autenticação"
echo "Limite de 1h de sessão ociosa"
$UsrZ 'zmprov mc default zimbraAdminAuthTokenLifetime 3h'
$UsrZ 'zmprov mc default zimbraAuthTokenLifetime 2h'
$UsrZ 'zmprov mc default zimbraMailIdleSessionTimeout 1h'
echo "+-------------------------------------------------+OK"
echo "Maximo 30 dias de visiilidade da lixeira para usuario final"
$UsrZ 'zmprov mc default zimbraDumpsterUserVisibleAge 30d'
echo "+-------------------------------------------------+OK"
echo "Criando DKIM"
$UsrZ 'for dominios in $(zmprov gad); do /opt/zimbra/libexec/zmdkimkeyutil -a -d $dominios; done'
echo "+-------------------------------------------------+OK"
echo
echo
#echo "Aperte <ENTER> para continuar e começar..."
#read
echo "[`date`] ==== Fim de rotina..."