Archive for the ‘Freebsd’ Category

Virtualmin mass disable-feature

DOMAINS=” domain1 domain2 domain3″

for i in ${DOMAINS}

do

virtualmin disable-feature –domain $i –webalizer

done

(more…)

Happy Sysadmin Day !

SnamTrap and Zabbix

Centos 6

  • edit /etc/snmp/snmptrapd.conf

disableAuthorization yes

traphandle default /usr/sbin/snmptt

snmpTrapdAddr udp:10.100.0.2:162

doNotLogTraps yes

  • /etc/snmp/snmptt.ini

snmptt_conf_files = <<END
/etc/snmp/snmptt.conf
END

  • Add MIB in /etc/snmp/snmptt.conf

EVENT linkDown .1.3.6.1.6.3.1.1.5.3 “Status Events” Normal
FORMAT ZBXTRAP $aA Link down on interface $1. Admin state: $2. Operational state: $4
EXEC /usr/lib/zabbix/externalscripts/zabbix_trapper.sh $aA $1 $4

EVENT linkUp .1.3.6.1.6.3.1.1.5.4 “Status Events” Normal
FORMAT ZBXTRAP $aA Link up on interface $1. Admin state: $2. Operational state: $4
EXEC /usr/lib/zabbix/externalscripts/zabbix_trapper.sh $aA $1 $4

(more…)

FreeBSD run problem after upgrade

FreeBSD upgrade from 7.4->8.1 or 8.1->8.2
Freebds freeze on boot.

Boot on single user mode and ADD to /boot/device.hints

hint.usb.0.disabled=”1″
hint.ohci.0.disabled=”1″
hint.ata.0.disabled=”1″
hint.ata.1.disabled=”1″

FFserver, which has been removed :(

APIchanges: FFserver, which has been removed from FFmpeg 🙁

Log:
multimedia/ffmpeg: update to 4.0

– FFSERVER support was removed upstream
– libressl now uses libtls backend instead of patching openssl one
(more…)

fail2ban openfire

#vim filter.d/openfire.conf

[INCLUDES]
before = common.conf

[Definition]

failregex = ^ WARN.*org.jivesoftware.admin.LoginLimitManager – Failed admin console login attempt by admin from $

ignoreregex =

[Init]
datepattern = ^%%Y.%%m.%%d %%H:%%M:%%S

vim jail.conf

[openfire]
enabled = true
filter = openfire
action = iptables-allports[]
logpath = /opt/openfire/logs/all.log

Upgrade php5-5.4 to php56

#portmaster -o lang/php56 php5-5.4.35
#portmaster -y -D -o devel/oniguruma5 oniguruma4

#pkg info | grep php | grep 5.4 | awk ‘{print $1}’ |awk -F ‘-5.4’ ‘{print “whereis “$1}’ |sh |awk -F ‘: /usr/ports/’ ‘{print “portmaster -y -D -o “$2” “$1}’ | sed -e “s@/php5-@/php56-@” -e ‘s@$@-5.4.35@’ | sh
(more…)

Find

Шукаємо старі директорії і архівуємо.

find ./ -name . -prune -o -type d -mtime +90  -exec tar czvpf {}.tgz ./{} \;  -exec rm -rf {}  \;

mass find and replace

find / -name php.ini | xargs sed -i 's/expose_php = On/expose_php = Off/g'
find / -name php.ini | xargs perl -pi -e 's/expose_php = On/expose_php = Off/i'

shell compare string

Потрібно було знайти присутність/входження строки в іншій, в шелл скрипті. …


#!/bin/sh
aa="String_String_String"
bb=$(echo ${aa} | grep -i "String")

if [ ${#bb} -gt 0 ];
then
echo "Exists"
else
echo "Not exists"
fi