Skip to content

Instantly share code, notes, and snippets.

View sandromello's full-sized avatar

Sandro Mello sandromello

View GitHub Profile
@sandromello
sandromello / zimbra_custom.md
Last active July 8, 2023 14:03
Zimbra Customization Tips

Customizações Zimbra

Subject no Log

Para apresentar o Subject no log precisamos configurar isso no header checks. O header checks nas versões 6+ vem por padrão desabilitado. Portanto vamos habilitar no nível global.

zmprov mcf zimbraMtaBlockedExtensionWarnRecipient FALSE

Agora no arquivo /opt/zimbra/conf/postfix_header_checks.in adicionar ao arquivo a seguinte linha:

@sandromello
sandromello / cluebringer.md
Last active August 29, 2015 14:02
Policyd AKA Cluebringer Tips for Zimbra

Instalar os pacotes php + php-mysql + httpd + mysql-server

Logar em um servidor MTA:

cd /opt/zimbra/cbpolicyd/share/database/
for i in core.tsql access_control.tsql quotas.tsql amavis.tsql checkhelo.tsql checkspf.tsql greylisting.tsql accounting.tsql
do
./convert-tsql mysql $i
@sandromello
sandromello / audit.md
Created June 2, 2014 21:36
Auditing messages in Zimbra
@sandromello
sandromello / rr.sh
Created July 13, 2014 23:47
Round Robin iptables
#!/bin/bash
#FLUSH
iptables -F
iptables -t nat -F
iptables -F REGRAS_SNAT
iptables -X REGRAS_SNAT
echo 1 > /proc/sys/net/ipv4/ip_forward
@sandromello
sandromello / ldap_zimbra.py
Last active October 26, 2015 16:13
Query ldap zimbra
""" Provisioning functions Zimbra to Zimbra given ldap entries.
Requires: python-ldap
Author: Sandro Mello <[email protected]>
"""
import ldap, sys
import xml.etree.ElementTree as ET
import datetime
LOCALCONFIG = 'localconfig.xml'
@sandromello
sandromello / zimbra_prov_tools.py
Created September 23, 2014 13:46
Provisioning Zimbra
""" Provisioning functions Zimbra to Zimbra given ldap entries.
Requires: python-ldap
Author: Sandro Mello <[email protected]>
"""
import ldap, sys
import xml.etree.ElementTree as ET
import datetime
LOCALCONFIG = 'localconfig.xml'
@sandromello
sandromello / getInfo.php
Last active May 25, 2021 20:40
SOAP Requests Zimbra Example
function info_request_xml($token){
return <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
<context xmlns="urn:zimbra">
<userAgent name="ZimbraConnectorForOutlook" version="8.0.6.1063" />
<nonotify />
<noqualify />
<authToken>$token</authToken>
@sandromello
sandromello / vericlock.py
Last active August 29, 2015 14:14
Request to vericlock API
import requests, json, sys, hmac, hashlib
auth_uri = 'https://api.vericlock.com/1.0/auth'
public_key = 'mypublickey'
privateKey = 'myprivatekey'
# Convert to binary??
#privateKey = ''.join(format(ord(n),'b') for n in privateKey)
@sandromello
sandromello / sysnotify.py
Created March 2, 2015 18:36
Telegram - sysnotify
#!/usr/bin/env python
import pika, logging, socket, yaml, marshal
from time import sleep
ACCEPTED_KEYS = ['message', 'sla_service', 'site', 'host', 'service']
def send_telegram(data, config):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', 2391))
if data['sla_service']:
@sandromello
sandromello / token.py
Last active August 29, 2015 14:19
Get User Zimbra Token
import requests
soapEnvelope = """<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header>\
<context xmlns="urn:zimbra"><nosession/></context></soap:Header><soap:Body><AuthRequest xmlns="urn:zimbraAccount">\
<account by="name">%s</account><password>%s</password></AuthRequest></soap:Body>\
</soap:Envelope>""" % ('usuario@dominio', 'senha')
headers = {
'Content-Type' : 'text/soap+xml'
}
zimbraUrl = 'https://host_ssl/service/soap'