差異處
這裏顯示兩個版本的差異處。
linux:network:mount_https_iso_at_local [2022/11/11 16:57] tony |
linux:network:mount_https_iso_at_local [2023/06/25 09:48] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== Mount Https Iso at local ====== | ||
- | Linux有httpfs可以用於mount http iso於本地端,但一直編不出httpfs支援ssl的版本。後來一個同學分享了[[https://github.com/fangfufu/httpdirfs|httpdirfs]]給我,嘗試在Ubuntu 20.04.5 LTS上調整一些code且編譯後,就可以連我們自己簽的https server。本篇文章主要用在記錄過程。 | ||
- | ===== Build ===== | ||
- | 執行make編譯會出現以下錯誤,直接調整Makefile移除-fanalyzer後,就可以正常編譯了: | ||
- | <code bash> | ||
- | cc: error: unrecognized command line option '-fanalyzer' | ||
- | </code> | ||
- | ====== Modify Code ====== | ||
- | 在執行mount https之後,出現以下錯誤: | ||
- | <code bash> | ||
- | curl_process_msgs: 60 - SSL peer certificate or SSH remote key was not OK | ||
- | </code> | ||
- | 但發現使用合法憑證搭配合法hostname,還有使用http時都沒有問題,所以懷疑是CURL驗證出了什麼問題。\\ | ||
- | 文檔內容如下,但加上--insecure-tls是沒有用的: | ||
- | <code> | ||
- | --insecure-tls Disable licurl TLS certificate verification by | ||
- | setting CURLOPT_SSL_VERIFYHOST to 0 | ||
- | </code> | ||
- | 最後在src/link.c中,多做了CURLOPT_SSL_VERIFYHOST的設定(原本code是針對CURLOPT_SSL_VERIFYPEER設定為disable), | ||
- | <code cpp> | ||
- | ret = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); | ||
- | ret = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); | ||
- | </code> | ||
- | 改完code重新編譯就成功了。 | ||
- | ====== Execute Command ====== | ||
- | <code bash> | ||
- | # http | ||
- | ./httpdirfs -f --cache --single-file-mode http://10.146.16.150:8080/bootimage/driverdisk.iso /opt/mjgoodman/mnt | ||
- | # https, --insecure-tls只有CURLOPT_SSL_VERIFYPEER | ||
- | ./httpdirfs -f --cache --insecure-tls --single-file-mode https://10.146.16.150:8443/bootimage/driverdisk.iso /opt/mjgoodman/mnt | ||
- | </code> | ||
- | ====== Result ====== | ||
- | {{:linux:network:httpdirfs_result.png|}} | ||
- | ===== ===== | ||
- | ---- | ||
- | \\ | ||
- | ~~DISQUS~~ | ||
- | |||