【KURO-SHEEVA】の設定

【初めて起動する前の準備
母艦(Windows)にシリアルドライバーの導入とターミナルソフトの準備
 付属のCDにシリアルドライバー(SheevaPlug_Host_SWsupportPackageWindowsHost1.2.zipを解凍)して、WindowsTeraTermUSBDriver をインストールします。
ターミナルソフトは、teraterm(UTF-8)を使用すると良いでしょう。

・起動すると、こんな感じに表示されます。


__ __ _ _
| \/ | __ _ _ ____ _____| | |
| |\/| |/ _` | '__\ \ / / _ \ | |
| | | | (_| | | \ V / __/ | |
|_| |_|\__,_|_| \_/ \___|_|_|
_ _ ____ _
| | | | | __ ) ___ ___ | |_
| | | |___| _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
\___/ |____/ \___/ \___/ \__|
** MARVELL BOARD: SHEEVA PLUG LE

U-Boot 1.1.4 (Sep 7 2009 - 20:21:09) Marvell version: 3.4.16

U-Boot code: 00600000 -> 0067FFF0 BSS: -> 006CEE60

Soc: 88F6281 A0 (DDR2)
CPU running @ 1200Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz

DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000 size 256MB
DRAM CS[1] base 0x10000000 size 256MB
DRAM Total size 512MB 16bit width
Flash: 0 kB
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:512 MB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net: egiga0 [PRIME], egiga1
Hit any key to stop autoboot: 0

・rootのと初期パスワード
root/nosoup4u

・rootのパスワードを変更
忘れないうちにパスワードを変更します。
root@debian:~# passwd

・初期ユーザの追加
root@debian:~# adduser hoge


・固定IPアドレスに変更
サーバとして使いたいので、固定IPアドレスにする。
root@debian:~# vi /etc/network/interfaces
auto lo
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0

auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.xxx.xxx
netmask 255.255.255.0
broadcast 192.168.xxx.255
gateway 192.168.xxx.xxx


・host名を変更
root@debian:~# vi /etc/hostname
hogehost

・hostsを変更
root@debian:~# vi /hosts
127.0.0.1 localhost
192.168.xxx.xxx
hogehost
#91.189.88.36 ports.ubuntu.com

・localeを変更
root@debian:~# /bin/sh -c 'echo 'LANG="ja_JP.UTF-8"' > /etc/default/locale'
root@debian:~# locale-gen "ja_JP.UTF-8"
Generating locales...
ja_JP.UTF-8... done
Generation complete.


・apt-get ですが、
/etc/fstabを見ると,/var/cache/aptをtmpfsでマウントしている為、再起動するたびに/var/cache/apt以下がなくなります。仕方ないので、とりあえず
root@debian:~# mkdir -p /var/cache/apt/archives/partial
としてから、apt-get コマンドを使用する。

・suコマンドの実行を制限

root@debian:/etc# usermod -G adm hoge

・sshの設定
 セイキュリティ強化の為、最低限はport番号・rootでのlogin不可・keyでの認証・パスワードでの認証不可に変更する。
vi /etc/ssh/sshd_config
port xxx
PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthentication no

AuthorizedKeysFile      %h/.ssh/authorized_keys


/etc/init.d/ssh restart

・ユーザhogeのsshキーを作成 
login hoge
ssh-keygenを実行すると以下の2つのファイルができます。

/home/hoge/.ssh/id_rsa
/home/hoge/.ssh/id_rsa.pub


id_rsa はログオンしたいpcにもっていきます。
id_rsa.pub は
ファイル名をauthorized_keysに変更します。



・接続するhostを制限

vi /etc/hosts.deny
ALL: ALL

vi /etc/hosts.allow
ALL: 127.0.0.1
sshd: 192.168.xxx.

・sudo使用可能化(setuid)

 ls -l /usr/bin/sudo
-rwxr-xr-x 1 root root 114976 2008-11-15 12:11 sudo

 chmod u+s sudo
 ls -l /usr/bin/sudo
-rwsr-xr-x 1 root root 114976 2008-11-15 12:11 sudo

・logwatchをインストール

apt-get install logwatch
mkdir /var/cache/logwatch

・root宛てを外部にメール
vim /etc/aliases
root: hoge@exsample.com

postalias /etc/aliases
newaliases