#!/usr/bin/python
# 'apt-get install python-geoip' if needed
import GeoIP,os
stream = os.popen("netstat -tna | awk -F' +|:' '/:80/ {print $6}' | sort | uniq -c | sort -n ")
gi = GeoIP.new(GeoIP.GEOIP_MEMORY_CACHE)
s=0
for line in stream.readlines():
line = line.strip()
l =line.split() # strip the last from the line
# print l
print l[0], "\t",l[1],"\t", gi.country_code_by_addr(l[1])
s+=int(l[0])
print 'Total:',s
понедельник, 10 марта 2014 г.
Кол-во активных подключений к серверу с определением региона (GeoIP)
пятница, 6 декабря 2013 г.
Печать буклета на принтер без двухсторонней печати
psnup -c -4 original.ps | psbook | psnup -l -pa4 -b27 -m10 -d -2 > out.ps
понедельник, 5 ноября 2012 г.
vzlist
vzlist -o laverage,hostname,ctid
vztop.sh
#! /bin/bash
# Usage: ovzps <CTID> [ps flags ...]
ctid=${1:-0}
shift
ps $* -p $(grep -l "^envID:[[:space:]]*$ctid\$" /proc/[0-9]*/status |
sed -e 's=/proc/\([0-9]*\)/.*=\1=')
vztop.sh
#! /bin/bash
# Usage: ovzps <CTID> [ps flags ...]
ctid=${1:-0}
shift
ps $* -p $(grep -l "^envID:[[:space:]]*$ctid\$" /proc/[0-9]*/status |
sed -e 's=/proc/\([0-9]*\)/.*=\1=')
воскресенье, 21 октября 2012 г.
Error SSH: Read from socket failed: Connection reset by peer
Проблема в новом клиенте SSH (OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011)
при коннекте получаю:
Read from socket failed: Connection reset by peer
Ошибка чиниться добавлением параметра при подключении
ssh root@host -c aes256-ctr
или в /etc/ssh/ssh_config
Host *
Ciphers 3des-cbc
или же
Ciphers aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
Источник: https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/708493
при коннекте получаю:
Read from socket failed: Connection reset by peer
Ошибка чиниться добавлением параметра при подключении
ssh root@host -c aes256-ctr
или в /etc/ssh/ssh_config
Host *
Ciphers 3des-cbc
или же
Ciphers aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
Источник: https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/708493
пятница, 11 мая 2012 г.
понедельник, 9 апреля 2012 г.
php disable_functions
disable_functions = "apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd, eval, exec, fp, fput, ftp_connect, ftp_exec, ftp_get, ftp_login, ftp_nb_fput, ftp_put, ftp_raw, ftp_rawlist, highlight_file, ini_alter, ini_get_all, ini_restore, inject_code, openlog, passthru, php_uname, phpAds_remoteInfo, phpAds_XmlRpc, phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_setuid, posix_uname, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode,mail"or
disable_functions= "exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source "for VirtualMin
#!/bin/bash
cd /home
for i in `ls`; do
dir=/home/$i/etc/php5
if [ -d $dir ]; then
cd $dir
lsattr php.ini
chattr -i php.ini
sed -i.bak -e "s@\W*open_basedir\s*=.*@open_basedir = /home/$i@" \
-e 's@\W*disable_functions\s*=.*@disable_functions = "apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd, eval, exec, fp, fput, ftp_connect, ftp_exec, ftp_get, ftp_login, ftp_nb_fput, ftp_put, ftp_raw, ftp_rawlist, highlight_file, ini_alter, ini_get_all, ini_restore, inject_code, openlog, passthru, php_uname, phpAds_remoteInfo, phpAds_XmlRpc, phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_setuid, posix_uname, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode,mail"@' php.ini
chattr +i php.ini
else
echo $i empty
fi;
done
суббота, 31 марта 2012 г.
openmeetings over proxy
Relevant section of openmeetings virtual host:
<VirtualHost *:80>
ServerAdmin developer@xxxxxxxxxxxx
ServerName openmeetings.mydomain.com
ProxyPass / http://openmeetings.mydomain.com:5080/
ProxyPassReverse / http://openmeetings.mydomain.com:5080/
...
</VirtualHost>
Relevant section of openmeetings-rtmpt virtual host:
<VirtualHost *:80>
ServerAdmin developer@xxxxxxxxxxxx
ServerName rtmpt.mydomain.com
ProxyPass /openmeetings http://openmeetings.mydomain.com:5080/openmeetings
ProxyPassReverse /openmeetings http://openmeetings.mydomain.com:5080/openmeetings
ProxyPass / http://openmeetings.mydomain.com:8088/
ProxyPassReverse / http://openmeetings.mydomain.com:8088/
...
</VirtualHost>
OpenMeetings config:
red5/webapps/openmeetings/config.xml:
<rtmphostlocal>rtmpt.mydomain.com</rtmphostlocal>
<rtmpTunnelport>80</rtmpTunnelport>
<red5httpport>80</red5httpport>
--
<VirtualHost *:80>
ServerAdmin developer@xxxxxxxxxxxx
ServerName openmeetings.mydomain.com
ProxyPass / http://openmeetings.mydomain.com:5080/
ProxyPassReverse / http://openmeetings.mydomain.com:5080/
...
</VirtualHost>
Relevant section of openmeetings-rtmpt virtual host:
<VirtualHost *:80>
ServerAdmin developer@xxxxxxxxxxxx
ServerName rtmpt.mydomain.com
ProxyPass /openmeetings http://openmeetings.mydomain.com:5080/openmeetings
ProxyPassReverse /openmeetings http://openmeetings.mydomain.com:5080/openmeetings
ProxyPass / http://openmeetings.mydomain.com:8088/
ProxyPassReverse / http://openmeetings.mydomain.com:8088/
...
</VirtualHost>
OpenMeetings config:
red5/webapps/openmeetings/config.xml:
<rtmphostlocal>rtmpt.mydomain.com</rtmphostlocal>
<rtmpTunnelport>80</rtmpTunnelport>
<red5httpport>80</red5httpport>
--
Подписаться на:
Сообщения (Atom)