Skip to content

Instantly share code, notes, and snippets.

@cerealskill
cerealskill / execute_procedure_azure.ps1
Last active December 26, 2017 19:22
PowerShell Execute Procedure on webjobs in WebApps (Azure)
Write-Output "JOB START"
# Create connection to Master DB
$MasterDatabaseConnection = New-Object System.Data.SqlClient.SqlConnection
$MasterDatabaseConnection.ConnectionString = "Data Source=_DBNAME_.database.windows.net;Initial Catalog=_DBCATALOG_;Integrated Security=False;User ID=_USERDB_;Password=_PASSDB_;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False"
$MasterDatabaseConnection.Open()
Write-Output "CONNECTION OPEN"
# Create command
$MasterDatabaseCommand = New-Object System.Data.SqlClient.SqlCommand
@cerealskill
cerealskill / maillog.cf
Created November 10, 2017 13:48
Postfix Stop Send SPAM MAIL-DAEMON
## This is the mail-log with the activities from=<> (SPAM) to relay
Nov 9 10:22:34 lonquen postfix/cleanup[22653]: 7690E9FE0D: message-id=<20171109132234.7690E9FE0D@mx.mailserver.cl>
Nov 9 10:22:34 lonquen postfix/qmgr[12006]: 7690E9FE0D: from=<>, size=9957, nrcpt=1 (queue active)
Nov 9 10:22:34 lonquen postfix/bounce[22665]: 391CC9FE10: sender non-delivery notification: 7690E9FE0D
Nov 9 10:22:34 lonquen postfix/qmgr[12006]: 391CC9FE10: removed
Nov 9 10:22:42 lonquen postfix/cleanup[22653]: D2E5B9FE0A: message-id=<20171109132242.D2E5B9FE0A@mx.mailserver.cl>
Nov 9 10:22:42 lonquen postfix/qmgr[12006]: D2E5B9FE0A: from=<>, size=9509, nrcpt=1 (queue active)
Nov 9 10:22:42 lonquen postfix/bounce[22665]: 8D1199FE0E: sender non-delivery notification: D2E5B9FE0A
Nov 9 10:22:42 lonquen postfix/qmgr[12006]: 8D1199FE0E: removed
@cerealskill
cerealskill / crear_mail_user_postfix_dovecot.sh
Created September 11, 2017 15:20
Script Create Mail User for Postfix and Dovecot
#!/bin/bash
# @lolmos - SEP-17.
# POSTFIX with Dovecot.
# Script para crear cuenta de correo POP3 o IMAP
# Primero ejecutar: doveadm pw
# doveadm pw -p $2
# $1 -> usuario, $2 -> dominio, $3 -> Contraseña
#MOREF='sudo run command against $VAR1 | grep name | cut -c7-'
@cerealskill
cerealskill / pflogsumm_install.sh
Last active December 6, 2024 17:41
pflogsumm - Postfix Report Tools
### PFLOGSUMM - Postfix report ################
# pflogsumm.pl is designed to provide an over-view of postfix activity, with just enough detail to give the administrator
# a "heads up" for potential trouble spots.
# The following is an over-view of the reports produced:
sudo yum install perl-Date-Calc
cd /usr/local/
sudo curl -O http://jimsun.linxnet.com/downloads/pflogsumm-1.1.3.tar.gz
sudo tar -xzf pflogsumm-1.1.3.tar.gz
sudo mv pflogsumm-1.1.3 pflogsumm
sudo chmod +x pflogsumm/pflogsumm.pl
@cerealskill
cerealskill / htop_make_install.sh
Last active October 18, 2017 14:51
AutoScript to install htop (tools monitoring) para CentOS 6.x or CentOS 7.4.1708
# @olmosleo
# Leonardo Olmos F.
# 30-AGO-17
# HTOP compilacion on CentOS 6.x & CentOS 7.x
# AUTO-INSTALL htop tools:
# (Run on root)
#
# git clone https://gist.github.com/bcef33702a4ed858ed38a55a28cd232d.git && cd bcef33702a4ed858ed38a55a28cd232d/ && chmod 755 htop_make_install.sh && ./htop_make_install.sh
#
@cerealskill
cerealskill / Instalacion_Postfix_Dovecot.sh
Created August 30, 2017 13:33
Configuración Servidor Correo Postfix DOVECOT (Virtual Domain, Aliases, Users)
## INSTALACION POSTFIX CON DOVECOT
## POSTFIX - MULTIPLES DOMINIOS & USUARIOS
## if ! type -path "dig" > /dev/null 2>&1; then yum install bind-utils -y; fi
# Grupo de usuarios virtuales
groupadd vmail -g 2222
# Agregamos el usuario (vmail) con el ID 2222 al sistema
useradd vmail -r -g 2222 -u 2222 -d /var/vmail -m -c "mail user"
## INSTALL POSTFIX
@cerealskill
cerealskill / spamassasin_config_start.sh
Last active August 30, 2017 20:29
Configuracion Inicial para instalar SPAMASSASSIN en CentOS 6
yum install spamassassin
groupadd spamfilter
useradd -g spamfilter -s /bin/false -d /usr/local/spamassassin spamfilter
chown spamfilter: /usr/local/spamassassin
## vim /etc/mail/spamassassin/local.cf
## Required_hits: This determines the filter balance; the lower the score the more aggressive the filter.
# A setting of 5.0 is generally effective for a small organisation or a single user.
# Adjust the strictness score to your organization's needs - a large medical organisation might want to let email items
@cerealskill
cerealskill / AZURE_TIMEZONE_CHANGE.conf
Last active August 11, 2017 16:18
Azure WebApps Timezone Change
# (UTC-04:00) Santiago ( Horario de Invierno )
WEBSITE_TIME_ZONE = 'Pacific SA Standard Time'
############ WEBSITE_TIME_ZONE = 'Venezuela Standard Time'
# (UTC-03:00) Santiago ( Agosto 12 - Horario de verano )
WEBSITE_TIME_ZONE = 'Argentina Standard Time'
@cerealskill
cerealskill / zabbix_sendmail.sh
Last active June 13, 2017 20:51
Zabbix Mail Notification - Another way to generate alert with you external mailserver
#!/bin/bash
# Tested on Zabbix 3.2.5 (CentOS 6.9 Final)
# first you need install ssmtp and mailx
# sudo yum install ssmtp mailx
# add this script on /usr/lib/zabbix/alertscripts/zabbix-sendmail
# In zabbix you can use {ALERT.SENDTO}, {ALERT.SUBJECT}, {ALERT.MESSAGE} to link the parameters.
to=$1
subject=$2
body=$3
@cerealskill
cerealskill / crear_usuario_sftp.sh
Created June 7, 2017 21:29
Script para crear usuario sftp (CHROOT) - Tested on Centos 6.X
#!/bin/bash
echo "1/5 - Creando jaula del directorio para la cuenta sFTP " $1;
mkdir /srv/ftp/$1
mkdir /srv/ftp/$1/dt/
chgrp ftp -R /srv/ftp/$1/dt/
chmod g+w -R /srv/ftp/$1/dt/