knife configure client /path/to/tempdir できたファイルをnodeに置く /etc/chef/client.rb /etc/chef/validation.pem で↓のコマンドでOK chef-client参考リンク
http://hivecolor.com/id/46
knife configure client /path/to/tempdir できたファイルをnodeに置く /etc/chef/client.rb /etc/chef/validation.pem で↓のコマンドでOK chef-client参考リンク
8000C 284871170 10382
file sp-sc-auth readelf -h sp-sc-authみたいにするとELF32の実行ファイルだとわかる
dpkg --add-architecture i386 apt-get install ia32-libs-i386
./sp-sc-auth sop://broker.sopcast.com:3912/6001 3908 8908
Option Explicit | |
'shellオブジェクト | |
Dim objWshShell | |
Set objWshShell = WScript.CreateObject("WScript.Shell") | |
'カレントディレクトリ変更 | |
Dim objNetWork | |
Set objNetWork = WScript.CreateObject("WScript.Network") | |
Dim CYGHOME | |
CYGHOME="C:\cygwin\home\" & objNetWork.UserName | |
objWshShell.CurrentDirectory = CYGHOME | |
'ダウンロードパスの入力 | |
Dim dir | |
dir = InputBox("ダウンロードするファイルのパスを入力してください") | |
If dir = "" Then | |
WScript.Echo "ファイルパスを入力してください" | |
WScript.Quit() | |
End If | |
'入力されたパスを/home/[USER]/targetdir.txtへ書き込み | |
Dim objFSO,objOutput | |
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") | |
Const ForReading = 1, ForWriting = 2, ForAppending = 8 | |
Set objOutput = objFSO.OpenTextFile("targetdir.txt", ForWriting, True) | |
dir = Replace(dir,"\","/") | |
objOutput.WriteLine (dir) | |
objOutput.Close | |
Dim result | |
'dry run | |
Set result = objWshShell.Exec ("C:\cygwin\bin\bash.exe --login -c '~/rsync.pl -n'") | |
Do While result.Status = 0 | |
WScript.Sleep 100 | |
Loop | |
If result.ExitCode <> 0 Then | |
WScript.Echo "rsyncが異常終了しました" & vbCrLf & result.StdErr.ReadAll() | |
WScript.Quit() | |
End If | |
Dim yesno | |
yesno = MsgBox (result.StdOut.ReadAll() & vbCrLf & "続行しますか?", 4, "確認") | |
If yesno <> 6 Then | |
WScript.Quit() | |
End If | |
'run | |
Set result = objWshShell.Exec ("C:\cygwin\bin\bash.exe --login -c '~/rsync.pl'") | |
Do While result.Status = 0 | |
WScript.Sleep 100 | |
Loop | |
If result.ExitCode <> 0 Then | |
WScript.Echo "rsyncが異常終了しました" & vbCrLf & result.StdErr.ReadAll() | |
WScript.Quit() | |
End If | |
Set objWshShell = Nothing |
MS4wMzZ8fDEzNzk3OTY0MDAxNzZ8MTExMTExfDIuODQyMjMzOTk5Mzk0ODU3M2UrMjg7MjQzODM3NDc4MTg4NjU7MjkyNDsxMDsyNjE5MDI0Njc1NzszMTstMTstMTswOzA7MDswOzY1OzI0NzN8MzI5LDMzMiw1MzcwMTczODQ3MiwwOzIwMSwyMDEsMTc4MDEzMDQ4NiwwOzIwMCwyMDAsMjc0MjQ0ODIsMDsyMDMsMjAzLDk5MzA3NDM3LDA7MTY3LDE2NywzMjk4NDc2NzIsMDsxMDYsMTA2LDM5OTE3NjQyNSwwOzEwNywxMDcsMTI2MzM4Njc5NywwOzExOSwxMTksMTY1NTgwODE5NTksMDsxMjUsMTI1LDEzNzU4NjIxMzM3NSwwOzEzNiwxMzYsMTA4OTYwMzI2OTkwOSwwO3w0NTAzNTk5NjI3MzcwNDk1OzQ1MDM1OTk2MjczNzA0OTU7MjI1MTgwMTk2MTE2ODUxMTs0NTAzNTczNzIzNDc4NTI3OzEwNDg1NzV8NDUwMjQ5ODEwMjQ3Njc5OTsxNzUxMTY1MDE2NDczNQ%3D%3D%21END%21
#!/usr/bin/env ruby | |
# coding: utf-8 | |
require 'pp' | |
require 'base64' | |
line = gets | |
line.chomp! | |
line.gsub!(/%21.+$/,"") | |
puts "=== cut =====" | |
puts line | |
puts "=== decode ==" | |
puts decode=Base64.decode64(line) | |
puts "=== plus ====" | |
#puts decode.gsub!(/^(?<=[\d\.]+\|\|)./,"hoge") | |
puts decode.gsub!(/^([\d\.]+\|\|\d+\|\d+\|)(\d+)/,'\128422339998792712179434250932') | |
puts "=== encode ==" | |
puts Base64.encode64(decode).gsub(/[\r\n]/,"") + "%21END%21" |
auth sufficient pam_permit.so
apt-get install smartmontools
start_smartd=yes
#DEVICESCAN -d removable -n standby -m root -M exec /usr/share/smartmontools/smartd-runner /dev/sda -a -d sat -o on -S on -s (S/../.././02|L/../../6/03) -m hoge@example.com
/dev/sda -a -d sat -o on -S on -s (S/../.././02|L/../../6/03) -m hoge@example.com -M test
ethtool -i eth0 lspci | grep Realtek
Match User sftpuser AllowTcpForwarding no ChrootDirectory /home/chroot ForceCommand internal-sftp PasswordAuthentication yes X11Forwarding no
setxkbmap -layout jp
dpkg-reconfigure keyboard-configuration
aptitude install qemu-kvm libvirt-bin virt-managerlibvirtグループへ参加
usermod -a -G libvirt hogeuserネットワーク設定
auto eth0 iface eth0 inet manual auto br0 iface br0 inet static address 192.168.0.100 netmask 255.255.255.0 gateway 192.168.0.1 bridge_ports eth0 bridge_stp off
request_header_access VIA deny all request_header_replace VIA 1.1 Squid3
ssh -o "PubkeyAuthentication no" hogehost ssh -o "StrictHostKeyChecking no" hogehost
mysql> FLUSH LOGS; $ mysqldump --order-by-primary --single-transaction --master-data -uroot -p'passwd' databasename > databasename.dump mysql> show master status;
mysql> stop slave; mysql -uroot -p'passwd' databasename < databasename.dump mysql> start slave; mysql> show slave status;
xrandr --output HDMI-1 --rotate left --primary参考リンク
smtpd_recipient_restrictions = permit_mynetworks , check_client_access hash:/etc/postfix/client_access , permit_sasl_authenticated , reject_unauth_destination smtpd_restriction_classes = spam_restriction spam_restriction = check_recipient_access hash:/etc/postfix/rejectaddress
123.123.123.123 spam_restriction
reject@ REJECT
deb http://www.deb-multimedia.org squeeze main non-free
#!/bin/bash | |
iptables -F | |
iptables -Z | |
iptables -X | |
iptables -P INPUT DROP | |
iptables -A INPUT -i lo -j ACCEPT | |
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT # LAN | |
# user chain | |
iptables -N JAPAN_ONLY | |
#web | |
iptables -A INPUT -p tcp -m multiport --dport 80,443 -j JAPAN_ONLY | |
iptables -A INPUT -p tcp -m multiport --dport 80,443 -m state --state NEW -m hashlimit \ | |
--hashlimit-name web_limit --hashlimit 2/m --hashlimit-burst 5 \ | |
--hashlimit-mode srcip --hashlimit-htable-expire 360000 -j ACCEPT | |
# user chain read | |
source /etc/network/japan_only.sh |
#!/bin/bash | |
iptables -F JAPAN_ONLY | |
iptables -A JAPAN_ONLY -s 1.0.16.0/20 -j RETURN | |
iptables -A JAPAN_ONLY -s 223.223.208.0/21 -j RETURN | |
iptables -A JAPAN_ONLY -s 223.223.224.0/19 -j RETURN | |
#↓以下続く | |
iptables -A JAPAN_ONLY -j DROP |
#!/usr/bin/perl | |
@list=<*.jpg>; | |
$i=1; | |
for (sort { (stat($a))[9] <=> (stat($b))[9] } @list){ | |
rename ($_,sprintf("%03d.jpg",$i++)) or die $!; | |
} | |
export EC2_HOME=$HOME/ec2 export PATH=$PATH:$EC2_HOME/bin export EC2_PRIVATE_KEY=/mnt/pk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem export EC2_CERT=/mnt/cert-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem export PATH=$PATH:$EC2_HOME/bin export EC2_URL=https://ec2.ap-northeast-1.amazonaws.com
ec2-describe-regions
#!/usr/bin/expect | |
set timeout 10 | |
#spawn telnet localhost 587 | |
spawn telnet localhost 25 | |
expect "Debian" | |
send "HELO jitaku\n" | |
expect "250" | |
send "MAIL FROM: from@hoge.com\n" | |
expect "250" | |
send "RCPT TO: to@hoge.net\n" | |
expect "250" | |
send "DATA\n" | |
expect "354" | |
send "test mail!\n" | |
send ".\n" | |
expect "250" | |
send "QUIT\n" | |
interact |
"|/usr/bin/maildrop" |
DEFAULT="$HOME/Maildir" | |
logfile "$HOME/maildrop.log" | |
import SENDER | |
xfilter "/usr/bin/spamc -f ${SENDER}" | |
if( /^X-Spam-Flag: YES/:h ) | |
{ | |
to "$DEFAULT/.Junk/" | |
} |
#!/bin/bash | |
sudo -u hogeuser bash -l -c "/usr/bin/sa-learn --ham '/home/hogeuser/Maildir/.Archives.2013/cur'" | |
sudo -u hogeuser bash -l -c "/usr/bin/sa-learn --spam '/home/hogeuser/Maildir/.Junk/cur'" |
#!/usr/bin/env ruby | |
# coding: utf-8 | |
class ApacheEntry | |
attr_reader :raw, :ip_address, :server_address, :user, | |
:date, :request, :status, :size, :referer, :user_agent | |
attr_accessor :remote_host | |
def initialize(line) | |
@raw = line | |
line =~ | |
/ | |
^(\S+) #ip_address | |
\s | |
(\S+) #server_address | |
\s | |
(\S+) #user | |
\s | |
\[ (.*?) \] #date | |
\s+ | |
" (.*?) " #request | |
\s+ | |
(\S+) #status | |
\s+ | |
(\S+) #size | |
\s+ | |
" (.*?) " #referer | |
\s+ | |
" (.*?) " #user_agent | |
/x | |
@ip_address = $1 | |
@server_address = $2 | |
@user = $3 | |
d = $4 | |
@request = URI.unescape($5) | |
@status = $6 | |
@size = $7 | |
@referer = $8 | |
@user_agent = $9 | |
d=d.sub(/\:/," ") | |
@date = Time.parse(d).strftime("%Y/%m/%d %H:%m") | |
@remote_host = @ip_address | |
end | |
end |
ettercap -Tq -M arp /192.168.0.2/ /192.168.0.11/インターフェイスは-Tのテキスト、-Cのcurses、-GのGtkと選べる
tcpflow -cse -i eth0 dst port 80-c コンソールに出力
Mozilla/5.0 (PlayStation Vita 2.02) AppleWebKit/536.26 (KHTML, like Gecko) Silk/3.2 |
git clone git@gist.github.com:1234567
dig [@server] domain [query-type]
a (Aレコード) any (任意の情報) mx (MXレコード) ns (NSレコード) soa (SOAレコード) hinfo (HINFOレコード) axfr (ゾーン転送) txt (TXTレコード)
NOERROR (正常) NXDOMAIN (ドメインは存在しない) SERVFAIL (サーバの応答エラー)
qr (クエリの回答) aa (権威ある回答) tc (TCPフォールバック) ra (フルサービスリゾルバ) rd (再帰要求,+norecオプションで消える)
#%PAM-1.0 @include common-auth account required pam_succeed_if.so user = hogeuser @include common-account @include common-session
CustomLog ${APACHE_LOG_DIR}/access.log combined CustomLog "|/usr/bin/logger -p local6.info --" combined
#mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 smtpd_sasl_auth_enable = yes smtpd_sasl_path = smtpd smtpd_recipient_restrictions = permit_sasl_authenticated, reject_unauth_destinationmynetworksからはauth無しで許可する場合はコメント外してもOK
submission inet n - n - - smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject
adduser postfix sasl
pwcheck_method: saslauthd mech_list: plain login