投稿者「admin」のアーカイブ

苗場でスキーバッジテスト

Untitled


天気:晴れのち雪。

1級…結果不合格でした。。
もう少し練習しないとダメですな。

大回り/小回り/不整地/横滑り 69/69/70/69 計277点(280点以上で合格)
17人中合格ひとり(少年)。横滑り70点出たのは今期初らしい。

raidコントローラ不調のトラブルシューティング

手作り大福

※写真と本文は関係ありません。


社内ファイルサーバ用にサーバを購入した。
セットアップ中にたまに再起動したりて、なんか調子悪いなぁと思ってたのを原因究明。

サーバはHPのProLiant ML310e Gen8
Raidカードは後付けの LSI Megaraid SAS 9240-4i

再起動がかかるのはH/W側の問題かと思い、hpのsystem management homepageで確認してみる。
WebUI(https://hostIPaddress:2381/)からインテグレーテッドマネジメントログを確認。

(クリティカル) Unrecoverable System Error (NMI) has occurred. System Firmware will log additional details in a separate IML entry if possible
(危険)POST Error: 1785-Slot X Drive Array Not Config

と2項目のログがたくさん見える。
『POST Error: 1785-Slot X Drive Array Not Config』はオンボードのRaidを無効に。
『Unrecoverable System Error (NMI) 』はRaidカードを差し直し。で改善。
さらに/var/log/messagesにこんなLogが…

Jan 23 21:00:07 samba2013 MR_MONITOR[3603]:  Controller ID:  0   Unexpected sense:   PD  #012    =   -:-:0Unknown Sense Code,   CDB   =    0x00 0x00 0x00 0x00 0x00 0x00    ,   Sense   =    0x72 0x01 0x00 0x1d 0x00 0x00 0x00 0x0e 0x09 0x0c 0x00 0x00 0x00 0xff 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x50
Jan 23 21:05:06 samba2013 MR_MONITOR[3603]:  Controller ID:  0   Unexpected sense:   PD  #012    =   -:-:0Unknown Sense Code,   CDB   =    0x00 0x00 0x00 0x00 0x00 0x00    ,   Sense   =    0x72 0x01 0x00 0x1d 0x00 0x00 0x00 0x0e 0x09 0x0c 0x00 0x00 0x00 0xff 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x50
Jan 23 21:10:06 samba2013 MR_MONITOR[3603]:  Controller ID:  0   Unexpected sense:   PD  #012    =   -:-:0Unknown Sense Code,   CDB   =    0x00 0x00 0x00 0x00 0x00 0x00    ,   Sense   =    0x72 0x01 0x00 0x1d 0x00 0x00 0x00 0x0e 0x09 0x0c 0x00 0x00 0x00 0xff 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x50
Jan 23 21:15:06 samba2013 MR_MONITOR[3603]:  Controller ID:  0   Unexpected sense:   PD  #012    =   -:-:0Unknown Sense Code,   CDB   =    0x00 0x00 0x00 0x00 0x00 0x00    ,   Sense   =    0x72 0x01 0x00 0x1d 0x00 0x00 0x00 0x0e 0x09 0x0c 0x00 0x00 0x00 0xff 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x50
Jan 23 21:20:06 samba2013 MR_MONITOR[3603]:  Controller ID:  0   Unexpected sense:   PD  #012    =   -:-:0Unknown Sense Code,   CDB   =    0x00 0x00 0x00 0x00 0x00 0x00    ,   Sense   =    0x72 0x01 0x00 0x1d 0x00 0x00 0x00 0x0e 0x09 0x0c 0x00 0x00 0x00 0xff 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x50

5分おきにUnexpectedなエラー…

これは結局よくわからなくて、F/Wが少し古いからUpdateしてみたらたまたまなおった。

# /usr/local/MegaRAID\ Storage\ Manager/StorCLI/storcli64 /c0  download file=/home/hogege/Downloads/imr_fw.rom 
Download Completed.     
Flashing image to adapter...
Controller = 0
Status = Success
Description = F/W Flash Completed. Please reboot the system for the changes to take effect

Current package version = 20.5.1-0003
New package version = 20.12.1-0150

これで完調になりました。

# sh add_repo.sh mcl でエラー

シュークリーム

※写真と本文は関係ありません。


http://frym.jp/?p=999で書いた、HPサーバのアプリのレポジトリ。

CentOSの6.5でコマンドを実行するとエラーになる。

# sh add_repo.sh mcp
note : You must read and accept the License Agreement to continue.
Press enter to display it ... 

 END USER LICENSE AGREEMENT

Do you accept? (yes/no) yes
warn : Unable to find relevant deliverables at URL : 
warn : http://downloads.linux.hp.com/SDR/repo/mcp/CentOS/6.5/x86_64/current
note : No repository configurations added.

リポジトリツリーに6.5のディレクトリがないのでエラーになっているので、-rオプションでCentOSのバージョンを指定するとエラーはなくなる。(けどちゃんと使えるかはわからないので自己責任で!)
6.Xはすべて6のディレクトリ以下のエイリアスになっている。

# sh add_repo.sh -r ‘6.4’ mcp
# sh add_repo.sh -r ‘6’ mcp

mod_security でWAF。

IMGP4038

※写真と本文は関係ありません。


備忘録書いておく。

wordpress(このサイトね)にXSSなどがたくさん来るので試してみた。

インストールはyumで

## mod_security 本体
# yum install mod_security
## ルールセット
# yum install mod_security_crs mod_security_crs-extras

設定は/etc/httpd/conf.d/mod_security.confで。
除外するルール。ホワイトリストのIPアドレスとWAFを発動しないpathを追記。

<IfModule mod_security2.c>
    ……
    # 除外するルールID(日本語クエリパラメータで発動してしまうので除外する)
    SecRuleRemoveById 960024
    # muninのhttp://localhost/server-status/へのアクセスを除外。
    SecRule REMOTE_ADDR "^127\.0\.0\.1$" "phase:1,nolog,allow,id:2013122401"
    # 管理画面へのアクセスは除外。
    SecRule REQUEST_FILENAME "^/wordpress/wp-admin/" "phase:1,nolog,allow,id:2013122501"
    ……
</IfModule>

ルールセットは/usr/lib/modsecurity.d/にあるので、適宜/etc/httpd/modsecurity.d/activated_rules/に置くと適用される。(base_rulesはmod_security_crsインストール時にシンボリックリンクされる)

運用は、ログで『403 Forbidden』されたルールIDを見てSecRuleRemoveByIdに追記する方法かなぁ。
ルールセットはあまり変更しない方がいいような感じかしら?

日本語の情報が少ないので、検索すると少し古い情報で迷う。。最近のVersionはSecRuleにid:が必要とか。ルール書くまで理解するのは大変そう…。

rsyslogでYamahaルータのsyslogを受信する。

IMG_0007
※写真と本文は関係ありません。


CentOS 6.4になって戸惑ったので書いておく。(6から?)
syslog を送信するルータはRT58i。

前は /etc/syslog.conf に設定を書いたけど /etc/rsyslog.conf に変わった。(リモート受信オプションは/etc/sysconfig/syslogに書いてた)

Linuxサーバ側で設定( /etc/rsyslog.conf )
local6に来たものを /var/log/router.log に出力。/var/log/messages に出力されないようにする。

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none;local6.none                /var/log/messages
…
# For yamaha router
local6.*                                                /var/log/router.log

13−14行目。リモートからのsyslog受信を有効にする。

# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514

logrotateの設定

# cat /etc/logrotate.d/syslog 
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
/var/log/backup.log
/var/log/tmpwach_samba.log
/var/log/empty_dir.log
/var/log/route53
/var/log/router.log
{
    sharedscripts
    postrotate
	/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}

RT58iではこんな設定を書く。

syslog host 192.168.1.8    # LinuxサーバのIPアドレス
syslog facility local6

文字列がパスワードにふさわしいかチェックする。

八岐大蛇
※写真と本文は関係ありません。


文字列が辞書に載っていない物かどうかをコマンドで調べたい。

cracklib-check – Check passwords using libcrack2

$ echo hogefuga | cracklib-check
hogefuga: OK
$ echo test123 | cracklib-check
test123: 辞書の単語に基づいています
$ echo 1234123 | cracklib-check
1234123: 異なる文字が十分に含まれていません

スクリプト書いた。

# cat check_password.sh
#!/bin/sh

PASSWDFILE=$(cat /root/password.txt)    # ID:Password の形式のリスト
IFS_back=$IFS
IFS=$'\n'

for LINE in $VPASSWDFILE
do
	PASSWORD=$(echo $LINE | cut -d: -f2)
	USERID=$(echo $LINE | cut -d: -f1)
	RESULTS=$(echo $PASSWORD | cracklib-check)    # OKなら "fugagaga: OK" と帰ってくる。
	CHECK_OK=$(echo $RESULTS | cut -d: -f2 | sed -e "s/^\ //")
	if [ $CHECK_OK != 'OK'  ]
	then
		echo "$USERID@example.or.jp:$RESULTS"
	fi
done

IFS=$IFS_back

こんな感じで結果が出力される。
asao@example.or.jp:waaaaa: it is based on a (reversed) dictionary word
fax@example.or.jp:fax: it is too short
oshi@example.or.jp:lalalalala: it is based on a dictionary word
※パスワードは適当です。

2TB以上のHDDを使う。

クリスマスケーキ

※写真と本文は関係ありません。


MBRパーティションは2TiBまでしか管理出来ない。GPT(GUIDパーティションテーブル(GUID Partition Table))を使う。
GPTはfdiskコマンドでは取り扱えない。parted を使う。

3TBのHDD /dev/sdd

# parted /dev/sdd 
GNU Parted 2.1
/dev/sdd を使用
GNU Parted へようこそ! コマンド一覧を見るには 'help' と入力してください。
(parted) print
エラー: /dev/sdd: ディスクラベルが認識できません。

ラベルをつける

(parted) mklabel gpt


パーティション作成

(parted) mkpart
パーティションの名前?  []?
ファイルシステムの種類?  [ext2]? 
開始? 0%
終了? 100%

結果を表示

(parted) print
モデル: LSI MR9240-4i (scsi)
ディスク /dev/sdc: 3000GB
セクタサイズ (論理/物理): 512B/512B
パーティションテーブル: gpt

番号  開始    終了    サイズ  ファイルシステム  名前  フラグ
 1    1049kB  3000GB  3000GB


パーティション 1 で lvm を有効にする。

(parted) set 1 lvm on
(parted) print
モデル: LSI MR9240-4i (scsi)
ディスク /dev/sdc: 3000GB
セクタサイズ (論理/物理): 512B/512B
パーティションテーブル: gpt

番号  開始    終了    サイズ  ファイルシステム  名前  フラグ
 1    1049kB  3000GB  3000GB                          lvm


# 設定を有効にして終了。

(parted) quit

あとはlvmの設定→フォーマット→ファイルシステムの作成。
LVM(Logical Volume Manager)

前も書いたなぁって思ったけど、SmartArray E200で2TB以上を認識しない件でした。

cifs共有の自動マウントの書き方を間違えてた。

IMGP1024

※写真と本文は関係ありません。


古いサーバ(CentOS release 5.6 / autofs のバージョン → autofs-5.0.1-0.rc2.143.el5_5.6)に書いてあった、Windowsサーバへの共有へ接続するautomount設定。


# cat /etc/auto.misc
share		-fstype=cifs,ro,nosuid,username=administrator,password=pasupasu 192.168.10.211:fugaga/RCVDATA


新サーバ(CentOS release 5.8 / autofs のバージョン → autofs-5.0.1-0.rc2.183.el5)に設定しようとして、そのまま書いたらエラーになる。

『/etc/sysconfig/autofs』で『LOGGING』を有効にするとログが出力される。


Nov 11 10:05:16 localhost2012 automount[26994]: validate_location: expected colon delimeter not found in location 192.168.10.211:fugaga/RCVDATA


『location が読めない!』って言っている。

この書き方はダメだったんだなたぶん。manを見るとWindows共有へのアクセスの例が書いてある。
(この書き方はnfsの時の書き方)


EXAMPLE
  Indirect map:
    windoze   -fstype=smbfs       ://windoze/c


昔から変わっていないっぽい。
というわけで、コレで動くようになった。


# cat /etc/auto.misc
share		-fstype=cifs,ro,nosuid,username=administrator,password=pasupasu ://192.168.10.211/fugaga/RCVDATA


HP サーバで必要なアプリケーションを HP の yum リポジトリから取得する。

グライダー

※写真と本文は関係ありません。


いつからあるんだろうか。

Software Delivery Repository
http://downloads.linux.hp.com/SDR/index.html

2016/10/14追記 → HPEになってURLが変更になってた。HPE Software Delivery Repository

右上の『Download add_repo.sh』からレポジトリ追加スクリプト(add_repo.sh)をダウンロードする

CentOSなので『mcp(Management Component Pack for ProLiant Agent → software for Ubuntu and community distros)』をつかう。


# sh ./add_repo.sh mcp
note : You must read and accept the License Agreement to continue.
Press enter to display it ... 
『License Agreement』が表示される。
Do you accept? (yes/no) yes
info : Repo added to /etc/yum.repos.d/HP-mcp.repo.



# cat /etc/yum.repos.d/HP-mcp.repo
# auto-generated by
#   http://downloads.linux.hp.com/SDR/repo/./add_repo.sh mcp

# By including and using this configuration,
# you agree to the terms and conditions
# of the HP Software License Agreement at
# http://h20000.www2.hp.com/bizsupport/TechSupport/softwareLicense.jsp?lang=en&cc=us&prodTypeId=15351&prodSeriesId=1121516&prodNameId=3288134&taskId=135

[HP-mcp]
name=HP Software Delivery Repository for mcp
baseurl=http://downloads.linux.hp.com/SDR/repo/mcp/CentOS/$releasever/$basearch/current
enabled=1
gpgcheck=0
#gpgcheck=1
#gpgkey=http://downloads.linux.hp.com/SDR/repo/mcp/GPG-KEY-mcp

#[HP-mcp-packages]
#name=HP Software Delivery Repository Repository for mcp Packages
#baseurl=http://downloads.linux.hp.com/SDR/repo/mcp/CentOS/$releasever/packages/$basearch
#enabled=0
#gpgcheck=0
#gpgcheck=1
#gpgkey=http://downloads.linux.hp.com/SDR/repo/mcp/GPG-KEY-mcp


rpmforge を有効にしたときは『enabled=0』として–enablerepo=rpmforge しないとリポジトリが有効にならないようにするんだけど、バッティングしないのでそのままで。

リポジトリにはこんなのがある。


# yum list |grep HP-mcp 
cpqacuxe.x86_64                        9.40-12.0                        HP-mcp  
hp-ams.x86_64                          1.3.0-876.49.rhel6               HP-mcp  
hp-health.x86_64                       9.31-1572.3.rhel6                HP-mcp  
hp-smh-templates.noarch                9.3.0-1293.35                    HP-mcp  
hp-snmp-agents.x86_64                  9.30-2412.33.rhel6               HP-mcp  
hpacucli.x86_64                        9.40-12.0                        HP-mcp  
hpdiags.x86_64                         9.4.0-562                        HP-mcp  
hponcfg.noarch                         4.1.0-0                          HP-mcp  
hpsmh.x86_64                           7.2.0-14                         HP-mcp  


詳細はこんな感じ。
cpqacuxe : The HP Array Configuration Utility is the web-based disk array configuration program for Array Controllers.
hp-ams : This package contains the helper daemon that provides information for iLO4 embedded health and alerting.
hp-health: This package contains the System Health Monitor and Advanced Server Reset Daemon for all hp Proliant systems with ASM, ILO, & ILO2 embedded management asics. Also contained are the command line utilities.
hp-smh-templates : This package contains the System Management Homepage Templates for all hp Proliant systems with ASM, ILO, & ILO2 embedded management asics.
hp-snmp-agents : This package contains the SNMP server, storage, and nic agents for all hp Proliant systems with ASM, ILO, & ILO2 embedded management asics.
hpacucli : The HP Command Line Array Configuration Utility is the disk array configuration program for Array Controllers.
hpdiags : Identifies and exercises system components.
hponcfg : Hponcfg is a command line utility that can be used to configure iLO/RILOE II from with in the operating system without requiring a reboot of the server.
hpsmh : The HP System Management Homepage v7.2.0.14

全部インストールしていいと思う。
yum install hp-ams hp-health hp-smh-templates hp-snmp-agents hpacucli hpdiags hponcfg hpsmh

snmp のセットアップは必要。(従来通り)


# hpsnmpconfig
This configuration script will configure SNMP to integrate with the HP SIM and
the HP System Management Homepage by editting the snmpd.conf file. The HP-SNMP-Agents can also exist in a more secure
SNMP environment (e.g. VACM) that you have previously configured. See the
hp-snmp-agents(4) man page for specific details on how to configure the VACM entries
in the 'snmpd.conf' file. You may press  now to exit now if needed.

Do you wish to use an existing snmpd.conf (y/n) (Blank is n): 
You will now be asked a series of SNMP configuration questions.  How you answer
these question will affect the way SNMP behaves.  Configuring SNMP could have
security implications on your system. If you are not sure how to answer a
question, you can abort by pressing  and no changes will be made to
your SNMP configuration.

Enter the localhost SNMP Read/Write community string
(one word, required, no default): 
Re-enter the same input to confirm: 
ACCEPTED: inputs match!

Enter localhost SNMP Read Only community string
(one word, Blank to skip): 
Enter Read/Write Authorized Management Station IP or DNS name
(Blank to skip): 
Enter Read Only Authorized Management Station IP or DNS name
(Blank to skip): 
Enter default SNMP trap community string
(One word; Blank to skip): 
Enter SNMP trap destination IP or DNS name
(One word; Blank to skip): 
The system contact is set to
syscontact Root  (configure /etc/snmp/snmp.local.conf)
Do you wish to change it (y/n) (Blank is n): 
The system location is set to
syslocation Unknown (edit /etc/snmp/snmpd.conf)
Do you wish to change it (y/n) (Blank is n): 

==============================================================================
NOTE: New snmpd.conf entries were added to the top of /etc/snmp/snmpd.conf
==============================================================================
snmpd is started


https://localhost:2381/ で SMH にアクセスできる。

いままではDVD-ROMダウンロード(時間がかかる)したり。CentOS版が見当たらなくなったり。GUIが必要だったり(Javaの高機能なGUIインストーラ)。Redhatを語ってインストールしたりしてたけど。CUIで事足りるしらくちん。

BRM914千葉300km(奥久慈)

自転車長距離イベントにまた参加してきましたが…ダメでした…DNF(Did Not Finish)

前回を踏まえて、ホイールと30Tのスプロケットを導入したんだけどね。

大洗20時出発で奥久慈→福島にちょっと入って大洗まで帰ってくるルート。制限時間が20時間。178kmのところでPC3(第3チェックポイント)の制限時間に間に合わなくて終了。

海鮮丼
スタート前に食べた海鮮丼。

鳥居撮ったつもり
八溝山の登り口(鳥居撮ったけど何も写らない…登りはじめたら線香の香りがして怖かった…)

雨がなぁ。下りでスピード出せないのが厳しかったかなぁ。途中砂利道だし。
あとサイコンのデータ見ると、休みすぎ。でも休まないと体力が回復しなくて…
ヒルクライム力がもう少し欲しい。もっと坂登る練習しよう。
2回連続で完走失敗。ブルベの自信喪失した。400kmなんて絶対ムリだ…


磐城棚倉駅前
駅前。ひどい雨。

実は、DNFした後も結構たいへんで…。
ひどい雨だったので水郡線運休してて輪行ができなくて、笑うくらいひどい雨の中自走で大洗まで帰りました。(リタイアしてるのに…)
制限時間に間に合わなかっただけで、自転車も体も動けたので時間かかったけど無事帰れた。

雨は昼くらいまでひどくて。『食洗機の中にいるとこんな感じだろうなぁ…』というくらいの雨。途中土砂崩れっぽいところを通過したり。
大洗で温泉入って帰りました。

今期はもう終わりなのでまた来年。それまで練習しよう…。


ナッツと干しぶどうの行動食
持って行った行動食(ナッツと干しぶどう)が美味かった。(超高カロリーなのでこんな時じゃないと食べられない)