2015年4月23日木曜日

samba lumba , currentを追いかける

windows81 でのネットワーク共有は
http://kss02rx.blog.fc2.com/blog-entry-38.html にある。
ここの

http://kss02rx.blog.fc2.com/img/20140521221644922.jpg
が大事。
sharity-light-1.3p0 
  は userland smbfs SMB to NFS protocols converter
  で  smbclient -U tuyosi \\\\192.168.100.102\\common
shlight               //192.168.100.102/common /mnt81  -u tuyosi
こんな風に使う。



 Following -current

http://unosodoku638kam.hatenablog.com/entry/2013/12/27/192223
http://www.openbsd.org/faq/faq5.html#Bld
に従いました。 
 
けど Building thuserland 後に 
Duplicate directories detected for extension Scalar-List-Utils
Configure cannot correctly recover from this - shall I abort?
/usr/src/gnu/usr.bin/perl/Configure: .: ../UU/myread: not found
*** Error 1 in gnu/usr.bin/perl (Makefile.bsd-wrapper:76 'config.sh')
*** Error 1 in gnu/usr.bin (<bsd.subdir.mk>:48 'depend')
*** Error 1 in gnu (<bsd.subdir.mk>:48 'depend')
*** Error 1 in . (<bsd.subdir.mk>:48 'depend')
*** Error 1 in /usr/src (Makefile:82 'build')
風になり、current を追いかけるのは 力量ないと危険!
 
なお 
Snapshots are based on -current and thus /newer/ than the
upcoming 5.7-release.
 
5.7 has been built nearly two months ago. 
Current snapshots are whatwill eventually become 5.8.
 
 
 1)
           # cd /usr
                                (export CVSROOT=anoncvs@anoncvs.example.org:/cvs)
    # export CVSROOT=anoncvs@anoncvs.jp.openbsd.org:/cvs      
src # cvs -d$CVSROOT checkout -P src
sys  # cvs -d$CVSROOT checkout -P sys



#######----->
    Once you have a tree, you can update it at a later time:

           # cd /usr/src
           # export CVSROOT=anoncvs@anoncvs.jp.openbsd.org:/cvs
      src       # cvs -d$CVSROOT up -P src
      sys       # cvs -d$CVSROOT up -P sys
src+sys > # cvs -d$CVSROOT up -Pd 
#######----<





2)
#####  build kernel
# cd /usr/src/sys/arch/i386/conf
# cp GENERIC GENERIC-1
# config GENERIC
# cd ../compile/GENERIC
# make clean && make
    [...lots of output...]
# make install



3)
<--- reboot--->


4)
Building the userland

        # rm -rf /usr/obj/*
        # cd /usr/src
        # make obj

        # cd /usr/src/etc && env DESTDIR=/ make distrib-dirs


        # cd /usr/src
        # make build


5)
<---- Following -current
http://www.openbsd.org/faq/current.html
 

2015年4月13日月曜日

vnc over ssh ( openbsd と arch linux とで)

まず openbsdで基本をおさえます


1) x11vnc  over  ssh

2階に (192.168.1.142)にopenbsd PC があります。

1階の openbsd PCから 2階に入ってみます。

青い色は2階でのこと
黒い色は1階でのこと です。

2階で
#  pkg_add x11vnc 
と導入し
$  x11vnc
と走らせます。
そうして 1階に降ります。


一階でもx11vncは導入してあります。

$ ssh  192.168.1.142  -L  5900:localhost:5900
 (一階から2階に トンネルを掘りました)
そして



1階の新たなX端末で
$ vncviewer localhost:5900
とすると
2階のPCの画面がそのままでてきます。 



2)今度は archlinux です。


https://wiki.archlinux.org/index.php/Vncserverをみました



遠隔地のPC(yaourt tightvnc済み)から 自宅のPCに これをします。
遠隔地のPCから 自宅のPCsshで入っていろいろ準備します。

  遠隔地のPCーーーーーーー>自宅のPCがサーバー

まず 遠隔地のPCから 自宅のPCに普通に sshではいって
yaourt tightvnc


それから
zitaku$  cat .vnc/xstartup
#!/bin/sh
export XKL_XMODMAP_DISABLE=1
exec startlxde

とし、 chmod +x .vnc/xstartup します。 



zitaku$ vncserver -geometry 1440x900 -alwaysshared -dpi 96 -localhost :1
をします。
パスワードをもとめられますのでいれます。


今度は 遠隔地のパソコンから
ssh a.mydns.jp  -L 8900:localhost:5901
をし(これをした途端に自宅にいってます)、トンネルを自宅のPCにむけて掘りました。 

 
さらに  遠隔地のパソコンで別のターミナルをひらいて
vncviewer localhost:8900
をすると 
あら不思議自宅のパソコン画面がでてきます。
 
 
下の図は 自宅から遠隔地のPCに teamviewerではいってから、
この遠隔地のパソコンで 自宅のPCに vnc over ssh をして
結局自宅のパソコンをみてます。
ちょっと おもしろい。
赤枠が  teamviewer  の世界
黄枠が   vnc over sshの世界 ですね。
 

 どうして上の様になったかというと
遠隔地のPCは firewallの背後にあるので
自宅のPCからは ssh では入れないのです。
したがって teamviewer の登場となります。
一旦 遠隔地のPCにはいってしまうと、 遠隔地のPCから自宅のPCにvnc over sshで入れます。

 自宅のPCーーteamviewerーー>遠隔地のPCーーーvnc over sshーー>自宅のPC

2015年4月5日日曜日

5.6 -> 5.7 snapshot ; block teamviewer

1)how to start jwmを立ち上げるには

$ cat .xinitrc                                                                 jwm
 
see below .
ibus-anthy is going well and show state .










もちろん  pkg_add -iu


2) /etc/nginx/nginx.conf  


 
 worker_processes  1;
worker_rlimit_nofile 1024;

events {
    worker_connections  800;
}

#h>
http {

    include       mime.types;
    default_type  application/octet-stream;
    index         index.html index.htm;
    keepalive_timeout  65;
    server_tokens off;


server {
        listen       80;
        listen       [::]:80;
        server_name  localhost;    #<-for test
        root         /var/www/d1;
auth_basic "Restricted";
auth_basic_user_file /var/www/1/.htpasswd;
          }
 #0#  
    server {
        listen       80;
        listen       [::]:80;
        server_name  a.mydns.jp;
        root         /var/www/d0;
#auth_basic "Restricted";
#auth_basic_user_file /var/www/1/.htpasswd;
          }

#1
server {
        listen       80;
        listen       [::]:80;
        server_name  s.sun.ddns.vc;
        root         /var/www/d1;
auth_basic "Restricted";
auth_basic_user_file /var/www/1/.htpasswd;
          }

#2
server {
        listen       80;
        listen       [::]:80;
        server_name  kko.sun.ddns.vc;
        root         /var/www/d2;
auth_basic "Restricted";
auth_basic_user_file /var/www/2/.htpasswd;
 
 #11
server {
        listen       80;
        listen       [::]:80;
        server_name  m.planex.ddns.vc;
        root         /var/www/d11;
auth_basic "Restricted";
auth_basic_user_file /var/www/11/.htpasswd;
          }

#12
server {
        listen       80;
        listen       [::]:80;
        server_name  n.luna.ddns.vc;
        root         /var/www/d12;
auth_basic "Restricted";
auth_basic_user_file /var/www/12/.htpasswd;
          }
#h>
    } 
 

3)mount sda4(ext2)
 mount /dev/sd0j  /mnt





cd /mnt
dd bs=32786k if=/dev/rsd2c | gzip -c -9 > 32gUSBarch.gz 
4)
pfctl -sr


5)md5
p5-Test-File-Contents


6)
/etc/rc.local                                                            
#       $OpenBSD: rc.local,v 1.44 2011/04/22 06:08:14 ajacoutot Exp $
# Site-specific startup actions, daemons, and other things which
# can be done AFTER your system goes into securemode.  For actions
# which should be done BEFORE your system has gone into securemode
# please see /etc/rc.securelevel.
#if [  -x  /root/mount-EXT2.bat ]; then
#        echo 'Starting mount /EXT2 '; /root/mount-EXT2.bat
#fi


/usr/sbin/ntpd -s

#umount /var/www
#mount_ext2fs /dev/sd0a /var/www # <-----ext2fs


if [ -x /usr/sbin/nginx ];
then echo ' ----- Starting nginx ----- ';
/etc/rc.d/nginx -f start
fi


7)
gzip -c -9 X.img > X.img.gz



8)日本語入力
libreoffice




9) # cat /etc/rc.local
  
   # cat /etc/rc.shutdown



10)cat x.bat  access.log

x=`date | cut -d ' ' -f 4`
echo $x

y=`date | cut -d ' ' -f 2`
echo $y

z=`date | cut -d ' ' -f 7`
echo $z

A=$x/$y/$z
echo $A

cat /var/www/logs/access.log |  grep  $A >k1
cat k1
echo '111111111111111111111111111111111'

cat k1 | grep -v DoCoMo > k2
cat k2

ls -l /var/log/snort
cat /var/log/snort/alert
echo 'cd  /var/log/snort '



snort自体は
  wget https://www.snort.org/rules/snortrules-snapshot-2962.tar.gz?oinkcode=076d8a7。。。5bd5fba


cp snortrules-snapshot-2962.tar.gz\?oinkcode\=076d8a77eadd51。。。5fba      /etc/snort/






cd /etc/snort/

# tar xvzf
snortrules-snapshot-2962.tar.gz\?oinkcode\=076d8a7。。。45bd5fba





を確か 2970 2972も繰り返した。

snort -D -d -c /etc/snort/snort.conf  -u _snort -g _snort ; ps -ax| grep snort







10) top

 load averages:  0.34,  0.35,  0.34                                                             yuma.my.domain 19:51:24
59 processes: 2 running, 56 idle, 1 on processor
CPU states:  6.8% user,  0.0% nice,  0.2% system,  0.0% interrupt, 93.0% idle
Memory: Real: 296M/458M act/tot Free: 25M Cache: 96M Swap: 157M/1021M

  PID USERNAME PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU COMMAND
11602 tusi     2    0  192M  186M run       poll      4:04  0.00%     firefox
24033 tusi     2    0  112M   13M sleep     poll      2:06  0.00%    midori
 3018 tusi     2    0   20M   23M run       -         0:40  0.00%        Xorg
19218 tusi     2    0 3124K 3904K sleep     poll      0:07  0.00%   ibus-daemon
23443 tusi     2    0 3500K   10M idle      poll      0:03  0.00%      ibus-ui-gtk3
16713 tusi     2    0 6960K 8004K idle      poll      0:02  0.00%     python2.7
    1 root      10    0  676K  120K sleep     wait      0:01  0.00%    init
21844 tusi     2    0 1328K 2480K idle      poll      0:01  0.00%     ibus-engine-simp
 6833 tuysi     2    0 1008K 2040K idle      select    0:00  0.00%   fvwm






12)filemanager 
rox-filer -> rox で開始


3) scim-anthy
http://d.hatena.ne.jp/nawolets/20110507/1304757336 をみるとよい。


$ vi .profile
export LANG=ja_JP.UTF-8
export LC_CTYPE=ja_JP.UTF-8
export GTK_IM_MODULE="scim"
export QT_IM_MODULE="scim"
export XMODIFIERS="@im=SCIM" 
 
$ vi .xinitrc
/usr/local/bin/scim -d &


$ vi .inputrc
set convert-meta off
set meta-flag on
set output-meta on





13)ports memo
http://unosodoku638kam.hatenablog.com/entry/2013/12/27/192223

  •  http://www.openbsd.org/faq/faq15.html#Ports

    $ cd /usr/ports
    $ make search key=rsnapshot
     
     
     
    $ cd /usr/ports/net/rsnapshot
    $ make install
     
     

    15.3.6 - Cleaning up after a build

    You probably want to clean the port's default working directory after you have built the package and installed it.
    $ make clean
    ===>  Cleaning for rsnapshot-1.2.9
    
    In addition, you can also clean the working directories of all dependencies of the port with this make target:
    $ make clean=depends
    ===>  Cleaning for rsync-2.6.9
    ===>  Cleaning for rsnapshot-1.2.9
    
    If you wish to remove the source distribution set(s) of the port, you would use
    $ make clean=dist
    ===>  Cleaning for rsnapshot-1.2.9
    ===>  Dist cleaning for rsnapshot-1.2.9
    
    In case you have been compiling multiple flavors of the same port, you can clear the working directories of all these flavors at once using
    $ make clean=flavors
    
    You can also clean things up as they get built, by setting a special variable. Work directories will automatically be cleaned after packages have been created:
    $ make package BULK=Yes
    



  • 辛抱できるterminal


1) roxterm 

$ cat
/usr/local/bin/lll
ls $1 | cat -
 
 
2) 
1st     pkg_add colorls 
 
ln -s /usr/local/bin/colorls  /usr/local/bin/ll
        use ll instead of ls

2nd     from https://sites.google.com/site/teyasn001/home/uxterm
        $ cat .Xdefaults

        #   XTerm*loginShell:true
        XTerm*faceName:'Monospace'
        XTerm*faceSize:13
        XTerm*background:gray
        XTerm*foreground:blac

        UXTerm*faceName:            Dejavu Sans Mono:style=book
        UXTerm*faceNameDoublesize:  IPAGothic:style=Regular
        UXTerm*faceSize:        15
        UXTerm*background:      gray
        UXTerm*foreground:      black
 
3rd more .jwmrc
<?xml version="1.0"?>

<JWM>

   <!-- The root menu, if this is undefined you will not get a menu. -->
   <!-- Additional RootMenu attributes: onroot, labeled, label -->
   <RootMenu height="32" onroot="12">

 <Program icon="terminal.png" label="uxterm">    uxterm </Program>
 <Program icon="terminal.png" label="roxterm">   roxterm</Program>
 <Program icon="ibun-anthy.png" label="IbusAnthy">      /usr/local/bin/ibus-daemon -d -x -r</Program>
 <Program icon="xfce4-mixer.png" label="xfce4-mixer">   xfce4-mixer        </Program>
 <Program icon="rox.png" label="rox">rox                                </Program>


 <Menu icon="folder.png" label="Applications">
 <Program icon="word-processor.png" label="Libre Office">libreoffice    </Program>



さまざま

sh /etc/netstart



#cdio -f cd1c blank  ;  eject cd1c
 cdrecord -v   dev=6,1,0 blank=all  ;  eject cd1c


$ cat cd-iso-burn.bat                                                         
#cdio -f cd0c tao $1   <--- うすくしか焼けない
#cdio -f cd1c tao $1 
<--- うすくしか焼けない
 ##########################
#cdrecord dev=1,0,0 speed=2 -v $1
 cdrecord dev=6,1,0 speed=2 -v $1



BLOCK  teamviewer


internet
|
|
wifi router---windows81
|
|
urtwn0 dhcp
openbsd
fxp0 192.168.64.1/24(dhcpd)
|
|
dhcp
linux
(firefox edit>preference>adavance>setting>http proxy 192.168.64.1 port 3128



# ./comment-out.bat  /etc/squid/squid.conf                                                                  
acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7       # RFC 4193 local private network range
acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access allow localnet
http_access allow localhost
http_access deny all
http_port 3128
coredump_dir /var/squid/cache
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320

# ./comment-out.bat  /etc/pf.conf                                                                           
ext_if="urtwn0"
int_if="fxp0"
tcp_services="{ 22, 113 }"
icmp_types="echoreq"
set block-policy return
set loginterface $ext_if
set skip on lo
set reassemble yes no-df
pass in quick log on $ext_if inet proto tcp to port 80 divert-to 127.0.0.1 port 3128
pass out quick from 127.0.0.1 divert-reply
anchor "ftp-proxy/*"
pass in quick on $int_if inet proto tcp to any port ftp \
    divert-to 127.0.0.1 port 8021
block in log
pass out quick
antispoof quick for { lo $int_if }
pass in  on  $ext_if   inet proto tcp from any to  ( $ext_if:0 ) port  $tcp_services
pass in inet proto icmp all icmp-type $icmp_types
pass in on $int_if


すると win81 のteamviewer から linuxのteamviewer に接続しようとしても
パートナーへの接続はありません
となって接続を拒否される。
つまり openbsd firewall が侵入を食い止めた。




snort





http://inaba-serverdesign.jp/blog/20140131/snort_inline_ips.html
がいいサイトです。

最終的には
  cat snort.bat  
cd /usr/local/bin/# test-mode
#snort -T -i urtwn0 -u _snort -g _snort -c /etc/snort/snort.conf

snort -A fast -b -d -D -i urtwn0 -u _snort -g _snort -c /etc/snort/snort.conf -l /var/log/snort



ポイントは
1) ルールは cd /etc/snort のところで解凍
2) 
touch /etc/snort/rules/white_list.rules /etc/snort/rules/black_list.rules
3)
# mkdir /usr/local/lib/snort_dynamicrules
# cp
   /etc/snort/so_rules/precompiled/OpenBSD-5-3/i386/2.9.7.2/*
   /usr/local/lib/snort_dynamicrules/
でした。






2015年3月30日月曜日

linux で 作った openbsd  領域に 新規 インストール

linux で openbsd 領域をつくりました。


fdisk -l /dev/sdb
Device     Boot     Start       End   Sectors  Size Id Type
/dev/sdb1           22528   3891199   3868672  1.9G 82 Linux swap / Solaris
/dev/sdb2            2048     22527     20480   10M  c W95 FAT32 (LBA)
/dev/sdb3         3891200 842751999 838860800  400G  5 Extended
/dev/sdb4       842752000 976773167 134021168 63.9G a6 OpenBSD
/dev/sdb5         3893248 213608447 209715200  100G 83 Linux
/dev/sdb6  *    213610496 528183295 314572800  150G 83 Linux
/dev/sdb7       528185344 842751999 314566656  150G  7 HPFS/NTFS/exFAT



しかし
openbsdのCDで /dev/sdb4 へ直接インストールするのは
失敗した時恐ろしいことが待ち受けます。

それで作戦をかえ、まずUSBにインストールしてから
その内容を /dev/sdb4に クローンコピーする方向にしました。

2G のUSB と 500GのSDBとを接続後
openbsdのCDでブートします。

ctrl+c を押し、中断させ dmesgでどう認識されてるかを見ます。
500Gのは sd1と認識されてます。
2G のは   sd2。


install と打ち込み、
インストール先を OpenBSD areaとし、
sd1がフォーマットされる段階が終わったら ctrl+c 。


なお自分は a(/) と b(swap)しか作りません。


この後
# mkdir /mnt0
# mkdir /mnt1

# mount /dev/sd2a /mnt0  
# mount /dev/sd1a /mnt1
 
# (cd /mnt0; tar cvpf - .)|(cd /mnt1 ; tar xpf -)

これで クローンコピーは終了です。
しかし ブートローダーは入ってない。

そのため一旦 halt します。

2Gを抜き、 500Gだけつけて openbsd CDでブート.
今度は upgrade を選び、
bsd.rdなんたらのところにきたら
abort を選んだあと 
halt します。

あと 以前のようにgrub4dosで openbsdを立ち上げたあと、
/etc/rc.conf.local で xdmをコメントアウトします。

これで終了です。


以下は英語で同じものです。
this is my little expirience , it may be useful using openbsd & linux in
tha same hard disk .

I made the openbsd area by LINUX's fdisk.
namely
fdisk -l /dev/sdb (500GB USB hard disk)
Device Boot Start End Sectors Size Id Type
 sdb1 22528 3891199 3868672 1.9G 82 Linux swap / Solaris
 sdb2 2048 22527 20480 10M c W95 FAT32 (LBA)
 sdb3 3891200 842751999 838860800 400G 5 Extended
 sdb4 842752000 976773167 134021168 63.9G a6 OpenBSD <--------
 sdb5 3893248 213608447 209715200 100G 83 Linux
 sdb6 * 213610496 528183295 314572800 150G 83 Linux
 sdb7 528185344 842751999 314566656 150G 7 HPFS / NTFS / exFAT


i want to install openbsd OS into sdb4 .
But to install OpenBSD directly is risky .
if i fail , i lose all (including linux) .

So I changed the strategy.
install first on 2G USB.
then clone copy to 500G USB sdb4 .


After connecting the 2G USB and 500G USB , I boot by  openbsd CD .
press ctrl + c, I  look at the way of 2G and 500G by 'dmesg' .
500G is  recognized as sd1.
2G                  as sd2.

i install openbsd OS into ---OpenBSD area---.
When sd1 is formatted , i put  ctrl + c.

my way is always  a (/) and b (swap) only .
so

# mkdir / mnt0
# mkdir / mnt1

# Mount /dev/sd2a / mnt0
# Mount /dev/sd1a / mnt1

# (cd / mnt0;. tar cvpf -) | (cd / mnt1; tar xpf -)

clone copy itself is completed.
But the boot loader is not .


Therefore I will install boot loader .
afte unplug the 2G, put 500G only ,then i  boot by openbsd CD.
Now select the ---upgrade---,
When i came to the stage 'bsd.rd etc', i select ---abort---.

all is done .
by using  previos menu.lst , i boot openbsd in 500G by grub4dos .
After i launched openbsd , I comment out the xdm in /etc/rc.conf.local.
 








2015年1月7日水曜日

mydns.jp

cat .fetchmailrc                                                                                                 


defaults
no rewrite
no mimedecode
poll mail.mydns.jp
protocol pop3
username  mydns123
password  p123


成功すると
cat /var/mail/tuyosi


Date: Wed, 7 Jan 2015 03:00:05 +0900 (JST)
Message-Id: <7577654972758818552.enqueue@y.my.domain>
From: root (Cron Daemon)@y.my.domain
To: t@y.my.domain
Subject: Cron <t@y> /usr/local/bin/fetchmail     
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/t>
X-Cron-Env: <LOGNAME=t>
X-Cron-Env: <USER=t>

fetchmail: No mail for mydns123 at mail.mydns.jp
になる。

2014年12月26日金曜日

nginx で  vitualhost かつ BASIC認証

結構 openbsdのnginxはデリケートだ。
丁寧に扱わないといけない。


archlinxのデフォルトのnginxは chrootされてなくあぶない。
かといって それをきちんとchrootするのはとても大変である。
あやうい wwwサーバーではなんともならない。

また apacheは 古くなったとのこと。
だから nginxに移行した。


/etc/nginx/nginx.conf は結局以下。



--------------------

worker_processes  1;
worker_rlimit_nofile 1024;

events {
    worker_connections  800;
}

#h>
http {

    include       mime.types;
    default_type  application/octet-stream;
    index         index.html index.htm;
    keepalive_timeout  65;
    server_tokens off;


server {
        listen       80;
        listen       [::]:80;
        server_name  localhost;    #<-for test
        root         /var/www/d1;
auth_basic "Restricted";
auth_basic_user_file /var/www/1/.htpasswd; #所有者はwwwにすること。
                      
          }


#0 ほら、basic 認証してるでしょう
    server {
        listen       80;
        listen       [::]:80;
        server_name  a.mydns.jp;
        root         /var/www/d0;
auth_basic "Restricted";
auth_basic_user_file /var/www/1/.htpasswd;
          }

#1
server {
        listen       80;
        listen       [::]:80;
        server_name  s.sun.ddns.vc;
        root         /var/www/d1;
auth_basic "Restricted";
auth_basic_user_file /var/www/1/.htpasswd;
          }

#2
server {
        listen       80;
        listen       [::]:80;
        server_name  k.sun.ddns.vc;
        root         /var/www/d2;
auth_basic "Restricted";
auth_basic_user_file /var/www/2/.htpasswd;
          }

#11
server {
        listen       80;
        listen       [::]:80;
        server_name  member.planex.ddns.vc;
        root         /var/www/d11;
auth_basic "Restricted";
auth_basic_user_file /var/www/11/.htpasswd;
          }

#12
server {
        listen       80;
        listen       [::]:80;
        server_name  n.luna.ddns.vc;
        root         /var/www/d12;
auth_basic "Restricted";
auth_basic_user_file /var/www/12/.htpasswd;
          }
#h>
    } 
 
 
 
自分は openbsdを USBでうごかしている。
それで 4Gしかとれない。
だから データは HDDにいれる必要がある。
しかも LINUXからもアクセスできるように ext2にしている。
 

記憶では
mv  /var/www  /var/www1
mkdir  /var/www
mount_ext2fs /dev/sd0a /var/www
cp -ar /var/www1/*   /var/www 
したと思う。
とにかく USBの /var/wwwを HDDに移した。



 # cat /etc/rc.local 
umount /var/www 

mount_ext2fs /dev/sd0a /var/www # <-----ext2fs

 if [ -x /usr/local/sbin/nginx ]; then echo ' ----- Starting nginx ----- '; /etc/rc.d/nginx -f start fi 



 because 
cat /etc/rc.d/nginx 
#!/bin/sh 
# # $OpenBSD: nginx,v 1.1 2012/02/19 11:34:36 robert Exp $ daemon="/usr/local/sbin/nginx" #<------   いろいろつついているうちに 
                                                                /usr/sbin/nginxが変化した。







 # 2>&1 nginx -V | tr -- - '\n' | grep _module
http_gzip_static_module
http_ssl_module
http_stub_status_module
mail_pop3_module
mail_imap_module
mail_smtp_module



archでは
 2>&1 nginx -V | tr -- - '\n' | grep _module is next
--------------------
imap_ssl_module
http_dav_module
http_gunzip_module
http_gzip_static_module
http_realip_module
http_spdy_module
http_ssl_module
http_stub_status_module
http_addition_module
http_degradation_module
http_flv_module
http_mp4_module
http_secure_link_module
http_sub_module

になってる。




後は
http://www.bsdnow.tv/tutorials/nginx
とか
http://apis.jpn.ph/fswiki/wiki.cgi?page=OpenBSD%2Fhttpd#p13

はありますが、
HTTPSは、メッセージを平文のままで送受信する標準のHTTPと異なり
WebブラウザとWebサーバの間の通信を暗号化して、盗聴改竄を防いでいる。

実現は難しい。

2014年12月13日土曜日

apache2 basic 認証 ; openbsd の grub

OpenBSD httpd does not support authentication.
ということで 
apache-httpd-2.2.27p4.tgzをいれます。

openbsdは usb HDD で動いてるので、 usbを圧迫しないように
公開ファイルを hard disk sd0 におきます。
ln -s ではうまくいかないので、

/etc/rc.local  を
umount /var/apache2/
mount_ext2fs /dev/sd0a  /var/apache2/

if [  -x /usr/local/sbin/apachectl2 ]; then
        echo ' ----- Re  Starting apache -----  ';  /usr/local/sbin/apachectl2 restart
fi

とします。見てのとおり ext2です。
というのは linux からも openbsdからも利用するためです。



やっと  'Basic Auth' ができました。 

www root は /var/apache2/htdocs/ .


conf file iは /etc/apache2/httpd2.conf .


cd /etc/apache2/
htpasswd .htpasswd  XXX
chmod 644  .htpasswd <- correct ?
として ID XXXに対するパスワードをつくります。


# head /etc/apache2/httpd2.conf
<Directory "/var/apache2/htdocs/YYY">
    AuthType Basic
    AuthName "Secret Zone"
    AuthUserFile /etc/apache2/.htpasswd
    Require user XXX
</Directory> 

 
なので 非公開フォルダは /var/apache2/htdocs/YYY で
 
     公開フォルダは /var/apache2/htdocs/ です。
 
 
  
こういった 公開フォルダの中に basic認証フォルダを
つくるという器用なことは
nginx
hiawatha
ではちょっと難しい。 
??   http://qiita.com/minodisk/items/90c6d6cd8f16c34ac10b  ??







 
 
 
  










































4.6 - Soft Updates ext4みたいなジャーナルらしい

Soft Updates is based on an idea proposed by Greg Ganger and Yale Patt 
and developed for FreeBSD by Kirk McKusick. 
SoftUpdates imposes a partial ordering on the buffer cache operations 
which permits the requirement 
for synchronous writing of directory entries to be removed
 from the FFS code. 
Thus, a large performance increase is seen in disk writing performance.

Enabling soft updates must be done with a mount-time option.
 When mounting a partition with the mount(8) utility, you can specify
 that you wish to have soft updates enabled on that partition. 
Below is a sample /etc/fstab(5) entry that has one partition sd0a 
that we wish to have mounted with soft updates.

/dev/sd0a / ffs rw,softdep 1 1
Note to sparc users: Do not enable soft updates on sun4 or sun4c machines. These architectures support only a very limited amount of kernel memory and cannot use this feature. However, sun4m machines are fine.



USBから立ち上げたOpenBSDに
pkg_add grub で grubをいれます。
openbsdにもgrubがなんとあるのです。 

そして   cat /grub/menu.lst     
  default 0
  timeout 10

 
title OpenBSD in USB
 
root (hd0,3)
 
chainloader +1

 

 
 
title slacko in USB
 
root (hd0,0)
 
kernel /slc/vmlinuz
 
initrd /slc/initrd.gz
 boot

と hd0 に気をつけてください。理由は4行先です。

 そして 
grub-instal  /dev/sd1c
をして 完成です。

つまり USBは  openbsdでは sd1 ですが、BIOSでUSBブートするので、
    (HDDは sd0 ) grub では hd0に入れ替わってますねえ~

 
 
-------------------------------------
その後本格的にこれを運用します。
porteus関係ですが 
 
bash-4.2$ ls /mnt/sda1/boot/
grub         initramfs-linux.img  vmlinuz-linux
initramfs-linux-fallback.img  syslinux
 
 
bash-4.2$ ls /mnt/sda1/porteus
base  changes  make_iso.sh  modules  optional 
porteus-v3.1-i486.sgn  rootcopy



bash-4.2$ cat /mnt/sda1/boot/syslinux/porteus.cfg LABEL --->lxqt_gui
前略 
MENU  --->LABEL Graphics mode (LXQT)
KERNEL vmlinuz
APPEND initrd=initrd.xz changes=/porteus load=003-lxqt;locales-ja
後略


です。