2017年11月15日 星期三

[電子發票] 電子發票串接財政部回復錯誤訊息:javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated



此錯誤訊息為財政部需要回傳資料到return url.發現憑證與domain不match或是handsharking不過造成.

解決方式:
                調整Apache Web server 設定 SSL的protocols及Cipher Suite.
             
                到https://www.ssllabs.com/ssltest/測試調整結果.

                Java 6u45  至少要可以handshake通過

2017年6月11日 星期日

[CentOS 7.1 1503] install ssh


yum install openssh openssh-server openssh-clients openssl-libs
You might have selinux enabled. Try
getenforce
If it shows "Enforcing", try
setenforce 0

2017年3月26日 星期日

ubuntu install security updates

1.su to root
   su

2.Show security updates only
   apt-get -s dist-upgrade | grep "^Inst" | grep -i securi | awk -F " " {'print $2'} | xargs apt-get install

3.Install security updates only
   apt-get -s dist-upgrade | grep "^Inst" | grep -i securi | awk -F " " {'print $2'} | xargs apt-get install

2017年3月23日 星期四

ubuntu install MongoDB



1.開啟最高權限
    sudo su

2.更新package list
   apt-get update

3.安裝 mongodb
    apt-get install mongodb

4.啟用/停用 mongodb
   service mongodb start
   service mongodb stop

5.進入/離開 mongodb shell
   mongo
   exit

6.版本檢查
  mongod --version

7.移除mongodb
    沒指定版本安裝會是舊版的 2.x
    sudo apt-get remove mongodb* --purge 
   
    sudo rm -r /var/log/mongodb
  sudo rm -r /var/lib/mongodb

以下為指定版本安裝(參考官方https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/)

1.Import the public key used by the package management system.

   sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

2.Create a list file for MongoDB.
   Create the /etc/apt/sources.list.d/mongodb-org-3.4.list list file using the command appropriate for your version of Ubuntu:


   Ubuntu 12.04
   echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

   Ubuntu 14.04
    echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

    Ubuntu 16.04
    echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list


3.Reload local package database.
   sudo apt-get update

4.Install the MongoDB packages
   sudo apt-get install -y mongodb-org

5.Start MongoDB.
   sudo service mongod start

6.Verify that MongoDB has started successfully
    check /var/log/mongodb/mongod.log for following line if included
   [initandlisten] waiting for connections on port <port>
7.Stop MongoDB.
    sudo service mongod stop

8.Restart MongoDB.
     sudo service mongod restart

9.version check
     mongod --version


檔案位置
    設定檔
   /etc/mongod.conf

    資料庫
  /var/lib/mongodb

      日誌檔
      /var/log/mongodb/mongodb.log







ubuntu vsftp

1.install vsftp
   sudo apt-get update
sudo apt-get install vsftpd

2.add firewall rule
   ...

3.change current user's home directory
     edit /etc/passwd

4.user accout add to www-data group
  sudo usermod -a -G www-data username
  sudo chgrp -R www-data /var/www/html
 sudo chmod -R g+w /var/www/html


5. edit /etc/vsftpd.conf

  chroot_local_user=YES
  local_umask=022