2018年9月28日金曜日

Sophos Anti-Virus for Linux インストール

2019 Jan. 04.
2018 Sep. 29.
2018 Sep. 28.

オンアクセス検索とオンデマンド検索が可能

インストール

http://zokibayashi.hatenablog.com/entry/2015/05/27/233114
https://qiita.com/ayuri/items/342a0ddbd861ab1f5134

オンデマンド検索

PC全体をスキャン

# savscan /
  インストール時に全体スキャンを行っておく。

特定のディレクトリを検索しない
# savscan / -exclude /sys /proc /dev

検知ウイルスファイルを削除

# savscan /DIR -remove

検知ウイルスファイルを隔離

# savscan /DIR --quarantine : 隔離する


圧縮ファイル内も検索

# savscan /DIR -archive


オンアクセス検索

初期設定は検索だけで隔離・削除はされない

環境設定ガイドには「オンアクセス検索のオプションに「メールボックス全体が削除されることがあるので、感染ファイル削除を有効にしないように」と書かれている。

感染ファイル対応

検索のログ内容をユーザーに知らせるなどして、ユーザーに対応を促す。

(/var/log/syslog)

オンアクセス検索
Sep 29 07:49:10 pc savd: savscan.log: On-demand scan started.
Sep 29 07:49:27 pc savd: savscan.log: On-demand scan details: master boot records scanned: 0, boot records scanned: 0, files scanned: 6, scan errors: 0, threats detected: 1, infected files detected: 1
Sep 29 07:49:27 pc savd: Threat detected in /home/user/eicar.com: EICAR-AV-Test during on-demand scan. (The file is still infected.)
Sep 29 07:49:28 pc savd: savscan.log: On-demand scan finished.

オンデマンド検索
Sep 29 07:52:04 pc savd: Threat detected: EICAR-AV-Test in /home/user/eicar.com

ドキュメント

https://www.sophos.com/ja-jp/support/documentation/sophos-anti-virus-for-linux.aspx
https://www.sophos.com/ja-jp/medialibrary/PDFs/documentation/savl_9_sgeng.pdf
https://www.sophos.com/ja-jp/medialibrary/PDFs/documentation/savl_9_cgeng.pdf

2018年9月23日日曜日

インターネット回線速度計測

2018 Sep. 23.

# apt install speedtest-cli

メール送信システム ( postfix, mail ) インストールとgmailリレー送信設定

2018 Sep. 23.

こちらのページは無視してよい。

( https://blog.ymyzk.com/2017/06/postfix-smarthost-gmail/ より)

gmailアカウント

2段階認証プロセス:オフ
安全性の低いアプリの許可:有効

パッケージインストール


# apt install postfix bsd-mailx libsasl2-modules
  postfix設定問い合わせでは、Internet with smarthost を選択し、
  ”SMTP relay host” には [smtp.gmail.com]:587 を記述する

設定

/etc/postfix/sasl_passwd を次の1行の内容で作成する

[smtp.gmail.com]:587 gmailアカウント@gmail.com:パスワード
: をアカウントとパスワードで挟んだ書式)

# cd /etc/postfix
# chmod 600 sasl_passwd
# postmap /etc/postfix/sasl_passwd
 
/etc/postfix/main.cf に次の4行を追記する

smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_tls_security_options = noanonymous
 

postfix再起動

# systemctl restart postfix.service
 

メール送信

$ Msg="読めますか?\n2行目です。\n3行目です"
$ Title='メール試験'
$ MailDest="hoo@example.xx bar@example.yy"
$ echo -e "${Msg}" | mail -s `echo -e "${Title}" | nkf -jM` $MailDest
 
(下記のように本文をjisコードにすると文字化けした) 
$ echo -e "${Msg}" | nkf -j  | mail -s `echo -e "${Title}" | nkf -jM` $MailDest


確認

# tail -f /var/log/mail.log

crontab 編集エディタ設定

2018 Sep. 23.

$ EDITOR=vim
$ export EDITOR

2018年9月15日土曜日

ruby rbenv, bundlerでのアプリケーション実行

2018 Oct. 08.
2018 Sep. 15.

$ CmdPath=`find / -name 'RUBY.rb' -exec dirname {} \;`
$ pushd $CmdPath
$ rbenv exec bundle exec RUBY.rb
$ popd


cronで利用するときは、PATH, RUBYLIBの設定をcronに記載することを忘れないように

ruby 各プロジェクトでのbundler設定

2018 Sep. 15.

$ cd projectーdir
$ rbenv exec bundle init

$ vi Gemfile
  gem "sinatra"
  gem "pry"
  gem "mysql2"
  gem "OptionParser"
  gem "systemu"

$ rbenv exec bundle install --path vendor/bundle

複数のrubyプログラム間での調整

2018 Sep. 15.

dir-a/a.rb  <= 主たる実行ファイル
    require "b.rb"

dir-b/Gemfile
    gem "gem-a"

dir-b/b.rb  <= a.rbがrequireするファイル
    require "bundler"
    Bundler.require  <= require "gem-a" が行われる
 
  dir-a/Gemfile に gem-a を書き込んでgemをインストールし、
  dir-a/をカレントディレクトリとして起動すれば、
  実行できる。
  dir-b/ のGemfileにgem-aを書き込んでいるだけではloadエラーとなる。

  シェルスクリプト内での記載例
    SRCPATH=$(readlink -f `which RUBY.rb`)
    pushd $(dirname ${SRCPATH})
    rbenv exec bundle exec $SRCPATH
    popd

ruby gemファイルのrequire書式

2018 Sep. 15.


rubyスクリプトでの gemファイルのrequire の書き方

( http://shokai.org/blog/archives/7262 より)
プログラム内で
require 'bundler'
Bundler.require
と書くと、gemが一括requireできる。

rubyスクリプト renv環境でのシバン(先頭行)


2018 Sep. 15.




rbenv環境でのrubyスクリプトの1行目の書式

#!/usr/bin/env ruby

mysql ユーザー一覧

2018 Sep. 15.

mysql> select Host, User from mysql.user;

RTMPサーバー設置

2019 Jan. 04.
2018 Sep. 15.

nginxサーバーのrtmpモジュールをインストールし、/etc/nginx/nginx.conf を編集する。

rtmpモジュールパッケージインストール

# apt install libnginx-mod-rtmp



設定

( http://technical.live-on.net/archives/1423 より)

メディア配置ディレクトリ

任意のメディア配置ディレクトリに、 mp4またはflvファイルを配置する。
 例)/usr/local/nginx/mp4s;
   /usr/local/nginx/flvs;



/etc/nginx/nginx.conf 編集

## ここから ##
rtmp {
    server {
        listen 1935;

        # video on demand for flv files
        application vod {
           # live off; を入れる事で、rtmp://で直接ストリームが送られてくることを防ぐことができます。

            live off;
            play /usr/local/nginx/flvs;
        }

        # video on demand for mp4 files
        application vod2 {
            live off;
            play /usr/local/nginx/mp4s;
        }
    }
}

# 以下の http { } は書かなくても、以前からの設定で動いた。
# HTTP can be used for accessing RTMP stats
http {
    access_log /usr/local/nginx/logs/access-streaming.log;
    error_log /usr/local/nginx/logs/error-streaming.log;

    server {
        # in case we have another web server on port 80
        listen      80;

        location / {
            root   html;
            index  index.html index.htm;
        }

    }
}
## ここまで ##


1935ポート開放

# ufw allow proto tcp from 192.168.1.0/255.255.255.0 to any port 1935
# ufw allow proto udp from 192.168.1.0/255.255.255.0 to any port 1935
# ufw allow proto tcp from 10.8.0.0/24 to any port 1935
# ufw allow proto udp from 10.8.0.0/24 to any port 1935
# ufw reload

視聴

VLC Plyerで再生できるかを確認
  ネットワークストリームを開く
  rtmp://IPアドレス/vod2/MEDIA.mp4


  視聴できたが、早送り・巻き戻しができなかった


webプレーヤーで再生できるか確認
 <html>
<head>
   <link href="http://vjs.zencdn.net/5.11.6/video-js.css" rel="stylesheet">
   <script src="http://vjs.zencdn.net/5.11.6/video.js"></script>
</head>
<body>
   <video id="rtmp_test" class="video-js vjs-default-skin" autoplay="autoplay" controls="controls" width="800" height="450" data-setup="{}">
   <source src="rtmp:// IPアドレス/vod2/MEDIA.mp4" type="rtmp/mp4" />
</video>
</body>
</html>



以下、未実践

NGINX の configuration 設定

( https://ygoto3.com/posts/live-streaming-and-rtmp-for-frontend-engineers/ より)

rtmp://localhost:1935/live という URL で RTMP サーバに接続が可能にする

 (nginx.conf)
user nginx;
worker_processes 1;
daemon off;
events {
  ...
}

http {
  ...
}

rtmp {
    server {
        listen 1935;
        listen [::]:1935 ipv6only=on;

        application live {
            live on;
            record off;
        }
    }
}





HLS m3u8 サーバー設定

https://qiita.com/yo_dazy/items/e14464367ec8d4a26b6a より

画像ファイルの格納ディレクトリ作成とConfig設定

# mkdir /usr/local/nginx/html/movie
# chown nobody /usr/local/nginx/html/movie

 /usr/local/nginx/conf/nginx.conf 編集

rtmp {
    server {
        # Rtmp Port
        listen 1935;
        access_log logs/rtmp_access.log;
        application livet {
            live on;
            wait_video on;
            # IP を絞る場合以下の設定を有効化
            # allow publish 192.168.1.0/24;
            # deny publixh all;
            hls on;
            hls_path /usr/local/nginx/html/test2;
            hls_fragment 5s;
        }
        ####VOD In Add ########
        application vod {
           play /usr/local/nginx/html/movie; // 動画を格納するディレクトリを指定する
        #######################
        }
    }
}


nginx 起動確認
作業端末(インターネットに接続できる環境)より以下に接続
http://<「ストリーミングサーバ」のPublicIP>

 スマホで撮った動画をサーバに格納してファイル形式をMP4からm3u8に変換します。
 格納先は【5.[nginx.config]編集】で作成した動画格納ディレクトリになります
 格納した動画ファイルをHLSに変換します。

 # HLS 変換コマンド
#<動画ファイル2> :格納した動画ファイルから拡張子を抜いてください
ffmpeg -re -i 180320_100150.mp4<動画ファイル> -vcodec libx264 -vprofile baseline -acodec copy -ar 44100 -ac 1 -f segment -segment_format mpegts -segment_time 10 -segment_list 180320_100150<動画ファイル2>.m3u8 180320_100150<動画ファイル2>-%03d.ts

 コマンド実行前と実行後

#実行前
[root@WHSMINI movie]# ls /usr/local/nginx/html/movie
180320_100150.mp4
#実行後
[root@WHSMINI movie]# ls /usr/local/nginx/html/movie
180320_100150-000.ts  180320_100150-001.ts  180320_100150-002.ts  180320_100150.m3u8  180320_100150.mp4


[html]ファイル編集
WEB動画を配信させるページへのリンクページです。index.htmlを書き換えます。

# rm -rf /usr/local/nginx/html/index.html
# vi /usr/local/nginx/html/index.html


 index.html

<DOCTYPE html>
<html lang="en" class="">
<body>
<p>This Is Web Storeaming StartPage!!</p>
<hr>
<a href="vod.html">Video On Demand</a>
</body>


 [Video On Demand]ページの作成
vi /usr/local/nginx/html/vod.html

 vod.html

<DOCTYPE html>
<html lang="en" class="">
<head>
    <title>ONDEMAND</title>
    <link href="//vjs.zencdn.net/5.11/video-js.min.css" rel="stylesheet">
    <script src="//cdn.jsdelivr.net/hls.js/latest/hls.min.js"></script>

</head>
<body>
<p> Video On Demand </p>
<video id="video" class="video-js vjs-default-skin" width="640" height="480" controls>
<script type="text/javascript">
    // 変換した動画ファイルを指定します。
    var source = '/movie/180320_100150.m3u8';
    var ua = navigator.userAgent;
  // スマホからのアクセスか、それ以外のアクセスかを判断
    if (ua.indexOf('iPhone') > 0 || ua.indexOf('iPad') > 0 || ua.indexOf('Android') > 0) {
        // iOS
        document.write('<source src=' + source + ' type="application/x-mpegURL">');
        document.write('</video>');

    }else{
        // OTHER
        document.write('</video>');
        if(Hls.isSupported()) {
            var video = document.getElementById('video');
            var hls = new Hls();
            hls.loadSource(source);
            hls.attachMedia(video);
            hls.on(Hls.Events.MANIFEST_PARSED,function() {
                video.pause();
            });
        }
    }
</script>
</body>
</html>


2018年9月13日木曜日

ubuntu + nginx + mysql + php インストール

2018 Sep. 15.
2018 Sep. 13.


https://beautifulajax.dip.jp/?p=1825 より

関連ソフトインストール

# apt install nginx mysql-server
# systemctl start nginx
# apt install php php-fpm php-mysql php-gettext php-common php-mbstring php-mbstring

php設定

/etc/php/7.2/fpm/php.ini を編集する

  cgi.fix_pathinfo=0

/etc/php/7.2/fpm/pool.d/www.conf を編集する
  php_admin_value[memory_limit] = 128M

# service php7.2-fpm restart

nginx設定

 /etc/nginx/sites-available/default を編集する
  server {
  }
  の中に、下記を書き込む。

   # ディレクトリ内のファイル一覧を表示する場合
   autoindex on;

   location ~ \.php$ {
          try_files $uri =404;
          fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
          fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          include fastcgi_params;
   }



confファイルを編集する
 fastcgi_param PHP_VALUE "memory_limit = 128M";

 次の1行の内容の/var/www/html/phpinfo.phpファイルを作成する
  <?php phpinfo(); ?>


nginx起動

# systemctl restart nginx

http://NGINX-SERVER/xxx
"xxx" にでたらめな文字列を入れてhttp://NGINX-SERVERにアクセスし、nginxから404 Not Foundが送られてくることを確認する


404 Not Found


nginx/1.14.0 (Ubuntu)


http://NGINX-SERVER/phpinfo.php にアクセスしてphpinfo画面が表示されることを確認する 


mysqlインストール

http://rokkonet.blogspot.com/2018/09/mysql.html 




2018年9月9日日曜日

2018年9月2日日曜日

mysqlインストール

2019 Nov. 02.
2019 Oct. 14.
2019 Jan. 03.
2019 Jan. 02.
2018 Nov. 18.
2018 Sep. 15.
2018 Sep. 02.

インストール

# apt install mysql-server
続いて
# mysql_secure_installation
  質問にはすべて "y" でよい。

"$ mysql -p -u root" でログインできるようにする


"$ mysql -p -u root" でログインできない状態となっている。
"$ sudo mysql -p -u root" ならログインできる。
  
"$ mysql -p -u root" でログインできるようにする
( https://note.mu/junf/n/na40fbca9e6ea )
 
  $ sudo mysql -u root -p
  mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'PASSWORD';
  mysql> FLUSH PRIVILEGES; 
  別のターミナルを開いて sudo 無しでログインできるか確認する


利用文字コードをutf8にする。

/etc/mysql/conf.d/ に拡張子を".cnf"とする任意なファイル名で次の設定を記述

あるいは

 ~/.my.cnf に記述


  [client]
  # default-character-set = utf8 (設定すると日本語入力できない)

  [mysqld]
  character-set-server=utf8
    # default-character-set = utf8 ではmysqlが起動しない

  [mysqldump]
  default-character-set = utf8

  [mysql]
  # default-character-set = utf8 (設定すると日本語入力できない)

 

  確認

( www.jifu-labo.net/2015/09/ubuntu_epgrecuna/ より)
$ mysql -u root -p
   文字コードの設定に問題がないか確認。
   set_filesystemとsets_dir以外が全てutf8ならば問題ない。
  mysql> show variables like "char%";
  +--------------------------+----------------------------+
  | Variable_name            | Value                      |
  +--------------------------+----------------------------+
  | character_set_client     | utf8                       |
  | character_set_connection | utf8                       |
  | character_set_database   | utf8                       |
  | character_set_filesystem | binary                     |
  | character_set_results    | utf8                       |
  | character_set_server     | utf8                       |
  | character_set_system     | utf8                       |
  | character_sets_dir       | /usr/share/mysql/charsets/ |
  +--------------------------+----------------------------+
  8 rows in set (0.01 sec)


 EPGREC用設定

sql-modeの指定をしない(strict制約をしない)。sql_mode=''
・書き出し先ディレクトリ制約をしない。secure-file-priv = ""

[mysqld]
sql_mode=''
secure-file-priv = ""



ネットワーク(127.0.0.1 を含む)からのアクセスを許可する

/etc/mysql/ 内の設定ファイルに
skip-networking
の行があれば削除もしくはコメント化する。

外部からのにアクセスを許可する場合

アクセス許可するIPアドレス設定(bind-address = 0.0.0.0)

/etc/mysql.conf.d/mysqld.cnf の "bind-address = xxx.xxx.xxx.xxx" を修正する。
 すべてのIPアドレスからのアスセスを許可 ->  bind-address = 0.0.0.0
 localhostからのアクセスのみを許可 -> bind-address =127.0.0.1
 bind-addressを複数行記述すると最終行のみが有効。
 1行に、スペース区切りで複数アドレスを記述すると最初のアドレスのみが有効。
 "xxx.xxx.xxx." "xxx.xxx.xxx.0/24" "xxx.xxx.xxx.0/255.255.255.0" といった記述はできない。


/etc/hosts.allow 設定


  mysqld: ALL  (すべてのIPアドレスからのアクセスを許可)
  mysqld: 127.0.0.1  (localhostからのアクセスを許可)
  mysqld: 192.168.1.  (192.168.1/24からのアクセスを許可)

3306ポート開放

# ufw enable
# ufw allow 3306/tcp
# ufw allow 3306/udp

3306ポートをLISTENしているのを確認する。
$ netstat -na | grep 3306
$ mysql -h 127.0.0.1 -P 3306 -u root -p
 

PC shutdown時にmysqlが終了しない現象を防ぐ(ubuntu15.04以降)


システムシャットダウン時にmysqlを手動で止める?
# systemctl stop mysql.service && systemctl disable mysql.service


以下の対策では再発した。
shutdown時に"A stop job is running for MySQL Community Server" と表示され10分間停止してしまう現象への対処

( askubuntu.com/questions/615129/systemd-mysql-wont-stop より)
# chgrp mysql /etc/mysql/debian.cnf
# chmod 640 /etc/mysql/debian.cnf
# cp /lib/systemd/system/mysql.service /etc/systemd/system/
# chmod 755 /etc/systemd/system/mysql.service

/etc/systemd/system/mysql.service を編集する。
  [Service]セクションに次の行を書き込む。
    ExecStop=/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf shutdown

変更をsystemdに登録する。
  # systemctl daemon-reload

以下の対策はxubuntu16.04では改善されなかった。
( askubuntu.com/questions/615129/systemd-mysql-wont-stop より)
# cat /etc/mysql/debian.cnf
    password = xxxxx を確認する。

$ mysql -u root -p

mysql> GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'xxxxx' ;
mysql> flush privileges;

以下の対策はxubuntu16.04では改善されなかった。
  # cp /lib/systemd/system/mysql.service /etc/systemd/system/
  # chmod 755 /etc/systemd/system/mysql.service

OpenVPNインストール ルーティング方式 Easy-RSA3利用、TLS認証無し版

2019 Apr. 27.
2018 Oct. 07.
2018 Sep. 30.
2018 Sep. 27.
2018 Sep. 02.

インストール

こちら(https://qiita.com/noraworld/items/2fe6be489e1d93c748b8) を参照

 

 プログラムインストール

# apt install openvpn
$ cd ~/YOUR-WORK-DIR
$ git clone https://github.com/OpenVPN/easy-rsa.git
 

初期設定

$ cd ~/YOUR-WORK-DIR/easy-rsa/easyrsa3


$ ./easyrsa init-pki

 

 CA証明書生成

以後入力するパスフレーズはすべて同じにしておいた方が楽。
CA名称は "ホスト名+OS名" にした。 
$ ./easyrsa build-ca
$ sudo cp pki/ca.crt /etc/openvpn/

 

サーバ証明書生成

$ ./easyrsa build-server-full server nopass
$ sudo cp pki/issued/server.crt /etc/openvpn/
$ sudo cp pki/private/server.key /etc/openvpn/

 

DH鍵生成

$ ./easyrsa gen-dh
$ sudo cp pki/dh.pem /etc/openvpn/
 

クライアント証明書生成

$ ./easyrsa gen-crl
$ sudo cp pki/crl.pem /etc/openvpn/
$ sudo chmod o+r /etc/openvpn/crl.pem

 

サーバー設定ファイル記述

# touch /etc/openvpn/server.conf
 
/etc/openvpn/server.confを編集
###########
port   1194
proto  udp
dev    tun
 
cipher AES-256-CBC 
 
ca          ca.crt
cert        server.crt
key         server.key
dh          dh.pem
crl-verify  crl.pem

ifconfig-pool-persist ipp.txt

server 10.8.0.0 255.255.255.0

push "redirect-gateway def1 bypass-dhcp"
push "route 10.8.0.0 255.255.255.0"
push "dhcp-option DNS 8.8.8.8"

client-to-client
keepalive 10 120
comp-lzo

user  nobody
group nogroup

persist-key
persist-tun

status      /var/log/openvpn-status.log
log         /var/log/openvpn.log
log-append  /var/log/openvpn.log

verb 3 
###########


 

ファイアウォール設定

# ufw allow 1194/udp
# ufw reload
 

IPフォワーディング設定

 /etc/default/ufw を編集する
  DEFAULT_FORWARD_POLICYをDROPからACCEPTに変更する
    - DEFAULT_FORWARD_POLICY="DROP"
    + DEFAULT_FORWARD_POLICY="ACCEPT"
 
 IPフォワーディングを有効化
  /etc/ufw/sysctl.confを編集する
   net.ipv4.ip_forward=1の一行をアンコメントする
    - # net.ipv4.ip_forward=1
    + net.ipv4.ip_forward=1
 

IPマスカレード有効化

 ifconfigでネットワークポート名を確認する( enp0s7 とか)

 /etc/ufw/before.rulesを編集する
  一番下の行にCOMMITと書かれているはずなので、この下に以下を追加する
   COMMIT
   +
   + *nat
   + :POSTROUTING ACCEPT [0:0]
   + -A POSTROUTING -s 10.8.0.0/24 -o enp0s7 -j MASQUERADE
   + COMMIT
 
 # ufw reload
 
Logローテーション設定
こちら 

 

OpenVPN起動

# systemctl start openvpn@server
もしくは
# systemctl start openvpn

 起動確認
 $ ps ax -f | grep openvpn | grep -v grep
 
 $ systemctl status openvpn@server
 もしくは
 $ systemctl status openvpn
 
  Active: active (running) の表示を確認する
 

OpenVPN自動起動設定

# systemctl disable openvpn && systemctl enable openvpn@server
もしくは
# systemctl disable openvpn@server && systemctl enable openvpn
 
  確認 
   $ systemctl is-enabled openvpn openvpn@server
 

クライアント用秘密鍵の生成

$ cd ~/YOUR-WORK-DIR/easy-rsa/easyrsa3 
$ ./easyrsa build-client-full HOGE
  HOGEは "サーバー名+サーバーOS+クライアント端末名" とした。
  「$ ./easyrsa build-client-full HOGE nopass」とすれば接続時パスワード不要。
 
$ mkdir ~/CLIENT-FILE-DIR
$ sudo cp /etc/openvpn/ca.crt ~/CLIENT-FILE-DIR/
$ cp pki/issued/HOGE.crt ~/CLIENT-FILE-DIR/
$ cp pki/private/HOGE.key ~/CLIENT-FILE-DIR/
$ sudo chown USER:USER ~/CLIENT-FILE-DIR/ca.crt
$ chown USER:USER ~/CLIENT-FILE-DIR/HOGE.crt
$ chown USER:USER ~/CLIENT-FILE-DIR/HOGE.key
  USER: VPNサーバに現在ログインしているユーザのユーザ名 
 

接続するクライアントに鍵ファイルをダウンロード

$ scp ~/CLIENT-FILE-DIR/ca.crt CLIENT
$ scp ~/CLIENT-FILE-DIR/HOGE.crt CLIENT
$ scp ~/CLIENT-FILE-DIR/HOGE.key CLIENT
 


設定

WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this

This is nothing to worry about.
https://support.hidemyass.com/hc/en-us/articles/202720436-Auth-nocache-Warning-in-OpenVPN-connection-log


WARNING: cipher   local='cipher BF-CBC'  remote='cipher AES-256-CBC'

クライアントの暗号化方式を AES-256-CBS に指定する。
参考サイト


VPN経由でアクセスするLAN内の各種サーバーの設定

http://rokkonet.blogspot.com/2018/05/openvpn.html


OpenVPNに関する用語


2018 Sep. 02.



 https://wiki.parabola.nu/Easy-rsa より

PKI : a Public Key Infrastructure

 a Public Key Infrastructure (PKI) consists of:
    a public master Certificate Authority (CA) certificate and a private key;
    a separate public certificate and private key pair for each server;
    a separate public certificate and private key pair for each client.

easy-rsa
    It initialize a new PKI and generate a CA keypair that will be used to sign certificates.

ubuntu17.10以降のnetwork設定

2018 Sep. 02.

https://qiita.com/zen3/items/757f96cbe522a9ad397d より

設定変更

/etc/netplan/xxx.yamlを編集する。
 network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.1.70/24]
      gateway4: 192.168.1.1
      nameservers:
        addresses: [192.168.1.1, 8.8.8.8, 8.8.4.4]

設定反映

$ netplan apply

nfsサーバーインストール

2018 Sep. 02.

# apt install nfs-kernel-server

/etc/exports設定
  /DIR 192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check)

ファイアウォール設定
  portmapper: 111/tcp, 111/udp
  nfs: 2049/tcp, 2049/udp

  # ufw allow proto tcp from 192.168.1.0/255.255.255.0 to any port 111
  # ufw allow proto udp from 192.168.1.0/255.255.255.0 to any port 111
  # ufw allow proto tcp from 192.168.1.0/255.255.255.0 to any port2049
  # ufw allow proto udp from 192.168.1.0/255.255.255.0 to any port2049
  # ufw reload

HDDパーティションのUUIDの確認とUUIDを使ったマウント

2018 Sep. 02.

ハードディスクパーティションのUUID確認
# blkid /dev/sda1

パーティションのマウント
# mount UUID=YOUR-PARTITION-UUID /DIR
  UUIDを引用符で囲まない。


2018年9月1日土曜日

android emulatorをqemu kvm で動かす

2018 Sep. 02.
2018 Sep. 01.

・# apt install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils virtinst cpu-checker

  インストール結果確認
   # kvm-ok
   INFO: /dev/kvm exists
   KVM acceleration can be used

・kvmグループにユーザーを追加する

・# chown USER:kvm /dev/kvm
 もしくは
 # chmod a+x /dev/kvm

apt パッケージ更新禁止設定

2018 Sep. 01.

dpkg –set-selections での設定
 https://server-setting.info/debian/debian-no-apt-upgrade.html

pinでの設定
 https://server-setting.info/debian/debian-no-apt-upgrade.html

 https://yoheikikuta.github.io/ubuntu-kernel/

apt-mark hold での設定
 https://teratail.com/questions/108796

xfce4 ウィンドウを前面に出さずにマウスでスクロール可能で、ウィンドウをクリックしたらフォーカスを得る設定

2018 Sep. 01.

メニュー→設定→ウィンドウマネージャー→フォーカス→
フォーカスモデル→「クリックでフォーカス」にチェックを入れる

メニュー→設定→ウィンドウマネージャー→フォーカス→
フォーカスで前面に出す→「ウィンドウがフォーカスを取得した場合自動的に前面に出す」にチェックを入れる

systemdによる時刻合わせ

2019 Jun. 22.
2018 Sep. 01.

NTPクライアント機能を有効化
# timedatectl set-ntp true

設定ファイル
/etc/systemd/timesyncd.conf
  NTP=ntp.nict.jp
  FallbackNTP=ntp.ubuntu.com  # 予備サーバー


 
再起動
# systemctl restart systemd-timesyncd.service
 
確認
$ systemctl -l status systemd-timesyncd
もしくは 
$ timedatectl