Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2016
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.96 KB | None | 0 0
  1.  
  2. Бан ботов
  3. /sbin/iptables -A INPUT -m string --algo kmp --string "BOTNAME" -p tcp --dport 80 -j DROP
  4. Удалить правило:
  5. /sbin/iptables -D INPUT -m string --algo kmp --string "BOTNAME" -p tcp --dport 80 -j DROP
  6. Если не работает переход по ссылкам https из панели, нужно проверить ssl на VPS и возможно сделать заглушку.
  7.  
  8. Подсчёт IP в запросах к nginx:
  9. cat /var/log/nginx/access.log | cut -f1 -d' ' | sort | uniq -c | sort -n | tac | head
  10.  
  11. Если сайт кидает 500 ошибку при правилах Rewrite, попробовать переключить режим работы PHP с CGI на Apache.
  12. Если после даунгрейда PHP не работает PHP как CGI, стоит удалить php.conf файл.
  13.  
  14. Автоматизация секурных обновлений:
  15. wget script.friendhosting.net/uppo.sh; bash uppo.sh; rm -f uppo.sh
  16.  
  17. If "iotop" shows that most resources are used by jbd2/md2-8 and not by mysql service,
  18. try to add:
  19. innodb_flush_method=O_DSYNC
  20. to my.cnf [mysqld] section and restart mysql service.
  21.  
  22. Очистка кэша и перезапуск панели испменеджер в случае кривого отобажения:
  23. /usr/local/ispmgr/sbin/pkgctl -D cache
  24. /usr/local/ispmgr/sbin/pkgctl -D -m ispmgr cache
  25. rm -rf /usr/local/ispmgr/var/.xmlcache
  26. killall -9 ispmgr
  27.  
  28. Запретить ООМ-киллеру убивать мускуль:
  29. pgrep -f $(which mysql) | while read PID; do echo -17 > /proc/$PID/oom_adj; done
  30. Таймауты nginx-а как прокси:
  31. server {
  32. ...
  33. proxy_connect_timeout 600;
  34. proxy_send_timeout 600;
  35. proxy_read_timeout 600;
  36. send_timeout 600;
  37. ...
  38. }
  39.  
  40. Cжатие:
  41. server {
  42. ....
  43. gzip on;
  44. gzip_disable "msie6";
  45. gzip_types image/svg+xml text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/png image/jpg image/jpeg;
  46. }
  47.  
  48.  
  49. Права на каталоги 755 и файлы 644:
  50. find dir/ -type d -exec chmod 755 {} \;
  51. find dir/ -type f -exec chmod 644 {} \;
  52.  
  53. Задампить все базы в разные файлы:
  54. for dbname in `echo show databases| mysql -u root -pvvAteWlBR8|egrep -v "Database|mysql|information_schema|performance_schema"`;
  55. do echo "Dump $dbname...";
  56. mysqldump -u root -pvvAteWlBR8 $dbname > "$dbname.sql";
  57. done
  58.  
  59.  
  60. Импорт всех .sql баз из каталога с попутным созданием баз:
  61. for file in `ls`; do dbname=`echo $file| sed 's/\.sql//g'`; echo "Creating database \`$dbname\`" ; mysql -u root -ppass -e "create database $dbname"; mysql -u root -ppass $dbname < $file; done
  62.  
  63. Удалённый дамп мускуля по ssh (выполнять на локальной машине, IP и пароль - удалённой):
  64. ssh -p 3333 -l root 217.12.221.15 "mysqldump -u root -pIHi2JRCGsy -A | gzip -3 -c" > allbases.sql.gz
  65.  
  66. Чтобы получить список всех www доменов из ISPManager, достаточно выполнить команду:
  67. /usr/local/ispmgr/sbin/mgrctl -m ispmgr wwwdomain | sed 's/=/ /' | awk '{print $2}' | sed "s/^/`ip a | grep inet | grep -v inet6| grep -v 127| tr -s ' ' | cut -f 3 -d ' ' | cut -f 1 -d'/'` /g"
  68.  
  69. Если на дебиане не работает ПМА с ошибкой типа не может загрузить мускульный модуль, чек:
  70. root@akigl148:/etc# grep -R "extension=mysql.so" *
  71. php5/mods-available/mysql.ini:extension=mysql.so
  72. php5/cgi/conf.d/20-mysql.ini:extension=mysql.so
  73. php5/apache2/conf.d/20-mysql.ini:extension=mysql.so
  74. php5/cli/conf.d/20-mysql.ini:extension=mysql.so
  75. php5/conf.d/20-mysql.ini:extension=mysql.so
  76.  
  77. Лечение кракозябликов:
  78. [mysqld]
  79. character-set-server=cp1251
  80. collation-server=cp1251_general_ci
  81. init-connect="SET NAMES cp1251"
  82. skip-character-set-client-handshake
  83. virtualhost: AddDefaultCharset UTF-8
  84. CP1251
  85.  
  86. Даунгрейд дебиан РНР до 5.3:
  87. deb http://ftp.debian.org/debian/ squeeze main contrib non-free
  88. deb http://security.debian.org/ squeeze/updates main contrib non-free
  89. apt-get update
  90. apt-cache showpkg php5
  91. видим что-то типа:
  92. Provides:
  93. 5.4.45-0+deb7u1 -
  94. 5.4.44-0+deb7u1 -
  95. 5.3.3-7+squeeze19 -
  96. Reverse Provides:
  97. VERSION="5.3.3-7+squeeze19" и погнали
  98. apt-get install --reinstall php5=$VERSION php5-cli=$VERSION php5-common=$VERSION php5-cgi=$VERSION libapache2-mod-php5=$VERSION php-pear=$VERSION php5-curl=$VERSION php5-gd=$VERSION php5-intl=$VERSION php5-mysql=$VERSION php5-pspell=$VERSION php5-recode=$VERSION php5-sqlite=$VERSION php5-tidy=$VERSION php5-xmlrpc=$VERSION php5-xsl=$VERSION php5-mcrypt=$VERSION
  99.  
  100. !Пустая админ-страница Вордпресса:
  101. There is a bug in WordPress 3.3.1 causing the issue. It may affect other versions as well.
  102. To solve the issue you can update WordPress to the current stable release and do integration testing afterwards.
  103. Or you can do a quick bug fix.
  104. To fix the bug:
  105. Open file blog/wp-admin/includes/screen.php in your favorite text editor.
  106. On line 706 find the following PHP statement: <?php echo self::$this->_help_sidebar; ?>
  107. Replace it with the statement: <?php echo $this->_help_sidebar; ?>
  108. Save your changes.
  109.  
  110. Тест работы SOCKS5 Proxy:
  111. curl --socks5-hostname usernik:BHCY7Um4@82.118.17.73:1111 binfalse.de -v
  112. https://friendhosting.net/admin_bar.php?do=fullinfo&id=6482 - у него есть работающие прокси на socks5
  113.  
  114. Конфиги весты и замена инклюдов (защита от брута) :
  115. sed -i -e s/nginx.*.conf/include.conf/g /home/admin/conf/web/nginx.conf
  116.  
  117. Выкл РНР варнинги и нотайсы в php.ini
  118. error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING
  119.  
  120. Бан IP:
  121. iptables -I INPUT -j DROP -s 127.0.0.1
  122. iptables -D INPUT -j DROP -s
  123. Бан порта:
  124. iptables -A INPUT -p tcp --destination-port {PORT-NUMBER-HERE} -j DROP
  125.  
  126. PHPinfo
  127. <?php
  128. phpinfo();
  129. ?>
  130.  
  131. Удаление BOM:
  132. sed -i '1 s/^\xef\xbb\xbf//' /home/admin/web/legendbatles.ru/public_html/index.php
  133.  
  134. Iptables ограничение адреса и порта:
  135. iptables -A INPUT -p tcp --dport 8000 -s 1.2.3.4 -j ACCEPT
  136. iptables -A INPUT -p tcp --dport 8000 -j DROP
  137.  
  138. ns1.frienddns.info
  139. ns2.frienddns.info
  140. ns3.frienddns.net
  141. ns4.frienddns.net
  142.  
  143. Подключения:
  144. netstat -anp | grep 80 | grep tcp | awk '{print $5}' | cut -d":" -f 1 | sort | uniq -c | sort -k1rn | head -n 30 | awk '{ print $1 "\t" $2 }'
  145.  
  146. !!!Не втыкать смотреть в .htaccess, когда проблема с обработкой файлов
  147.  
  148. Блокирование доступа к некоторому порту отовсюду, кроме:
  149. iptables -A INPUT -p tcp --dport 3306 ! -s 127.0.0.0/8 -j DROP
  150.  
  151.  
  152. Добавление доменов в ИСП из консоли:
  153. for i in `cat domains.txt`; do /usr/local/ispmgr/sbin/mgrctl -m ispmgr wwwdomain.edit domain=$i alias=www.$i docroot=auto owner=radioloc admin=admin@$i autosubdomain=asdnone ip=195.28.182.32 php=phpcgi sok=ok; done
  154. OK
  155. Создание базы данных в ИСП:
  156. /usr/local/ispmgr/sbin/mgrctl -m ispmgr db.edit name=radioloc_30secon dbtype=MySQL owner=radioloc dbencoding=default dbuser=newuser dbusername=radioloc_30secon dbpassword=radioloc_30secon dbconfirm=radioloc_30secon sok=ok
  157. ISPMGR 5 create user
  158. /usr/local/mgr5/sbin/mgrctl -m ispmgr user.edit name=testuser fullname=testuser passwd=9379995Aa confirm=9379995Aa preset=Full_default sok=ok
  159. ISPMGR 4 create user
  160. /usr/local/ispmgr/sbin/mgrctl -m ispmgr user.edit name=testuser passwd=123456 confirm=123456 phpcgi=on disklimit=0 sok=ok
  161. Либо
  162. /usr/local/ispmgr/sbin/mgrctl -m ispmgr user.edit name=testuser passwd=123456 confirm=123456 phpcgi=on preset=custom disklimit=0 ftplimit=10 sok=ok
  163. Либо
  164. /usr/local/ispmgr/sbin/mgrctl -m ispmgr user.edit name=testuser passwd=123456 confirm=123456 phpcgi=on preset=default sok=ok
  165. (с соответствующим шаблоном)
  166. Удалить домен с сохранением файлов ISP 4:
  167. /usr/local/ispmgr/sbin/mgrctl -m ispmgr wwwdomain.delete elid=sssuppertest.alex.ru wwwdomain.delete.confirm elid=sssuppertest.alex.ru docroot=on sok=ok
  168. Нет места у АПАЧА:
  169. http://wiki.iphoster.ru/wiki/CentOS_-_apache:_%2828%29No_space_left_on_device:_Couldn't_create_accept_lock_%28/etc/httpd/logs/accept.lock%29_%285%29
  170.  
  171. nginx header too big:
  172. http {
  173. proxy_buffer_size 128k;
  174. proxy_buffers 4 256k;
  175. proxy_busy_buffers_size 256k;
  176. }
  177.  
  178. Получить айпи: ip a|egrep inet|egrep -v "inet6|host"|gawk -F ' ' {'print $2'}|sed 's/\/24//'
  179.  
  180. Конвертирование в MyISAM
  181.  
  182. TABLES=$(mysql -pXXXXXXX -uXXXXXXX --skip-column-names -B -D $DB -e 'show tables')
  183. for T in $TABLES
  184. do
  185. mysql -pXXXXX -uXXXXX -D $DB -e "ALTER TABLE $T ENGINE=MYISAM"
  186. done
  187.  
  188. Глюк с ПМА и SSL(в /etc/phpmyadmin):
  189. $cfg['PmaAbsoluteUri'] = 'http://'.$_SERVER["HTTP_HOST"].':81/myadmin/';
  190.  
  191. Option InsecureDomain в /usr/local/ispmgr/etc/ispmgr.conf и перезапустите ISPmanager
  192.  
  193. wget -O nginx_bot_autoban.sh http://195.28.182.231/nginx_bot_autoban.sh; bash nginx_bot_autoban.sh; rm -rf nginx_bot_autoban.sh
  194.  
  195. Блокирование реферов:
  196. if ( $http_referer ~* (kyamoviehai.com|rainforestbands.com|dogshowsonice.com|racebandrange.com|topworkhandsandlegs.com) ){
  197. return 403;
  198. }
  199.  
  200. # gunzip /usr/share/doc/phpmyadmin/examples/create_tables.sql.gz
  201. # mysql -u root -h localhost -p
  202. Enter password:
  203. mysql> source /usr/share/doc/phpmyadmin/examples/create_tables.sqlJudnYGYJh9
  204. Query OK, 1 row affected (0.00 sec)
  205. ...
  206. mysql> quit
  207. Bye
  208. И перезайти в phpmyadmin.
  209.  
  210. Список ботов:
  211. Plukkie|GetintentCrawler|GrapeshotCrawler|XoviBot|Mail.RU_Bot|WebArtexBot|DeuSu|HaosouSpider|TOBBOT|uMBot-LN|Yahoo!|BuzzSumo|Sogou web spider|MegaIndex|bingbot|AddThis.com|BLEXBot|BuddhaBot|Ezooms|
  212. AhrefsBot|Baiduspider|PaperLiBot|Twitterbot|QuerySeekerSpider|meanpathbot|SemrushBot|SolomonoBot|Butterfly|UnwindFetchor|rogerbot|NING|
  213. TweetmemeBot|SeznamBot|coccoc|Yeti|Moreover|TurnitinBot|METASpider|
  214. Nekstbot|SputnikBot|Nigma.ru|DotBot|MJ12bot|Netcraft|OpenLinkProfiler|
  215. WebFilter|NjuiceBot|Gigabot|JS-Kit|Voyager|PostRank|Aport|ia_archiver|DotBot|SurveyBot|larbin|
  216. Butterfly|LinkExchanger|Soup|spbot|MLBot|InternetSeer|FairShare|
  217. Birubot|YottosBot|gold crawler|Linguee|Ezooms|lwp-trivial|Purebot|kmSearchBot|SiteBot|CamontSpider|
  218. ptd-crawler|HTTrack|suggybot|ttCrawler|Nutch|Zeus
  219.  
  220. Отломанная таблица просмотров DLE:
  221. DROP TABLE IF EXISTS `dle_views`;
  222. CREATE TABLE `dle_views` (
  223. `id` mediumint(8) NOT NULL AUTO_INCREMENT,
  224. `news_id` int(11) NOT NULL DEFAULT '0',
  225. PRIMARY KEY (`id`)
  226. ) ENGINE=MyISAM AUTO_INCREMENT=1/*!40101 DEFAULT CHARSET=cp1251 */;
  227.  
  228. DROP TABLE IF EXISTS `dle_login_log`;
  229. CREATE TABLE `dle_login_log` (
  230. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  231. `ip` varchar(16) NOT NULL DEFAULT '',
  232. `count` smallint(6) NOT NULL DEFAULT '0',
  233. `date` int(11) unsigned NOT NULL DEFAULT '0',
  234. PRIMARY KEY (`id`),
  235. UNIQUE KEY `ip` (`ip`),
  236. KEY `date` (`date`)
  237. ) ENGINE=MyISAM AUTO_INCREMENT=1/*!40101 DEFAULT CHARSET=cp1251 */;
  238.  
  239.  
  240. -j, --file=FILE Full path to single file to check^M
  241. -l, --list=FILE Full path to create plain text file with a list of found malware^M
  242. -p, --path=PATH Directory path to scan, by default the file directory is used^M
  243. Current path: {$defaults['path']}^M
  244. -m, --memory=SIZE Maximum amount of memory a script may consume. Current value: $memory_limit^M
  245. Can take shorthand byte values (1M, 1G...)^M
  246. -s, --size=SIZE Scan files are smaller than SIZE. 0 - All files. Current value: {$defaults['max_size_to_scan']}^M
  247. -a, --all Scan all files (by default scan. js,. php,. html,. htaccess)^M
  248. -d, --delay=INT delay in milliseconds when scanning files to reduce load on the file system (Default: 1)^M
  249. -e, --cms=FILE cms filename to load .aknown files from. E.g. --cms=wordpress^M
  250. -x, --mode=INT Set scan mode. 0 - for basic, 1 - for expert and 2 for paranoic.^M
  251. -k, --skip=jpg,... Skip specific extensions. E.g. --skip=jpg,gif,png,xls,pdf^M
  252. -r, --report=PATH/EMAILS^M
  253. Full path to create report or email address to send report to.^M
  254. You can also specify multiple email separated by commas.^M
  255. -q, Use only with -j. Quiet result check of file, 1=Infected ^M
  256. --cmd="command [args...]"^M
  257. Run command after scanning^M
  258. --one-pass Do not calculate remaining time^M
  259. --quarantine Archive all malware from report^M
  260. --with-2check Create or use AI-BOLIT-DOUBLECHECK.php file^M
  261. --imake^M
  262. -rwsr-xr-x - /usr/sbin/exim
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement