Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
CHANGELOG

### 1.0.3 ###

- Translated into English

### 1.0.2 ###

- Criado aviso para instalações com mais de um servidor Mailbox
Expand Down Expand Up @@ -39,4 +43,4 @@ CHANGELOG

- Viabiliza a importação das classes de serviço padrão (Default e DefaultExternal), removendo as entradas no LDAP ao importar para adicionar
as entradas exportadas.
- Exclui da exportação das contas de serviço do Zimbra, evitando impacto nas configurações do novo ambiente.
- Exclui da exportação das contas de serviço do Zimbra, evitando impacto nas configurações do novo ambiente.
32 changes: 16 additions & 16 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
TODO:

[x] Confirmar se o novo nome do servidor, caso o hostname seja modificado, seja um FQDN; via <eduardo@bktech.com.br>
[x] Confirmar se o nome do novo servidor (zmhostname) corresponde ao nome das entradas LDAP;
[x] Tratar conta do admin (opção) - apelidos root e postmaster;
[x] Incluir exceção para não importar contas de sistema (zimbraIsSystemResource:TRUE);
[x] Verificar timeout em operações de export e import com caixas postais grandes (+2GB); via <fbraga@trt13.jus.br>
[ ] Criar controle de sessões de exportação e importação;
[ ] Melhorar a varáivel para conectar no ldap com o valor da ldap_url ao invés de ldap://$ZIMBRA_HOSTNAME
[ ] Habilitar opção para já iniciar o export das caixas postais; via <eduardo@bktech.com.br>
[ ] Implementar migração dos domínios; - 1.2
[ ] Incrementar a documentação;
[ ] Permitir filtro para exportar caixas postais: todas, somente ativas, etc...; *continuar importando todas as entradas no LDAP - 1.2
[ ] Permitir migração de configuração de autenticação externa e/ou GAL (testar zimbraAuthMech); - 1.2
[ ] Permitir migrar configurações comuns, tais como: relayhost, mynetworks; - 1.2
[ ] Tratar correções e verificações de vulnerabilidades (zimbra) conhecidas. - 1.2
[ ] Utilizar whiptail para interface. - 2.0
[ ] Criar correção de compartilhamentos - 2.0
[x] Confirm that the new server name, if the hostname is modified, is an FQDN; via <eduardo@bktech.com.br>
[x] Confirm that the name of the new server (zmhostname) matches the name of the LDAP entries;
[x] Treat admin account (option) -root and postmaster nicknames;
[x] Add exception to not import system accounts (zimbraIsSystemResource:TRUE);
[x] Check timeout in export and import operations with large mailboxes (+2GB); via <fbraga@trt13.jus.br>
[ ] Create control of export and import sessions;
[ ] Improve the variable to connect to ldap with the value of ldap_url instead of ldap://$ZIMBRA_HOSTNAME
[ ] Enable the option to start exporting mailboxes; via <eduardo@bktech.com.br>
[ ] Implement domain migration; -1.2
[ ] Increase documentation;
[ ] Allow filter to export mailboxes: all, only active, etc...; *continue importing all entries in LDAP -1.2
[ ] Allow migration of external authentication configuration and/or GAL (test zimbraAuthMech); -1.2
[ ] Allow migrating common configurations, such as: relayhost, mynetworks; -1.2
[ ] Handle fixes and checks for known vulnerabilities (zimbra). -1.2
[ ] Use whiptail for interface. -2.0
[ ] Create Shares Fix -2.0
2 changes: 1 addition & 1 deletion description
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Essa ferramenta foi criada visando facilitar o processo de migração entre ambientes Zimbra, independentemente de qual versão ou edição esteja sendo utilizada. Motivada pelos desafios encontrados em migrações efetuadas pela BKTECH (parceiro oficial Zimbra para negócios e treinamentos), além da participação em comunidades do Zimbra, a ferramenta visa, no decorrer de sua evolução, atender os mais diversos cenários, contemplando também a migração de outras plataformas, livres e proprietárias - "A2Z: Anything/Anywhere to Zimbra".
This tool was created to facilitate the migration process between Zimbra environments, regardless of which version or edition is being used. Motivated by the challenges encountered in migrations carried out by BKTECH (official Zimbra partner for business and training), in addition to participation in Zimbra communities, the tool aims, in the course of its evolution, to meet the most diverse scenarios, also including migration from other platforms , free and proprietary -"A2Z: Anything/Anywhere to Zimbra".
76 changes: 38 additions & 38 deletions func.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash
#Changelog:
# 15/Nov/2016: Criação do arquivo func.sh (Fabio Soares Schmidt)

#FUNCOES E VARIAVEIS PARA O UTILITARIO
NORMAL_TEXT="printf '\e[1;34m%-6s\e[m\n'" #Azul
ERROR_TEXT="printf '\e[1;31m%s\e[0m\n'" #Vermelho
INFO_TEXT="printf '\e[1;33m%s\e[0m\n'" #Amarelo
CHOICE_TEXT="printf '\e[1;32m%s\e[0m\n'" #Verde
NO_COLOUR="'\e[0m'" #Branco
MAILBOX_LIST=`zmprov -l gaa | grep -v -E "admin|virus-|ham.|spam.|galsync"` #TODAS AS CONTAS DO ZIMBRA, EXCETO CONTAS DE SISTEMA
# 15/Nov/2016: Creating the func.sh file (Fabio Soares Schmidt)

#FUNCTIONS AND VARIABLES FOR THE UTILITY
NORMAL_TEXT="printf '\e[1;34m%-6s\e[m\n'" #Blue
ERROR_TEXT="printf '\e[1;31m%s\e[0m\n'" #Red
INFO_TEXT="printf '\e[1;33m%s\e[0m\n'" #Yellow
CHOICE_TEXT="printf '\e[1;32m%s\e[0m\n'" #Green
NO_COLOUR="'\e[0m'" #White
MAILBOX_LIST=`zmprov -l gaa | grep -v -E "admin|virus-|ham.|spam.|galsync"` #ALL ZIMBRA ACCOUNTS EXCEPT SYSTEM ACCOUNTS
WORKDIR=`pwd`"/export"
SINGLE_MAILBOX=1
MAILBOX_SERVERS="`zmprov gas mailbox | wc -l`"
Expand All @@ -23,9 +23,9 @@ echo ++++++++++++++++++++++++++++++++++++++++

test_exec()
{
read -p "Continuar (sim/nao)?" choice
read -p "Continue (Yes/No)?" choice
case "$choice" in
y|Y|yes|s|S|sim ) $NORMAL_TEXT "Iniciando utilitario";;
y|Y|yes|s|S|sim ) $NORMAL_TEXT "Starting utility";;
n|N|no|nao ) exit 0;;
* ) test_exec ;;
esac
Expand All @@ -37,10 +37,10 @@ Check_Directory()
{

if [ ! -d "$DIRETORIO" ]; then
$ERROR_TEXT "ERRO: O diretorio $DIRETORIO nao existe, abortando execucao."
$ERROR_TEXT "Error: The directory $DIRETORIO does not exist, aborting execution."
exit 1
else
$INFO_TEXT "OK: Diretorio $DIRETORIO existente."
$INFO_TEXT "OK: Existing $DIRECTORY directory."

fi
}
Expand All @@ -55,10 +55,10 @@ for i in "${COMANDOS[@]}"
# do whatever on $i
type $i >/dev/null 2>/dev/null
if [ $? == 0 ]; then
$INFO_TEXT "OK: comando $i existente."
$INFO_TEXT "OK: existing $i command."
separator_char
else
$ERROR_TEXT "ERRO: O comando $i nao foi encontrado, abortando execucao."
$ERROR_TEXT "Error: The command $i was not found, aborting execution."
exit 1
fi
done
Expand All @@ -72,10 +72,10 @@ Check_Maibox()
{

if (($MAILBOX_SERVERS > $MAILBOX_SERVERS)); then
$ERROR_TEXT "CUIDADO: A versao atual foi desenvolvida para ambientes Single Server ou com apenas um servidor mailbox."
$ERROR_TEXT "CUIDADO: Para ambientes com mais de um servidor Mailbox sera necessario alterar os arquivos exportados se desejar renomear os servidores"
$ERROR_TEXT "CAUTION: The current version was developed for Single Server environments or environments with just one mailbox server."
$ERROR_TEXT "CAUTION: For environments with more than one Mailbox server, it will be necessary to change the exported files if you want to rename the servers"
else
$NORMAL_TEXT "OK: Ambiente possui apenas um servidor Mailbox"
$NORMAL_TEXT "OK: Environment has only one Mailbox server"
fi
}

Expand All @@ -84,7 +84,7 @@ fi
Enter_New_Hostname()
{

read -p "Informe o novo hostname do servidor Zimbra: " userInput
read -p "Enter the new Zimbra server hostname: " userInput


if [[ -z "$userInput" ]]; then
Expand All @@ -93,12 +93,12 @@ if [[ -z "$userInput" ]]; then
else
TEST_FQDN=`echo $userInput | awk -F. '{print NF}'`
if [ ! $TEST_FQDN -ge 2 ]; then
$ERROR_TEXT "ERRO: O hostname informado nao e um FQDN valido"
$ERROR_TEXT "Error: The hostname provided is not a valid FQDN"
Enter_New_Hostname
fi
OLD_HOSTNAME="$zimbra_server_hostname"
NEW_HOSTNAME="$userInput"
$CHOICE_TEXT "Hostname informado: $NEW_HOSTNAME"
$CHOICE_TEXT "Hostname reported: $NEW_HOSTNAME"
fi
}

Expand All @@ -108,9 +108,9 @@ Run_as_Zimbra()
{

if [ "$(whoami)" == "zimbra" ]; then
$INFO_TEXT "OK: Executando como Zimbra."
$INFO_TEXT "OK: Running as Zimbra."
else
$ERROR_TEXT "ERRO: Esse comando deve ser executado como Zimbra."
$ERROR_TEXT "ERROR: This command must be run as Zimbra."
exit 1
fi
}
Expand All @@ -120,14 +120,14 @@ fi
Replace_Hostname()
{
#$INFO_TEXT "Modificar hostname"
read -p "O Hostname do servidor do Zimbra sera alterado (sim/nao)?" choice
read -p "Will the Zimbra server hostname be changed (yes/no)?" choice
case "$choice" in
y|Y|yes|s|S|sim )
$CHOICE_TEXT "O Hostname do servidor sera alterado."
$CHOICE_TEXT "The server Hostname will be changed."
Enter_New_Hostname
Execute_Replace_Hostname
;;
n|N|no|nao ) $CHOICE_TEXT "Sera mantido o hostname do servidor.";;
n|N|no|nao ) $CHOICE_TEXT "The server hostname will be maintained.";;
* ) Replace_Hostname ;;
esac
}
Expand All @@ -136,18 +136,18 @@ esac

Execute_Replace_Hostname()
{
sed -i s/$OLD_HOSTNAME/$NEW_HOSTNAME/g $DESTINO/CONTAS.ldif
sed -i s/$OLD_HOSTNAME/$NEW_HOSTNAME/g $DESTINO/ACCOUNTS.ldif
sed -i s/$OLD_HOSTNAME/$NEW_HOSTNAME/g $DESTINO/LISTAS.ldif
}

##

export_Mailboxes()
{
read -p "Deseja exportar as caixas postais (sim/nao)?" choice
read -p "Do you want to export mailboxes (yes/no)?" choice
case "$choice" in
y|Y|yes|s|S|sim ) $CHOICE_TEXT "Sera criada a RELACAO para o export FULL de todas as contas do sistema.";;
n|N|no|nao ) $CHOICE_TEXT "Nao sera efetuado o export das caixas postais. Execucao abortada pelo usuario." ; exit 0 ;;
y|Y|yes|s|S|sim ) $CHOICE_TEXT "The RELATIONSHIP will be created for the FULL export of all accounts in the system.";;
n|N|no|nao ) $CHOICE_TEXT "Mailboxes will not be exported. Execution aborted by user." ; exit 0 ;;
* ) export_Mailboxes ;;
esac
}
Expand All @@ -156,26 +156,26 @@ esac

Export_Dest()
{
read -p "Informe qual sera o diretorio utilizado para exportacao: " userInput
read -p "Enter the directory used for export: " userInput
if [[ -z "$userInput" ]]; then
$ERROR_TEXT "Nenhum diretorio informado"
$ERROR_TEXT "No directories provided"
Export_Dest
else
EXPORT_PATH="$userInput"
$CHOICE_TEXT "Diretorio informado:" "$userInput"
$CHOICE_TEXT "Directory provided:" "$userInput"
fi
}

##

execute_Export_Full()
{
$NORMAL_TEXT "INBOX: Criando arquivo com as contas relacionadas para exportacao:"
$NORMAL_TEXT "INBOX: Creating a file with related accounts for export:"
$INFO_TEXT "$WORKDIR/script_export_FULL.sh"
for mailbox in $( echo $MAILBOX_LIST ); do
echo "zmmailbox -z -m $mailbox -t 0 getRestURL \"//?fmt=tgz\" > $EXPORT_PATH/$mailbox.tgz" >> $WORKDIR/script_export_FULL.sh #comando para export full
echo "zmmailbox -z -m $mailbox -t 0 getRestURL \"//?fmt=tgz\" > $EXPORT_PATH/$mailbox.tgz" >> $WORKDIR/script_export_FULL.sh #command to export full
chmod +x $WORKDIR/script_export_FULL.sh
echo "zmmailbox -z -m $mailbox -t 0 postRestURL \"//?fmt=tgz&resolve=skip\" $EXPORT_PATH/$mailbox.tgz" >> $WORKDIR/script_import_FULL.sh #comando para import full
echo "zmmailbox -z -m $mailbox -t 0 postRestURL \"//?fmt=tgz&resolve=skip\" $EXPORT_PATH/$mailbox.tgz" >> $WORKDIR/script_import_FULL.sh #command to import full
chmod +x $WORKDIR/script_import_FULL.sh
done
}
Expand All @@ -184,7 +184,7 @@ done

execute_Export_Trash()
{
$NORMAL_TEXT "LIXEIRA: Criando arquivo com as contas relacionadas para exportacao:"
$NORMAL_TEXT "TRASH: Creating file with related accounts for export:"
$INFO_TEXT "$WORKDIR/script_export_TRASH.sh"
for i in $( echo $MAILBOX_LIST ); do
echo "zmmailbox -z -m $i -t 0 gru \"//Trash?fmt=tgz\" > $EXPORT_PATH/$i-Trash.tgz" >> $WORKDIR/script_export_TRASH.sh
Expand All @@ -199,7 +199,7 @@ done
execute_Export_Junk()
{

$NORMAL_TEXT "SPAM: Criando arquivo com as contas relacionadas para exportacao:"
$NORMAL_TEXT "SPAM: Creating file with related accounts for export:"
$INFO_TEXT "$WORKDIR/script_export_JUNK.sh"
for i in $( echo $MAILBOX_LIST ); do
echo "zmmailbox -z -m $i -t 0 gru \"//Junk?fmt=tgz\" > $EXPORT_PATH/$i-Junk.tgz" >> $WORKDIR/script_export_JUNK.sh
Expand Down
2 changes: 1 addition & 1 deletion skell/banner_simples.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
| __ )| | _| |_ ___ ___| |__
| _ \| |/ / __/ _ \/ __| '_ \
| |_) | <| || __/ (__| | | |
|____/|_|\_\\__\___|\___|_| |_| Z2Z - Versão 1.0.2 - Mantido por BKTECH <http://www.bktech.com.br>
|____/|_|\_\\__\___|\___|_| |_| Z2Z - Version 1.0.3 - Mantido por BKTECH <http://www.bktech.com.br>

#################################################################################################################################
Loading