Submit Search
Upload
Ch17 secure-password
•
0 likes
•
312 views
Chatchai Jantaraprim
Follow
วิธีการ สร้าง และ ใช้ password ที่มีความปลอดภัยสูง
Read less
Read more
Report
Share
Report
Share
1 of 28
Download now
Download to read offline
Recommended
Ch11 web-app
Ch11 web-app
Chatchai Jantaraprim
Ch10 web servers
Ch10 web servers
Chatchai Jantaraprim
Ch15 elastic hosts-svradmin
Ch15 elastic hosts-svradmin
Chatchai Jantaraprim
CompTIA Linux+
CompTIA Linux+
Matthew Shellhart
Ch12 web-app-part2
Ch12 web-app-part2
Chatchai Jantaraprim
Editors for-linux
Editors for-linux
Chatchai Jantaraprim
Ch01 administrators-tasks
Ch01 administrators-tasks
Chatchai Jantaraprim
Virtualbox networking
Virtualbox networking
Chatchai Jantaraprim
Recommended
Ch11 web-app
Ch11 web-app
Chatchai Jantaraprim
Ch10 web servers
Ch10 web servers
Chatchai Jantaraprim
Ch15 elastic hosts-svradmin
Ch15 elastic hosts-svradmin
Chatchai Jantaraprim
CompTIA Linux+
CompTIA Linux+
Matthew Shellhart
Ch12 web-app-part2
Ch12 web-app-part2
Chatchai Jantaraprim
Editors for-linux
Editors for-linux
Chatchai Jantaraprim
Ch01 administrators-tasks
Ch01 administrators-tasks
Chatchai Jantaraprim
Virtualbox networking
Virtualbox networking
Chatchai Jantaraprim
Learn docker in 90 minutes
Learn docker in 90 minutes
Larry Cai
Ch09 mail-systems-part2
Ch09 mail-systems-part2
Chatchai Jantaraprim
Shipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with Docker
Jérôme Petazzoni
A Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things Containers
Jérôme Petazzoni
Why Docker
Why Docker
dotCloud
Docker introduction
Docker introduction
dotCloud
Docker from A to Z, including Swarm and OCCS
Docker from A to Z, including Swarm and OCCS
Frank Munz
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
LinkedIn
The Future of Everything
The Future of Everything
Charbel Zeaiter
Ch08 mail-systems
Ch08 mail-systems
Chatchai Jantaraprim
Ch07 bind9-part2
Ch07 bind9-part2
Chatchai Jantaraprim
Ch06 bind9
Ch06 bind9
Chatchai Jantaraprim
Ch04 linux-hosting-vps
Ch04 linux-hosting-vps
Chatchai Jantaraprim
Ch05 name-services
Ch05 name-services
Chatchai Jantaraprim
Ch03 domain-registration
Ch03 domain-registration
Chatchai Jantaraprim
Ch02 administrators-tasks
Ch02 administrators-tasks
Chatchai Jantaraprim
More Related Content
Viewers also liked
Learn docker in 90 minutes
Learn docker in 90 minutes
Larry Cai
Ch09 mail-systems-part2
Ch09 mail-systems-part2
Chatchai Jantaraprim
Shipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with Docker
Jérôme Petazzoni
A Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things Containers
Jérôme Petazzoni
Why Docker
Why Docker
dotCloud
Docker introduction
Docker introduction
dotCloud
Docker from A to Z, including Swarm and OCCS
Docker from A to Z, including Swarm and OCCS
Frank Munz
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
LinkedIn
The Future of Everything
The Future of Everything
Charbel Zeaiter
Viewers also liked
(9)
Learn docker in 90 minutes
Learn docker in 90 minutes
Ch09 mail-systems-part2
Ch09 mail-systems-part2
Shipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with Docker
A Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things Containers
Why Docker
Why Docker
Docker introduction
Docker introduction
Docker from A to Z, including Swarm and OCCS
Docker from A to Z, including Swarm and OCCS
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
The Future of Everything
The Future of Everything
More from Chatchai Jantaraprim
Ch08 mail-systems
Ch08 mail-systems
Chatchai Jantaraprim
Ch07 bind9-part2
Ch07 bind9-part2
Chatchai Jantaraprim
Ch06 bind9
Ch06 bind9
Chatchai Jantaraprim
Ch04 linux-hosting-vps
Ch04 linux-hosting-vps
Chatchai Jantaraprim
Ch05 name-services
Ch05 name-services
Chatchai Jantaraprim
Ch03 domain-registration
Ch03 domain-registration
Chatchai Jantaraprim
Ch02 administrators-tasks
Ch02 administrators-tasks
Chatchai Jantaraprim
More from Chatchai Jantaraprim
(7)
Ch08 mail-systems
Ch08 mail-systems
Ch07 bind9-part2
Ch07 bind9-part2
Ch06 bind9
Ch06 bind9
Ch04 linux-hosting-vps
Ch04 linux-hosting-vps
Ch05 name-services
Ch05 name-services
Ch03 domain-registration
Ch03 domain-registration
Ch02 administrators-tasks
Ch02 administrators-tasks
Ch17 secure-password
1.
Linux Server Admin
Elastichosts Server Admin 3 Chatchai J 2013-02-04
2.
ก่อนอื่น ●
ผมเคยทำำให้คุณดูเป็ นตัวอย่ำง ● กำรใช้งำน MySQL กำำหนด password สำำหรับ MySQL admin account login: root password: root ● นั่นเป็ นสิ่งทีผิด ่
3.
ก่อนอื่น (ต่อ) ●
เป็ นตัวอย่ำงที่ไม่ดี เป็ นสิ่งที่ไม่สมควรทำำ ● เป็ นควำมผิดของผมเอง ● ขอโทษด้วยครับ
4.
Password ●
นับแต่นเป็ นต้นไป ี้ ● ขอให้ใช้ secure password ● สำำหรับ ทุกกรณี
5.
ปั ญหำของ secure
password ● ถ้ำใช้ควำมจำำ สำำหรับจำำ password โดยตรง Secure password จะจำำยำก ทำำให้เลือก password ที่จำำง่ำย ทำำให้ถูกโจมตีได้ง่ำย ● เพรำะ ฉะนั้น ให้จดลงใน เศษกระดำษ ● เก็บไว้ในกระเป๋ ำสตำงค์ (หลีกเลี่ยงกำรเก็บเป็ นไฟล์/email)
6.
วิธีกำรสร้ำงและเก็บ password ●
เครื่องมือ pwgen, sharutils $ sudo aptget install pwgen sharutils ● สร้ำง password ยำว 12 ตัวอักษร โดยใช้ pwgen $ pwgen s 12 1 ● จะได้ string ขนำด 12 ตัวอักษร ซึ่งสำมำรถเอำไปใช้เป็ น password ได้ทนที ั
7.
password (cont) ●
ซึ่ง ไม่แนะนำำ ให้ใช้ อย่ำงนั้น ● เรำต้องกำร password จำำนวนหลำยชุด – root's password – admin's (e.g. – cj) password – mysql admin's password ● ทั้งหมดควรจะเป็ น password คนละตัวกัน ● ถ้ำเกิด password ตัวใดตัวหนึ่ง หลุดรอดไป (ถ้ำไม่ใช่ root password) ทีเหลือก็จะยังปลอดภัย ่
8.
password (cont) ●
แต่ถ้ำจะสร้ำง password ใหม่ท้ ังหมด สำำหรับ แต่ละ account ก็จะต้องกำร กำรจดบันทึก จำำนวนมำก (password อะไร สำำหรับ อะไร) ● หรือไม่ หลำยคน ก็จะเลือกใช้ password เดียวกัน สำำหรับแก้ปัญหำ ซึ่งไม่ดี
9.
password (cont) ●
วิธีกำร ใช้ string ทีได้มำ เป็ นชุด string ตั้งต้น ่ ● แล้วสร้ำง password ทีเหลือ จำก string ชุดนั้น ่ ● โดยใช้วิธีกำรร่วมกัน กำรจดบันทึก ● แนะนำำให้ใช้ string เริมต้นขนำด 16 อักษร ่ ● แต่ถ้ำยำวกว่ำนั้นได้กยิ่งดี ็ $ pwgen s 16 1
10.
password (cont)
$ pwgen 16 1 sie3ooF5ahWei0ee ● วิธีกำรจด ใน กระดำษ s i e 3 o o F 5 a h W e i 0 e e
11.
password (cont) ●
สำำหรับกำรป้ องกันโจมตีแบบ brute force attack ปั จจุบัน ควำมยำวไม่ควรตำ่ำกว่ำ 10 ● สมมติเลือก password ยำว 12 ตัวอักษร สำำหรับ ทุกกรณี ● เลือก pattern ของ password สำำหรับ แต่ละ account
12.
password (cont)
13.
password (cont) ●
จะได้ root's password = “sie35eee0iao” admin's password = “sie35FooahWe” mysql's password = “sie3FhiOeewo” ● Password จะมีควำม secure สูงขึ้น ถ้ำ – ไม่ได้เริ่มต้นที่บรรทัดแรก – ไม่ได้เรียงจำกซ้ำยไปขวำ
14.
และที่สำำคัญ ●
อย่ำทำำกระดำษทีจดเอำไว้หำย ่ ● password ทีสร้ำงขึ้นด้วย pwgen เป็ นแบบ pseudo-random ่ ● ซึ่งในกรณีนี้ เทียบเท่ำกับ true random ● ไม่สำมำรถก้คนมำได้อีก ู ื ● ถ้ำกระดำษทีจดไว้หำย และ ลืม password ่ ● ก็จะไม่มทำงก้คนมำได้ ี ู ื
15.
ถ้ำต้องกำรกู้คืน ●
เปลียนวิธีกำรสร้ำง string เริมต้นจำกกำรใช้ pwgen ่ ่ ● เป็ นวิธีกำรอื่น ซึ่ง – สำมำรถทำำซำ้ำได้ และ – ได้ผลเหมือนเดิม ● แต่ผลลัพธ์จะต้องใกล้เคียงกับกำร ● random เพื่อสร้ำง string
16.
message digest ●
เครื่องมือบน linux สำำหรับ digest message – md5sum – shasum -a {1,224,256,384,512} ● สร้ำง sum string จำก message ใดๆ ● ถ้ำ message เปลี่ยนไปผล sum จะเปลี่ยนไป
17.
ทดลอง ●
กำรทดลอง ทั้งหมด ให้ทำำบน VM บน local (notebook) $ echo “a” | md5sum $ echo “hello” | md5sum $ echo “Hello” | md5sum $ echo “How are you doing?” | md5sum $ cat /etc/passwd | md5sum ● เปลียนจำก md5sum เป็ น shasum a 1 ่ ● หรือ shasum a 224 (เป็ นต้น)
18.
message digest $ echo "a" | md5sum 60b725f10c9c85c70d97880dfe8191b3 $ echo "a" | sha1sum 3f786850e387550fdab836ed7e6dc881de23001b $ echo "a" | shasum a 256 87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7 $ echo "a" | shasum a 512 162b0b32f02482d5aca0a7c93dd03ceac3acd7e410a5f18f3fb990fc958ae0df6f32233 b91831eaf99ca581a8c4ddf9c8ba315ac482db6d4ea01cc7884a635be $ echo "hello" | md5sum b1946ac92492d2347c6235b4d2611184 $ echo "Hello" | md5sum 09f7e02f1290be211da707a266f153b3
19.
เพิ่ม security ●
ตัวอักษรที่ได้จำก XXXsum จะมี 'a'-'z','0'-'9' ● ถ้ำมีควำมยำวมำกพอ ก็จะเพิ่ม security ได้ ● แต่เรำสำมำรถสร้ำง output string ที่มีตัวอักษร หลำก หลำยมำกขึ้นได้ โดยกำรใช้ เครื่องมืออื่นเพิ่ม – base64 – uuencode
20.
เพิ่ม security (ต่อ)
$ echo “a” | shasum a 256 | base64 $ echo “a” | shasum a 512 | uuencode x $ echo "a" | shasum a 256 | base64 ODc0MjhmYzUyMjgwM2QzMTA2NWU3YmNlM2NmMDNmZTQ3N TA5NjYzMWU1ZTA3YmJkN2EwZmRlNjBjNGNmMjVjNyAgLQ o= $ echo "a" | shasum a 512 | uuencode x begin 644 x M,38R8C!B,S)F,#(T.#)D6%C83!AV,Y,V1D,#C96%C,V%C9#=E#$P835F M,3AF,V9B.3DP9F,Y3AA93!D9C9F,S(R,SB.3$X,S%E868Y.6A3@Q83AC J&1D9CEC.&)A,S$U86,T.#)D8C9D&5A,#%C8S<X.#1AC,U8F4@("T* ` end
21.
วิธกำรเอำไปใช้
ี ● เก็บ “string” เริ่มต้น (“a”, “hello”) เป็ นควำมลับ สูงสุด ● เก็บ วิธกำร digest และ encode ทีเลือกใช้เป็ นควำมลับ ี ่ ● เลือกตำำแหน่งเริ่มต้นของ output string ทีเอำมำใช้เป็ นควำมลับ (ไม่ ่ จำำเป็ นจะต้องเริ่มที่ 1) ● แต่ท้ งหมดนั้น จะต้องไม่ลม ั ื ● ถ้ำลืม วิธีกำรทีว่ำมำทั้งหมด ก็ไม่มประโยชน์ ให้กลับไปใช้ ่ ี pwgen -s 16 1 แทนก็จะไม่เสียเวลำ
22.
วิธีกำรเอำไปใช้ (ต่อ) ●
ถ้ำจำำเป็ น ● แยกจด / แยกเก็บ ● string เริ่มต้น, วิธีกำร sum, วิธีกำร encode จดใส่กระดำษ เก็บร่วมกับ ใบสูตบัตร, เอกสำร ิ สำำคัญอื่นๆ ที่ “หำยไม่ได้” แต่ นำนๆใช้ที
23.
วิธีกำรเอำไปใช้ (ต่อ) ●
output string สำำหรับ password จดใส่กระดำษ เก็บในกระเป๋ ำสตำงค์ เก็บบัตรประจำำตัวประชำชน หรือ เอกสำรสำำคัญ ชนิดอื่นๆ ทีใช้งำนบ่อย ่ ● pattern ของกำรเลือก password จำก output string ที่เก็บในกระเป๋ ำสตำงค์ จำำ – ใช้งำนบ่อย ไม่จำำเป็ นต้องเปลี่ยนบ่อย จะจำำได้เอง
24.
หมำยเหตุ: ●
ทุกคำำสั่งที่คุณพิมพ์ บน linux และใช้งำน bash เป็ น shell จะเก็บอยู่ใน .bash_history ● เมื่อ logout ● กำำหนดโดย HISTFILE $ echo $HISTFILE
25.
หมำยเหตุ: (cont) ●
วิธีกำรไม่ให้บันทึก $ HISTFILE=/dev/null $ exit ● เพื่อให้ string เริ่มต้น, วิธกำร digest, วิธีกำร ี encode เป็ นควำมลับ
26.
กำรเปลียน password
่ ● password root และ admin account ใช้ $ sudo passwd root $ sudo passwd admin
27.
กำรเปลียน password (cont)
่ ● สำำหรับ mysql admin's password term1:~$ sudo service mysql stop term1:~$ sudo mysqld –skipgranttables term2:~$ mysql term2 mysql> update mysql.user set password=PASSWORD('*************') where user='root'; term2 mysql> exit; term1:~$ CTRL+''
28.
กำรเปลียน password (cont)
่ ● คำำสั่งที่ใช้บน mysql client จะเก็บไว้ใน .mysql_history $ cat .mysql_history $ rm f .mysql_history
Download now