2016年12月4日 星期日

How to add certificate for SSL


I just joined a Hackthon recently, here is the node how I solve some problems.


1. check the certificate from a Web

$keytool -printcert -sslserver 10.2.5.2

2. get the certificate chain

$keytool -printcert -sslserver 10.2.5.2 -rfc

3. copy the message between header and footer in .crt file (ex. vm1.crt)

-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-------

4. add the certificate in client's truststore

$keytool -import -file vm1.crt -alias vm1 -keystore xxx.truststore

($ input the password of keystore)

5. check the list of certificate you just added into truststore

$keytool -list -v -keystore xxx.truststore






REFER
http://doc.akka.io/docs/akka/2.4.4/scala/http/client-side/https-support.html

http://typesafehub.github.io/ssl-config/WSQuickStart.html#connecting-to-a-remote-server-over-https

https://docs.oracle.com/cd/E19509-01/820-3503/6nf1il6er/index.html

http://www.ibm.com/developerworks/library/j-customssl/sidebar.html

http://how2ssl.com/articles/working_with_pem_files/


http://stackoverflow.com/questions/8640340/how-do-i-get-into-a-non-password-protected-java-keystore-or-change-the-password




2016年11月8日 星期二

web cam server


Whole project come from
https://pimylifeup.com/raspberry-pi-webcam-server/


1. install "ffmpeg"
http://www.deb-multimedia.org/
http://ffmpeg.org/

2. install  "libjpeg-turbo" for JPEG support
http://www.libjpeg-turbo.org/
http://www.linuxfromscratch.org/blfs/view/svn/general/libjpeg.html

3. install "motion"
https://github.com/Motion-Project/motion

4. enable /dev/video0
http://raspberrypi.stackexchange.com/questions/10480/raspi-camera-board-and-motion
$sudo modprobe bcm2835-v4l2

5. allow stream to other computer
$vim motion-dist.conf
replace "stream_localhost off" by "stream_localhost on"

5. execute motion camera server
$cd ~/mmal/motion-master
$sudo ./motion -n -c motion-dist.conf

6. link to web server by broswer
ex. IP:8081 (default port)
192.168.x.x:8081

7. you could also set up authentication for user to log in server
In motion-dist.conf

set  "stream_auth_method 2"
set  "stream_authentication username:password"




some open source

http://www.jvcref.com/files/PI/documentation/html/
https://www.ffmpeg.org/

camera available function from official web
https://www.raspberrypi.org/blog/camera-board-available-for-sale/

!!! RPi-cam-web-interface
http://elinux.org/RPi-Cam-Web-Interface

!!! pi car
https://github.com/shaunuk/picar

Find my raspberry on nerwork



https://www.raspberrypi.org/documentation/remote-access/ip-address.md



ex.
nmap -sn 192.168.1.0/24

1. Install namp in my Mac air

install brew first
http://brew.sh/index_zh-tw.html

install by brew
$brew install nmap

2016年10月9日 星期日

Set up network

1. network setting

 (1) /etc/network/interfaces

=====

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

=====

(2) /etc/wpa_supplicant/wpa_supplicant.conf

=====

network={
        ssid="mySSID"
        psk="myPASSWD"
}

=====

(3) restart network interface

$ sudo ifdown wlan0
$ sudo ifup wlan0

=====

2. useful command

(1) ifconfig

(2) iwconfig

(3) sudo dhclient

(4) route -n

ex. route add default gw 192.168.1.1

(5) /etc/init.d/networking restart

(6) sudo ifdown/ifup wlan0





REFER

https://www.raspberrypi.com.tw/2152/setting-up-wifi-with-the-command-line/

http://raspberrypi.stackexchange.com/questions/14101/connect-network-is-unreachable-on-a-working-connected-wlan0-interface


http://www.cyberciti.biz/faq/linux-setup-default-gateway-with-route-command/

2016年10月8日 星期六

Screen "Out of Range"

I use VGA adapter for HDMI port, but I got no signal on screen.
After Google for a while, I found it is caused that my screen is too old, and can not accept the frame over size.

After dd raspberr pi image from computer to SD card,
change the following config in config.txt from system files.

hdmi_group=2
hdmi_mode=16
hdmi_drive=2

hdmi_force_hotplug=1
config_hdmi_boost=4


you could also refer the wiki to have different config on various monitor resolution: http://elinux.org/RPiconfig

REFER:
http://www.arthurtoday.com/2014/05/raspberry-pi-hdmi-to-vga-how-to.html