This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: UTF-8 -*- | |
#CSV | |
#モジュールをインポート | |
#デミリッタを使用してawkのような処理を行う事が可能 | |
import csv | |
#標準出力に出力したいのでsysをインポート | |
import sys | |
#ファイルの存在確認をしたいのでosをインポート |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#-------------------------------------------------------------------- | |
#リアルタイムアクセス拒否β(Apacheログ専用)あ | |
# | |
#処理概要: | |
# ①Apacheのログファイルを(ほぼ)リアルタイムで監視して、拒否したいアクセスをしてきたIPアドレスを | |
# 「iptables」に登録して、全ての通信を拒否する。 | |
# ②アクセス拒否IPを累積する | |
# ③アクセス拒否IP登録メールをroot宛に送信する | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#-------------------------------------------------------------------- | |
#iptables-setup3 | |
# ファイアウォール初期設定スクリプト | |
# アクセス拒否IPアドレスの登録を行う | |
#---------------------------------------- | |
# 初期設定 | |
#---------------------------------------- | |
#アクセス拒否IP累積リスト | |
denyIpFile=/var/log/apache2/denyIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep 'Invalid user' /var/log/auth.log|awk 'BEGIN{FS=":"}{print $4}'|awk 'BEGIN{FS=" "}{print $5}'|sort|uniq|xargs -I{} whois {}|grep -i country|sed 's/ //g'|sort|uniq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "oom-killの発生時間をkern.logから検出します" | |
#[kern.logから「oom-kill」を探してその発生日時(Jan 1 01:05:01)をApacheのログファイルの日時(01/Jan/2012:01:04:55)に整形する] | |
export LOGyyyy=`date +%Y` | |
grep -h oom-kill /var/log/kern.log|awk 'begin{FS=" "}{printf ("%02d/%s/%s:%s\n",$2,$1,ENVIRON["LOGyyyy"],$3)}end{}'|sort | |
#結果フォーマット(Apacheのログファイル形式) | |
#01/Jan/2012:01:05:01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#--------------------------- | |
#denyhosts Unlock | |
# | |
# perm1:IP-Address | |
# | |
# Brokendish | |
#--------------------------- | |
# | |
echo '***************************************************' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#--------------------------------------------------------- | |
# バックアップシェル | |
# | |
# perm1:格納先ディレクトリ | |
# ex) | |
# 第1周目なら /home/bkup/week-1 | |
# 第2周目なら /home/bkup/week-2 | |
# 第3周目なら /home/bkup/week-3 | |
# 第4周目なら /home/bkup/week-4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
定期的に行っているシステムのバックアップを見直す。 | |
/(ルート)以下を全てファイルにまとめる(バックアップ) | |
対象外指定は以下のようにしている | |
–exclude /dev | |
–exclude /etc/network | |
–exclude networks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
※ローカルからサーバ側にファイルを送る | |
rsync -avz -e 'ssh -p xx -i /home/hoge/.ssh/hoge.com-rsa' /home/hoge hoge.com:/home/hoge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vi all-sys-bkup.sh | |
#!/bin/sh | |
tar czvplf /hoge/bkup/vpsBKUP.tar.gz --exclude hoge/bkup/vpsBKUP.tar.gz --exclude /dev --exclude /etc/network --exclude networks --exclude hosts --exclude /boot --exclude /home/swap --exclude /hoge/bkup --exclude /proc --exclude /sys --exclude /var/run --exclude /var/lock --exclude fstab / >bkup.lst |
OlderNewer