Skip to content

Instantly share code, notes, and snippets.

View miticojo's full-sized avatar

Giorgio Crivellari miticojo

View GitHub Profile
@miticojo
miticojo / vsftpd.conf
Created June 3, 2016 10:11
VSFTPD 2.2 - CENTOS/RHEL - working configuration - local user, no passive, no anonymous
anonymous_enable=NO
anon_upload_enable=NO
anon_mkdir_write_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
@miticojo
miticojo / cmdvip.py
Created June 12, 2016 07:20
Execute passed command if IP present on machine (cluster util)
#!/usr/bin/env python
__author__ = 'Giorgio Crivellari'
__version__ = "0.1"
import os
import sys
import re
import subprocess
import socket
from subprocess import call
@miticojo
miticojo / check-mount.py
Created June 12, 2016 07:24
Check if drive is still mounted on a linux system and send notification through Slack
#!/usr/bin/python
__author__ = 'Giorgio Crivellari'
__version__ = "0.1"
import os
import sys
import socket
import urllib2
def check_mount(mountpoint):
@miticojo
miticojo / convert_ova.sh
Last active June 16, 2016 05:37
This script convert VMX+VMDK native machine to OVA file
#!/bin/bash
## Author: Giorgio Crivellari <miticojo>
## Description: This script convert VMX+VMDK native machine to OVA file
## Date: April 1, 2016
## More info about OVFTOOL: https://www.vmware.com/support/developer/ovf/ovf410/ovftool-410_userguide.pdf
VMNAME=$1
BASEDIR=/data
@miticojo
miticojo / gist:629346961671481c7ff0cf2228cc3153
Created June 16, 2016 09:26
IPA SERVER TCP/UDP PORT FOR REPLICA
Check connection from replica to remote master 'XXXX':
Directory Service: Unsecure port (389): OK
Directory Service: Secure port (636): OK
Kerberos KDC: TCP (88): OK
Kerberos Kpasswd: TCP (464): OK
HTTP Server: Unsecure port (80): OK
HTTP Server: Secure port (443): OK
PKI-CA: Directory Service port (7389): OK
The following list of ports use UDP protocol and would need to be
@miticojo
miticojo / ftp.sh
Created June 17, 2016 10:41
profile functions for ftp user administration (/etc/profile.d/)
add_ftp_user(){
ftpuser=$1;
ftpfolder="/fsdata/ftp/$ftpuser"
if [ -z "$ftpuser" ]; then echo "missing user parameter" && return 1; fi
adduser -G ftp -s /sbin/nologin $ftpuser;
mkdir $ftpfolder;
chown $ftpuser:root $ftpfolder;
chmod 760 $ftpfolder;
echo "plese provide password for new ftp user:"
read -s user_pass
@miticojo
miticojo / init.template.sh
Created June 17, 2016 15:28
init script template for centos 6.x
#!/bin/bash
# myapp daemon
# chkconfig: 345 20 80
# description: myapp daemon
# processname: myapp
DAEMON_PATH="/home/wes/Development/projects/myapp"
DAEMON=myapp
DAEMONOPTS="-my opts"
@miticojo
miticojo / my.cnf
Created June 19, 2016 07:40
nano mysqld configuration
# /etc/my.cnf:
innodb_buffer_pool_size=5M
innodb_log_buffer_size=256K
query_cache_size=0
max_connections=10
key_buffer_size=8
thread_cache_size=0
host_cache_size=0
innodb_ft_cache_size=1600000
innodb_ft_total_cache_size=32000000
@miticojo
miticojo / ipa_massive_changepwd.sh
Last active June 22, 2016 22:15
change all user password with a random 8 chars string and print in csv format
#!/bin/bash
random-string()
{
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1
}
for u in $(ipa user-find --sizelimit 200 --pkey-only "." | grep ":" | awk '{print $3}'); do
psw=$(random-string 8)
echo $psw | ipa user-mod $u --password > /dev/null 2>&1
@miticojo
miticojo / ipa_mail_passexpiration.sh
Created June 23, 2016 05:41
send email for password expiration
#!/bin/bash
# Source: http://vmhacks.com/freeipa-password-expiry-notification-script-for-red-hat-identity-management/
# notifies people a set number of days before expiry, once via email
# open a kerberos ticket using keytab authentication
# the following keytab file was made using ktutil with rc4-hmac
/usr/bin/kinit admin@YOURDOMAIN.COM -k -t /sextoys/admin.keytab