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
#書式 | |
#<分> <時> <日> <月> <曜日> <コマンド> | |
#<分> 0~59までの整数 | |
#<時> 0~23までの整数 | |
#<日> 1~31までの整数 | |
#<月> 1~12までの整数 | |
#<曜日> 0~7までの整数 (0,7 : 日曜~6:土曜日) | |
#<コマンド> 実行するコマンド,シェルスクリプトなど。 | |
#-------------------------------------------------------- | |
#(日次例) 23時45分に毎日実行 |
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でローカル(Ubuntu)からVPSのデータを取得※バックアップデータ | |
rsync -avz -e 'ssh -p xx -i /home/hoge/.ssh/hoge.com-rsa' hoge.com:/home/hoge /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
※ローカルからサーバ側にファイルを送る | |
rsync -avz -e 'ssh -p xx -i /home/hoge/.ssh/hoge.com-rsa' /home/hoge hoge.com:/home/hoge |
OlderNewer