![Page 1: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/1.jpg)
桃園區網 : 伺服主機與網路檢查系統 (Version 2.0)
中央大學電算中心 楊素秋2010.10
![Page 2: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/2.jpg)
綱要
• 1. 伺服主機與網路檢查系統• 2. SVRCHK Ver-1.0 檢測系統• 3. SVRCHK Ver-1.1 檢測系統• 4. SVRCHK Ver-2.0 檢測系統• 5. SVRCHK 程式及 Data table• 6. 總結
![Page 3: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/3.jpg)
1. 伺服主機與網路檢查系統•沿由
– 系統與網路檢查紀錄表 (ISMS 認證需求 )• Tyrc : for ISMS 認證 (2009)
![Page 4: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/4.jpg)
2.SVRCHK Ver-1.0 檢測系統
• SVRCHK 檢測方法–檢測次數 : 1 time/day
•File id. by $year/$month/$mday/$srv_name–檢測工具
•Router : ping•DNS : dig•WWW : wget, socket-port•Proxy: curl
– User Interface•JSP + Java (Tomcat)
![Page 5: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/5.jpg)
3. SVRCHK Ver-1.1 檢測系統
• Ver-1.1 檢測範圍– Tyrc, Ncu_cc, Ncuad, Ncu_rd – NCU Computer Center ISMS 認證 (2010)
• Ver-1.1 檢測方法– 略同 Ver-1.0– 伺服系統種類大幅增加
• Router, DNS, WWW, MRTG 流量• Portal, 電子表單 , BlackBoard, MS-SQL, MySQL• SMTP, PoP3, IMAP, Proxy, News,• VMware,LDAP, DHCP, NFS• 帳號管理 , NIS (Network Information System )• Others
![Page 6: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/6.jpg)
3. SVRCHK Ver-1.1 檢測系統 (cont.)
•檢測工具•Router : ping•DNS : dig•WWW : wget, Nmap (socket-port)•Proxy: curl, Nmap•SMTP, News, pop3 : expect•MS_SQL, MySQL: expect, Nmap•DHCP : ping, Nmap•VMware : Nmap
![Page 7: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/7.jpg)
3. SVRCHK Ver-1.1 檢測系統 (cont.)
•檢測小撇步– Service status collection 時間長
•部分 Server 回應時間頗長•status collection 時間提早些
–檢測方法•精簡 (Nmap)•確實 (expect, wget, curl)
– Security filter (Transit 繞道 )– 問題點 (transit? / target?)
![Page 8: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/8.jpg)
![Page 9: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/9.jpg)
#!/bin/bashRSYNC=/usr/bin/rsyncLOCALPATH=/home/yang## Susan 2010-01-29 :: News Test OK!VAR=$(expect -c"spawn telnet 140.115.17.34 110#send \"telnet 140.115.17.34 110\r\"expect +OKsend \"USER center7\r\"expect +OKsend \"PASS xxxxxxxx\r\"expect +OKsend \"STAT \r\"expect +OKsend \"QUIT \r\"expect -timeout 1")echo "$VAR"
Example: SMTP service data collection script
![Page 10: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/10.jpg)
#!/bin/bashRSYNC=/usr/bin/rsyncLOCALPATH=/home/yang## Susan 2010-01-29 :: News Test OK!VAR=$(expect -c"spawn ssh [email protected] yes/nosend \"yes\r\"#expect password:send \“XXXXXX\r\"expect \"\\\\$\"send \"telnet 140.115.X.X 119\r\"send \" help\r\"expect -timeout 1")echo "$VAR"
Example: News service data collection script
![Page 11: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/11.jpg)
4. SVRCHK Ver-2.0 檢查系統• Ver-2.0 改善需求
–增加檢測次數•早 /午 /晚 or 每小時一次
– 統計 G 次數– 提供細部資訊查詢
– User Interface•伺服系統由 user 線上鍵入•管理員認證後 ,自動偵測
– Database 查詢•File : $year/$month/$mday -> DB
![Page 12: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/12.jpg)
4. SVRCHK Ver-2.0 檢查系統 (cont.)
• Ver-2.0 檢測– Tyrc, Ncu_cc, Ncuad, Ncu_rd – 管理自動化
• Dynamic created by user/manager– Server Registered by user– Server conformed by manager
– 安全性考量• Spring Security
– User authentication – User authorization
– Database 查詢
![Page 13: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/13.jpg)
4. S VRCHK Ver-2.0 檢查系統 (cont.)
• SVRCHK Ver-2.0 檢查系統– A.User Login
•Spring Security– Authentication (user,passwd,enable)– Authorization (role)
– B.Server Registeration– http://140.115.11.133/simple-svrchk– {id, hostname, hostip,port, email, creadted}
![Page 14: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/14.jpg)
![Page 15: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/15.jpg)
![Page 16: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/16.jpg)
![Page 17: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/17.jpg)
4. S VRCHK Ver-2.0 檢查系統 (cont.)
– C. Service status collection **•Retrieve server working info. per-hour
– {id, hostip, score, retrieval,creadted}•Evaluate the working status
– {id, hostip, status, scr:retrie, date, creadted}
– D. Query service status•ISMS 報表文件
– http://140.115.11.133/SVR/svrchk_table.jsp•Query Interface
![Page 18: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/18.jpg)
4. SVRCHK Ver-2.0 檢測系統 (cont.)
![Page 19: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/19.jpg)
5. SVRCHK 程式及 Database
• Spring Framework– 提供許多 API, 幫助縮減 Web 應用系統發展
的效能 . • Sring MVC • Database Access (JDBC, Hibernate, JPA) • Security • Form Validator • Flow Control • Web Service • Others...
![Page 20: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/20.jpg)
5. SVRCHK 程式及 Database (cont.)
• Mysql data base– SERVER
•{ Host_Name, Host_IP, Host_Port, Host_Email,CREATED }
– PSTATUS•{ STATUS_IP, STATUS_SCORE, STATUS_RETRIEVE, CREATED }
– DAY_STATUS:•{ DAY_IP, DAY_STATUS, DAY_SCORE , DAY, CREATED }
![Page 21: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/21.jpg)
5. SVRCHK 程式及 Database (cont.)
• Crontab 執行程式– svrchk-fetch.java
•Collect service status according {IP,PORT}
– svrchk-exec.java•Valuate the service status
– svrchk-status.java•Report Daily service status
![Page 22: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/22.jpg)
5. SVRCHK 程式及 Database (cont.)
• JSP 網頁 access script– Svrchk_table.jsp– http://140.115.11.133/SVR/svrchk_table.jsp
• 改善– Security 安全性– Modularity 模組化– Reusability 再利用
![Page 23: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/23.jpg)
5. SVRCHK 程式及 Database (cont.)[root@center7-4 Data]# ls -l總計 56-rw-r--r-- 1 root root 306 10 月 23 16:30 140.115.1.28-rw-r--r-- 1 root root 308 10 月 23 16:31 140.115.1.31-…-rw-r--r-- 1 root root 297 10 月 23 16:30 163.28.49.4-rw-r--r-- 1 root root 311 10 月 23 16:30 192.192.227.4----------------------------------------------------------------------------------# more 140.115.1.31# Nmap 4.11 scan initiated Sat Oct 23 16:31:10 2010 as: /usr/bin/nmap -p 53 -P0 -oN 140.115.1.31 140.115.1.31Interesting ports on sun1.ncu.edu.tw (140.115.1.31):PORT STATE SERVICE53/tcp open domain
# Nmap run completed at Sat Oct 23 16:31:15 2010 – 1 IP address (1 host up) scanned in 5.511 seconds
![Page 24: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/24.jpg)
5. SVRCHK 程式及 Database (cont.)| 2078 | 140.115.1.31 | 1 | 1 | 2010-10-25 15:32:12 || 2079 | 140.115.11.133 | 1 | 1 | 2010-10-25 15:32:12 || 2080 | 163.25.254.13 | 1 | 1 | 2010-10-25 15:32:12 || 2081 | 163.28.49.4 | 1 | 1 | 2010-10-25 16:32:12 || 2082 | 163.25.254.250 | 0 | 1 | 2010-10-25 16:32:12 || 2083 | 192.192.227.14 | 0 | 1 | 2010-10-25 16:32:12 || 2084 | 140.115.2.238 | 1 | 1 | 2010-10-25 16:32:12 || 2085 | 192.192.227.13 | 1 | 1 | 2010-10-25 16:32:12 || 2086 | 163.25.255.21 | 1 | 1 | 2010-10-25 16:32:12 || 2087 | 140.115.17.199 | 1 | 1 | 2010-10-25 16:32:12 || 2088 | 140.115.19.42 | 1 | 1 | 2010-10-25 16:32:12 || 2089 | 192.192.227.4 | 1 | 1 | 2010-10-25 16:32:12 || 2090 | 140.115.1.28 | 1 | 1 | 2010-10-25 16:32:12 || 2091 | 163.25.254.2 | 1 | 1 | 2010-10-25 16:32:12 || 2092 | 140.115.17.212 | 1 | 1 | 2010-10-25 16:32:12 || 2093 | 140.115.1.31 | 1 | 1 | 2010-10-25 16:32:12 || 2094 | 140.115.11.133 | 1 | 1 | 2010-10-25 16:32:12 || 2095 | 163.25.254.13 | 1 | 1 | 2010-10-25 16:32:12
![Page 25: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/25.jpg)
5. SVRCHK 程式及 Database (cont.)mysql> select * from DAY_STATUS;
| DAY_ID | DAY_IP | STATUS | SCORE | DAY_INFO | DAY_CREATED |+--------+--------------------+------------+--------------+------------------+----------------------------+| 182 | 192.192.227.4 | G | 23:23 | 2010-10-26 | 2010-10-26 23:32:43 || 183 | 140.115.17.212 | G | 23:23 | 2010-10-26 | 2010-10-26 23:32:43 || 184 | 140.115.1.31 | G | 23:23 | 2010-10-26 | 2010-10-26 23:32:43 || 185 | 140.115.2.238 | G | 23:23 | 2010-10-26 | 2010-10-26 23:32:43 || 186 | 163.25.255.21 | G | 18:18 | 2010-10-27 | 2010-10-27 18:32:42 || 187 | 140.115.1.28 | G | 18:18 | 2010-10-27 | 2010-10-27 18:32:42 || 188 | 192.192.227.13 | G | 18:18 | 2010-10-27 | 2010-10-27 18:32:42 || 189 | 163.25.254.250 | NG | 0:18 | 2010-10-27 | 2010-10-27 18:32:43 || 190 | 192.192.227.14 | NG | 0:18 | 2010-10-27 | 2010-10-27 18:32:43 || 191 | 163.25.254.2 | G | 18:18 | 2010-10-27 | 2010-10-27 18:32:43 || 192 | 140.115.11.133 | G | 18:18 | 2010-10-27 | 2010-10-27 18:32:43 || 193 | 163.25.254.13 | G | 18:18 | 2010-10-27 | 2010-10-27 18:32:43 || 194 | 140.115.19.42 | G | 18:18 | 2010-10-27 | 2010-10-27 18:32:43 || 195 | 140.115.17.199 | NG | 17:18 | 2010-10-27 | 2010-10-27 18:32:43 || 196 | 163.28.49.4 | G | 18:18 | 2010-10-27 | 2010-10-27 18:32:43 || 197 | 192.192.227.4 | G | 18:18 | 2010-10-27 | 2010-10-27 18:32:43
![Page 26: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/26.jpg)
6. 總結
•草創版 (ver-1.0)–練習曲
•結合現成的 網路應用小工具•撰寫 簡單的 Java program •JSP web pages ( 滿足 ISMS document 要求 )
•應急版 (ver-1.1)–伺服系統種類大幅增加
• 嘗試合適的網路應用小工具– Expect, curl, Nmap
![Page 27: 桃園區網 : 伺服主機與網路檢查系統 (Version 2.0) 中央大學電算中心 楊素秋 2010.10](https://reader033.vdocuments.pub/reader033/viewer/2022061504/56649d415503460f94a1cb6f/html5/thumbnails/27.jpg)
6. 總結 (cont.)
•流通版 (ver-2.0)–檢測更合理–管理自動化–安全性提高–擴展性佳