いつもなら、最後のnet-driversは普段ならいらんのだが、 コレガのPCC-TXFとかいう腐れpcmcia-NICを今回使うため必要だった。
| タイプ | 容量 | フォーマット | 利用方法 |
| 基本 | 98.7MB | ext3 (起動フラグ) | /boot |
| 基本 | 22.7GB | ext3 | / |
| 基本 | 7.0GB | ext3 | /var |
| swap | 511MB | /swap | swap |
/# mkdir www /# groupadd -g 2000 www 最初にグループを作っておかないとユーザが作れない グループナンバを明示的に2000、グループ名をwwwで作る /# useradd -d /www -u 2000 -g www www 所有directoryを/wwwに、userIDを2000に、 groupをwwwに設定して、ユーザwwwを作成 (念のため "tail /etc/passwd" で確認) /# usermod -G www hjk グループwwwにユーザhjkを追加 (念のため "id hjk" "tail /etc/group" で確認) /# passwd www /#これでとりあえず、ユーザ設定まで終了した。
ただ ls -l してみるとオーナーユーザとオーナーグループが root.root のまま
なので、
/# chwon www.www wwwしてやった。
あらかじめs30側の id_dea.pub を cat してバッファにコピーした。
以降はリモートは入り以下の作業をする。
hjk@s30:~$ ssh hjk@192.168.xxx.xxx Password: hjk@600:~$ mkdir .ssh hjk@600:~$ chmod 700 .ssh/ hjk@600:~/.ssh$ touch authorized_keys hjk@600:~/.ssh$ chmod 644 authorized_keys hjk@600:~$ echo 'ssh-dss catしておいたid_dea.pub ...hoge...hoge..xN hjk@s30' >> .ssh/authorized_keys一度リモートから抜けて、ssh -v hjk@192.168.xxx.xxx ではいってみると...
hjk@s30:~$ ssh -v hjk@192.168.xxx.xxx OpenSSH_3.8.1p1 Debian-8.sarge.4, OpenSSL 0.9.7e 25 Oct 2004 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Connecting to 192.168.1.12 [192.168.1.12] port 22. debug1: Connection established. debug1: identity file /home/hjk/.ssh/identity type 0 debug1: identity file /home/hjk/.ssh/id_rsa type 1 debug1: identity file /home/hjk/.ssh/id_dsa type 2 debug1: Remote protocol version 2.0, remote software version OpenSSH_3.8.1p1 Debian-8.sarge.4 debug1: match: OpenSSH_3.8.1p1 Debian-8.sarge.4 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_3.8.1p1 Debian-8.sarge.4 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host '192.168.1.12' is known and matches the RSA host key. debug1: Found key in /home/hjk/.ssh/known_hosts:7 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,keyboard-interactive debug1: Next authentication method: publickey debug1: Offering public key: /home/hjk/.ssh/id_rsa debug1: Authentications that can continue: publickey,keyboard-interactive debug1: Offering public key: /home/hjk/.ssh/id_dsa debug1: Server accepts key: pkalg ssh-dss blen 435 debug1: PEM_read_PrivateKey failed debug1: read PEM private key done: typeとして最後にパスフレーズが求められていることがわかる。Enter passphrase for key '/home/hjk/.ssh/id_dsa':
ssh公開鍵方式によるログインの成功だ。
注)IPの変更などがある場合、 ~/.ssh/known_hosts から当該マシンのエントリを削除してから 接続することで解決する。
以後はssh経由での作業とする。
[step1]ローカルからリモート(~/tmp/)にソースを送る hjk@s30:~$ scp bkup/openssl-0.9.7e.tar.gz hjk@192.168.1.12:tmp Enter passphrase for key '/home/hjk/.ssh/id_dsa': openssl-0.9.7e.tar.gz 100% 2972KB 743.0KB/s 00:04 [step2]リモートでの作業 hjk@s30:~$ ssh hjk@192.168.1.12 Enter passphrase for key '/home/hjk/.ssh/id_dsa': [step3]~/tmp/にあるソースを/usr/local/srcに移動し、解凍する hjk@600:~$ cd tmp/ hjk@600:~/tmp$ sudo cp openssl-0.9.7e.tar.gz /usr/local/src/ Password: hjk@600:~/tmp$ cd /usr/local/src/ hjk@600:/usr/local/src$ sudo tar zxvf openssl-0.9.7e.tar.gz [step4]コンパイルとインストール hjk@600:/usr/local/src$ cd openssl-0.9.7e hjk@600:/usr/local/src/openssl-0.9.7e$ sudo ./config -fPIC shared hjk@600:/usr/local/src$ cd openssl-0.9.7e$ sudo make hjk@600:/usr/local/src$ cd openssl-0.9.7e$ sudo make install hjk@600:/etc$ sudo touch ld.so.conf hjk@600:/etc$ sudo vi ld.so.conf /usr/local/ssl/lib と書く 600:~# ldconfig
ソースを解凍し、インストールを行う。
その際、
[step1]ローカルからリモート(~/tmp/)にソースを送る hjk@s30:~$ scp bkup/httpd-2.0.52.tar.gz hjk@192.168.1.12:tmp Enter passphrase for key '/home/hjk/.ssh/id_dsa': httpd-2.0.52.tar.gz 100% 6757KB 844.6KB/s 00:08 [step2]リモートでの作業 hjk@s30:~$ ssh hjk@192.168.1.12 Enter passphrase for key '/home/hjk/.ssh/id_dsa': hjk@600:~$ [step3]~/tmp/にあるソースを/usr/local/srcに移動し、解凍する hjk@600:~$ sudo cp tmp/httpd-2.0.52.tar.gz /usr/local/src/ hjk@600:~$ cd /usr/local/src/ [step4]コンパイルとインストール hjk@600:/usr/local/src$ sudo tar zxvf httpd-2.0.52.tar.gz hjk@600:/usr/local/src$ cd httpd-2.0.52 hjk@600:/usr/local/src/httpd-2.0.52$ sudo ./configure (次のオプションをつけて)
| 行数(約) | 変更前 | 変更後 |
| 267 | #User nobody #Group #-1 | User www Group www |
| 279 | #ServerAdmin you@example.com | ServerAdmin webmaster@kreisel.fam.cx |
| 294 | #ServerName www.example.com:80 | ServerName kreisel.fam.cx:80 |
| 307 | #DocumentRoot "/usr/local/apache2.0.52/htdocs" | DocumentRoot "/www" |
| 337 | #Directory "/usr/local/apache2.0.52/htdocs" | Directory "/www" |
| 352 | #Options Indexes FollowSymLinks Options FollowSymLinks Includes MultiViews | index.htmlがない場合にインデックスリストを表示しないようにする (ExecCGIを追記すれば、ユーザディレクトリにcgiが置ける: Options FollowSymLinks Includes ExecCGI MultiViews) |
| 373 | #AliasMatch ^/userdir/([^/]+)/(.*) /www/$1/public_html/$2 #全てのユーザでhttp://fedorasrv.com/userdir/ユーザ名/でアクセスできるように #UserDir public_html | UserDir /www/*/public_html |
| 383 | # # AllowOverride FileInfo AuthConfig Limit Indexes # Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec # # Order allow,deny # Allow from all # # # Order deny,allow # Deny from all # # | AllowOverride FileInfo AuthConfig Limit Indexes Options MultiViews SymLinksIfOwnerMatch IncludesNoExec Order allow,deny Allow from all Order deny,allow Deny from all |
| 416 | #DirectoryIndex index.html index.html.var | DirectoryIndex index.html index.htm index.php index.html.var |
| 452 | DefaultType text/plain #DefaultType text/plain | 変更なしだが、MIME type の不明なバイナリファイルがブラウザに表示されてしまうことを防ぐために、入れ換えてもよいかもしれない。 |
| 526 | CustomLog logs/access_log common #CustomLog logs/access_log combined | 変更なしだが、上をコメントインし下をコメントアウトすると、一つ前のページの URL と,ブラウザの銘柄がログに入る |
| 550 | #ServerTokens Full ServerTokens Prod ServerSignature Off | HTTPレスポンスなどでapacheやOSの情報を出力しないようにする |
| 788 | #LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW | LanguagePriority ja en ca cs da de el eo es et fr he hr it ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW |
| 808 | AddDefaultCharset ISO-8859-1 | #AddDefaultCharset ISO-8859-1 |
よって、以前trisalで作成した server.keyとserver.crtをもってきて、 そのまま
一応、以前やはり確認したように、psコマンドとnetstatコマンドで sslが動いていることを確認した。以下はその結果である。
# /usr/local/apache2/bin/apachectrl starssl 600:/home/hjk# ps axfw | grep httpd 1099 pts/0 S+ 0:00 \_ grep httpd 1090 ? Ss 0:00 /usr/local/apache2.0.52/bin/httpd -k start -DSSL 1091 ? S 0:00 \_ /usr/local/apache2.0.52/bin/httpd -k start -DSSL 1092 ? S 0:00 \_ /usr/local/apache2.0.52/bin/httpd -k start -DSSL 1093 ? S 0:00 \_ /usr/local/apache2.0.52/bin/httpd -k start -DSSL 1094 ? S 0:00 \_ /usr/local/apache2.0.52/bin/httpd -k start -DSSL 1095 ? S 0:00 \_ /usr/local/apache2.0.52/bin/httpd -k start -DSSL 1096 ? S 0:00 \_ /usr/local/apache2.0.52/bin/httpd -k start -DSSL DSSLで動いている、ということがSSL正常稼動の証拠…なのだそうだ。 600:/home/hjk# netstat -pln 稼働中のインターネット接続 (サーバーのみ) Proto 受信-Q 送信-Q 内部アドレス 外部アドレス 状態 PID/Program name tcp 0 0 0.0.0.0:612 0.0.0.0:* LISTEN 854/rpc.statd tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 596/portmap tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1090/httpd tcp 0 0 0.0.0.0:113 0.0.0.0:* LISTEN 815/inetd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 849/sshd tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 1090/httpd udp 0 0 0.0.0.0:68 0.0.0.0:* 928/dhclient udp 0 0 0.0.0.0:606 0.0.0.0:* 854/rpc.statd udp 0 0 0.0.0.0:609 0.0.0.0:* 854/rpc.statd udp 0 0 0.0.0.0:111 0.0.0.0:* 596/portmap 稼働中のUNIXドメインソケット (サーバーのみ) Proto RefCnt フラグ タイプ 状態 Iノード PID/Program name パス unix 2 [ ACC ] STREAM LISTENING 651 691/cannaserver /tmp/.iroha_unix/IROHA unix 2 [ ACC ] STREAM LISTENING 814 819/lpd /dev/printer 443番がListenされていることから、sslが稼動中だということがわかる…のだそうだ。続いて ssl.conf (/usr/local/apache2.0.52/conf/ssl.conf) の編集した。
| 行数 | 変更前 | 変更後 |
| 85 | #DocumentRoot "/usr/local/apache2.0.52/htdocs" #ServerName www.example.com:443 #ServerAdmin you@example.com #ErrorLog /usr/local/apache2.0.52/logs/error_log #TransferLog /usr/local/apache2.0.52/logs/access_log | DocumentRoot "/www" ServerName kreisel.fam.cx:443 ServerAdmin webmaster@kreisel.fam.cx ErrorLog logs/error_log TransferLog logs/access_log |
| 113 | SSLCertificateFile /usr/local/apache2.0.52/conf/ssl.crt/server.crt #SSLCertificateFile /usr/local/apache2.0.52/conf/ssl.crt/server-dsa.crt | 変更なし |
| 121 | SSLCertificateKeyFile /usr/local/apache2.0.52/conf/ssl.key/server.key #SSLCertificateKeyFile /usr/local/apache2.0.52/conf/ssl.key/server-dsa.key | 変更なし |
https://hoge で実験。
成功。
hjk@600:~$ mkdir /www/dav hjk@600:~$ sudo chown www.www /www/dav
次にロックファイル用のディレクトリ。
hjk@600:~$ sudo mkdir -p /www/var/DAVLock hjk@600:~$ sudo chown www.www /www/dav hjk@600:~$ sudo chown www.www /www/dav/DAVLock
最後に WebDAVユーザディレクトリ。
hjk@600:~$ sudo mkdir /www/dav/picure hjk@600:~$ sudo chown www.wwww /www/dav/picure chown: `www.wwww': グループ指定が不正 hjk@600:~$ sudo chown www.www /www/dav/picure hjk@600:~$ sudo chmod 747 /www/dav/picure/ hjk@600:~$ ls -l /www/dav/ drwxr--rwx 2 www www 4096 2004-12-21 16:58 picure
hjk@600:~$ cd /www/dav/ <=パスワードファイルを作りたい場所へ移動 hjk@600:/www/dav$ su Password: 600:/www/dav# /usr/local/apache2.0.52/bin/htpasswd -c .privatekey picure2 New password: Re-type new password: Adding password for user picure2
hjk@600:~$ cd /www/dav/ <=パスワードファイルを作りたい場所へ移動 hjk@600:/www/dav$ su Password: 600:/www/dav# /usr/local/apache2.0.52/bin/htdigest -c .htdigest picure picure (htdigest -c .<キーファイル名> <グループ名> <ユーザ名> Adding password for picure in realm picure. New password: Re-type new password: 600:/www/dav# /usr/local/apache2.0.52/bin/htdigest .htdigest picure hujioka (同じグループにユーザ追加なら"-c"はいらない> Adding user hujioka in realm picure New password: Re-type new password:形式としては
上のrealemはhttpd.confのdav設定中の"AuthName"に相当するんで 忘れないように。
詳しくは 以前の記事を参照
## WebDAV ## ### picure-group ### !Alias /picure "/www/dav/picure" !! Dav on ! AllowOverride None ! Options None ! AuthDigestFile /www/dav/.htdigest ! AuthName picure ! AuthType Digest ! Require user picure # !Alias /picure2 "/www/dav/picure2" !# Require user valid-user # !! Dav on ! SSLRequireSSL ! AllowOverride None ! Options None ! AuthUserFile /www/dav/.privatekey ! AuthName "Welcome to PICURE2 on WebDav" ! AuthType Basic ! Require user picure2 ! !DavLockDB /www/var/DAVLock (!を実際には外して書くこと!!)