Archive for the ‘*NIX’ Category

centos virualmin nginx php-fpm

cd /opt
git clone https://github.com/Real-Gecko/virtualmin-nginx-fpm.git
tar -zcf virtualmin-nginx-fpm.tar.gz virtualmin-nginx-fpm

Webmin menu >> Mebmin module >> Install Module >> From local file >> enter /opt/virtualmin-nginx-fpm.tar.gz >> click ‘Install Module’.

ERROR 1577 (HY000): Cannot proceed because system tables used by Event Scheduler were found damaged at server start


#mysql_upgrade -u [username] -p
#mysqlcheck -u [username] -p --all-databases --check-upgrade --auto-repair
#systemctl restart mysqld

mysql> show events;
Empty set (0.00 sec)

Replase date format in file name

Mass replase date format in filename
Example:

From filename_012017.txt to filename_12017.txt

ls | sed -e 'h;s/_0/_/;x;G;s/^\(.*\)\n\(.*\)$/\ln -s \1 \2/' | sh

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

Порівняння файлів

Інколи потрібно порівняти списки в фйлах.

cat ip.block | grep -v –file /home/bagas/ip1.block

Install MongoDB

#vi /etc/yum.repos.d/mongodb-org-3.4.repo

[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc

#yum install -y mongodb-org

#yum install php-devel php-pecl-mongo php-pecl-mongodb –enablerepo=remi

#find / -name php.ini -type f -exec sh -c “echo extension=mongo.so >> {}” \;

#mongo –port 27017

use admin
db.createUser( { user: “root”, pwd: “passwd”, roles: [ “userAdminAnyDatabase”, “dbAdminAnyDatabase”, “readWriteAnyDatabase” ] } )

(more…)

Встановлення MySQL 5.5 на RHEL / CentOS 6 или 5

Для CentOS / RHEL 5 32-64 бит

#rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

Для CentOS / RHEL 6 32-64 бит

#rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

#rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Для CentOS / RHEL 7 32-64 бит

#wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
#rpm -Uvh remi-release-7.rpm

#yum update
#yum –enablerepo=remi install mysql mysql-server

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…)

Sendmail on lo0

#vim freebsd.submit.mc
FEATURE(`msp’, `[127.0.0.4]’)dnl

#vim freebsd.mc
DAEMON_OPTIONS(`Name=MTA, Addr=127.0.0.4, Port=smtp, Modifiers=bh’)

#vim otrs.united.net.ua.mc
MASQUERADE_AS(`domain’)
MASQUERADE_DOMAIN(domain)
FEATURE(masquerade_envelope)
FEATURE(masquerade_entire_domain)
define(`SMART_HOST’, `smtp.domain’)dnl
DAEMON_OPTIONS(`Name=MTA, Addr=127.0.0.4, Port=smtp, Modifiers=bh’)

Finding spam sending PHP scripts on your server

#php.ini


mail.add_x_header = On
mail.log = /var/log/phpmail.log

#find / -name php.ini | xargs perl -pi -e ‘s/\;mail\.log =/mail\.log = \/var\/log\/phpmail.log/i’