Podcastの #セキュリティのアレ 第57回で知った.
少し試してみる.
Linux版はUbuntuはPPAが,Fedoraはパッケージがあるよう. DebianなのでUbuntu版が使えそうだけどsourceをcloneして依存関係の少ないcli版を試してみた.
依存パッケージの導入
$ apt install -y python3-flask python3-stem python3-pyqt5 python3-crypto python3-socks python3-nautilus tor obfs4proxy python3-pytest python3-pytestqt build-essential fakeroot python3-all python3-stdeb dh-python python3-flask-httpauth python3-distutils python3-psutil python3-socketio python3-flask-socketio python3-qrcode
sourceの入手
$ git clone https://github.com/micahflee/onionshare.git $ cd onionshare
cli版
$ ./dev_scripts/onionshare OnionShare 2.3.dev1 | https://onionshare.org/ [95m @@@@@@@@@ @@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ___ _ @@@@@@ @@@@@@@@@@@@@ / _ \ (_) @@@@ @ @@@@@@@@@@@ | | | |_ __ _ ___ _ __ @@@@@@@@ @@@@@@@@@@ | | | | '_ \| |/ _ \| '_ \ @@@@@@@@@@@@ @@@@@@@@@@ \ \_/ / | | | | (_) | | | | @@@@@@@@@@@@@@@@ @@@@@@@@@ \___/|_| |_|_|\___/|_| |_| @@@@@@@@@ @@@@@@@@@@@@@@@@ _____ _ @@@@@@@@@@ @@@@@@@@@@@@ / ___| | @@@@@@@@@@ @@@@@@@@ \ `--.| |__ __ _ _ __ ___ @@@@@@@@@@@ @ @@@@ `--. \ '_ \ / _` | '__/ _ \ @@@@@@@@@@@@@ @@@@@@ /\__/ / | | | (_| | | | __/ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \____/|_| |_|\__,_|_| \___| @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@ @@@@@@@@@ [0m usage: onionshare [-h] [--receive] [--website] [--chat] [--local-only] [--connect-timeout SECONDS] [--config FILENAME] [--persistent FILENAME] [--public] [--auto-start-timer SECONDS] [--auto-stop-timer SECONDS] [--legacy] [--client-auth] [--autostop-sharing] [--data-dir data_dir] [--disable_csp] [-v] [filename [filename ...]] positional arguments: filename List of files or folders to share optional arguments: -h, --help show this help message and exit --receive Receive files --website Publish website --chat Start chat server --local-only Don't use Tor (only for development) --connect-timeout SECONDS Give up connecting to Tor after a given amount of seconds (default: 120) --config FILENAME Filename of custom global settings --persistent FILENAME Filename of persistent session --public Don't use a password --auto-start-timer SECONDS Start onion service at scheduled time (N seconds from now) --auto-stop-timer SECONDS Stop onion service at schedule time (N seconds from now) --legacy Use legacy address (v2 onion service, not recommended) --client-auth Use client authorization (requires --legacy) --autostop-sharing Share files: Stop sharing after files have been sent --data-dir data_dir Receive files: Save files received to this directory --disable_csp Publish website: Disable Content Security Policy header (allows your website to use third-party resources) -v, --verbose Log OnionShare errors to stdout, and web errors to disk
とりあえずディレクトリを指定してみる
$ ./dev_scripts/onionshare ./ OnionShare 2.3.dev1 | https://onionshare.org/ @@@@@@@@@ @@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ___ _ @@@@@@ @@@@@@@@@@@@@ / _ \ (_) @@@@ @ @@@@@@@@@@@ | | | |_ __ _ ___ _ __ @@@@@@@@ @@@@@@@@@@ | | | | '_ \| |/ _ \| '_ \ @@@@@@@@@@@@ @@@@@@@@@@ \ \_/ / | | | | (_) | | | | @@@@@@@@@@@@@@@@ @@@@@@@@@ \___/|_| |_|_|\___/|_| |_| @@@@@@@@@ @@@@@@@@@@@@@@@@ _____ _ @@@@@@@@@@ @@@@@@@@@@@@ / ___| | @@@@@@@@@@ @@@@@@@@ \ `--.| |__ __ _ _ __ ___ @@@@@@@@@@@ @ @@@@ `--. \ '_ \ / _` | '__/ _ \ @@@@@@@@@@@@@ @@@@@@ /\__/ / | | | (_| | | | __/ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \____/|_| |_|\__,_|_| \___| @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@ @@@@@@@@@ Connecting to the Tor network: 100% - Done Compressing files. * Running on http://127.0.0.1:17632/ (Press CTRL+C to quit) Give this address to the recipient: http://onionshare:dubbed-dynamic@hqovqvfwtrfenrmtscjkojexc5fwi75tu4inpiqanafg75t2tajcwdyd.onion Press Ctrl+C to stop the server 127.0.0.1 - - [11/Oct/2020 18:12:36] "GET / HTTP/1.1" 401 - 127.0.0.1 - - [11/Oct/2020 18:12:44] "GET / HTTP/1.1" 401 - 127.0.0.1 - - [11/Oct/2020 18:12:46] "GET / HTTP/1.1" 200 - 127.0.0.1 - - [11/Oct/2020 18:12:47] "GET /static_qayzd2ldrlwtjcip3jla5yukse/css/style.css HTTP/1.1" 200 - 127.0.0.1 - - [11/Oct/2020 18:12:48] "GET /static_qayzd2ldrlwtjcip3jla5yukse/img/logo.png HTTP/1.1" 200 - 127.0.0.1 - - [11/Oct/2020 18:12:48] "GET /static_qayzd2ldrlwtjcip3jla5yukse/img/web_folder.png HTTP/1.1" 200 - 127.0.0.1 - - [11/Oct/2020 18:12:48] "GET /static_qayzd2ldrlwtjcip3jla5yukse/img/web_file.png HTTP/1.1" 200 - 127.0.0.1 - - [11/Oct/2020 18:12:48] "GET /static_qayzd2ldrlwtjcip3jla5yukse/js/send.js HTTP/1.1" 200 - 127.0.0.1 - - [11/Oct/2020 18:12:51] "GET /static_qayzd2ldrlwtjcip3jla5yukse/img/favicon.ico HTTP/1.1" 200 - 127.0.0.1 - - [11/Oct/2020 18:13:55] "GET / HTTP/1.1" 401 - 127.0.0.1 - - [11/Oct/2020 18:13:57] "GET / HTTP/1.1" 200 - 127.0.0.1 - - [11/Oct/2020 18:13:59] "GET /static_qayzd2ldrlwtjcip3jla5yukse/css/style.css HTTP/1.1" 200 - 127.0.0.1 - - [11/Oct/2020 18:14:00] "GET /static_qayzd2ldrlwtjcip3jla5yukse/img/logo.png HTTP/1.1" 200 - 127.0.0.1 - - [11/Oct/2020 18:14:00] "GET /static_qayzd2ldrlwtjcip3jla5yukse/img/web_folder.png HTTP/1.1" 200 - 127.0.0.1 - - [11/Oct/2020 18:14:00] "GET /static_qayzd2ldrlwtjcip3jla5yukse/img/web_file.png HTTP/1.1" 200 - 127.0.0.1 - - [11/Oct/2020 18:14:00] "GET /static_qayzd2ldrlwtjcip3jla5yukse/js/send.js HTTP/1.1" 200 - 127.0.0.1 - - [11/Oct/2020 18:14:02] "GET /static_qayzd2ldrlwtjcip3jla5yukse/img/favicon.ico HTTP/1.1" 200 - 127.0.0.1 - - [11/Oct/2020 18:21:33] "GET /download HTTP/1.1" 401 - 127.0.0.1 - - [11/Oct/2020 18:21:34] "GET /download HTTP/1.1" 200 - 3.3 MiB, 15.72% 127.0.0.1 - - [11/Oct/2020 18:21:50] "GET /download HTTP/1.1" 401 - 127.0.0.1 - - [11/Oct/2020 18:21:52] "GET /download HTTP/1.1" 200 - 21.1 MiB, 100.00% Stopped because transfer is complete
Torブラウザでアクセスするとこんな感じの画面がでてきてダウンロードできる.ちなみにAndroid版Torブラウザだと真っ白な画面になってしまう.PCモードでも同じ.
しかし,実際ダウンロードしてみるとダウンロードの途中で失敗してしまう.サーバ側ではダウンロード完了となって終了してしまっている. 小さな単一ファイルなども試してみたが同じ動き.
Torブラウザではなくtorsocks + wgetでも同じ. (ちなみに URL/download でダウンロードリンク.)
$ torsocks wget http://onionshare:unpaved-worrier@45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion/download --2020-10-11 18:32:08-- http://onionshare:*password*@45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion/download Resolving 45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion (45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion)... 127.42.42.0 Connecting to 45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion (45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion)|127.42.42.0|:80... connected. HTTP request sent, awaiting response... 401 UNAUTHORIZED Authentication selected: Basic realm="Authentication Required" Connecting to 45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion (45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion)|127.42.42.0|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 17169 (17K) [text/markdown] Saving to: ‘download’ download 90%[=================================================================================================> ] 15.18K 22.3KB/s in 0.7s 2020-10-11 18:32:14 (22.3 KB/s) - Connection closed at byte 15549. Retrying. --2020-10-11 18:32:15-- (try: 2) http://onionshare:*password*@45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion/download Connecting to 45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion (45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion)|127.42.42.0|:80... 1602408742 ERROR torsocks[2396495]: Host unreachable (in socks5_recv_connect_reply() at socks5.c:539) failed: No route to host. Resolving 45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion (45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion)... 127.42.42.0 Connecting to 45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion (45nlttj7terbltke7qspja3l5viw5lymi7ufyc7oef4tuawjcahv5iid.onion)|127.42.42.0|:80... 1602408744 ERROR torsocks[2396495]: Host unreachable (in socks5_recv_connect_reply() at socks5.c:539) failed: No route to host.
torify でも駄目.
$ torify wget -O onionshare.zip http://onionshare:contempt-uncle@bai7zpcr7mgkxm6u.onion/download --2020-10-12 02:08:10-- http://onionshare:*password*@bai7zpcr7mgkxm6u.onion/download Resolving bai7zpcr7mgkxm6u.onion (bai7zpcr7mgkxm6u.onion)... 127.42.42.0 Connecting to bai7zpcr7mgkxm6u.onion (bai7zpcr7mgkxm6u.onion)|127.42.42.0|:80... connected. HTTP request sent, awaiting response... 401 UNAUTHORIZED Authentication selected: Basic realm="Authentication Required" Connecting to bai7zpcr7mgkxm6u.onion (bai7zpcr7mgkxm6u.onion)|127.42.42.0|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 22140612 (21M) [application/zip] Saving to: ‘onionshare.zip’ onionshare.zip 65%[======================================================================> ] 13.85M 106KB/s in 2m 42s 2020-10-12 02:11:04 (87.4 KB/s) - Connection closed at byte 14520706. Retrying. --2020-10-12 02:11:05-- (try: 2) http://onionshare:*password*@bai7zpcr7mgkxm6u.onion/download Connecting to bai7zpcr7mgkxm6u.onion (bai7zpcr7mgkxm6u.onion)|127.42.42.0|:80... 1602436270 ERROR torsocks[3030887]: Host unreachable (in socks5_recv_connect_reply() at socks5.c:539) failed: No route to host. Resolving bai7zpcr7mgkxm6u.onion (bai7zpcr7mgkxm6u.onion)... 127.42.42.0 Connecting to bai7zpcr7mgkxm6u.onion (bai7zpcr7mgkxm6u.onion)|127.42.42.0|:80... 1602436271 ERROR torsocks[3030887]: Host unreachable (in socks5_recv_connect_reply() at socks5.c:539) failed: No route to host.
--autostop-sharing
オプションが自動終了のオプションぽいけど,これを無効にする方法がわからない.
--autostop-sharing Share files: Stop sharing after files have been sent
-v
で試すと既定値で有効になっているように見える.
$ ./dev_scripts/onionshare -v ./FILENAME : [Oct 11 2020 18:57:04] ModeSettings.set: updating dimly-buckwheat-facecloth: share.autostop_sharing = True :
--autostop-sharing=false
とかはエラーに.
試しに --local-only
でTorを使わないようにするとちゃんと最後までサウンロードできて内容も正しいのでTorまわりがおかしいぽい?
$ ./dev_scripts/onionshare --local-only . $ ./dev_scripts/onionshare --local-only . OnionShare 2.3.dev1 | https://onionshare.org/ @@@@@@@@@ @@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ___ _ @@@@@@ @@@@@@@@@@@@@ / _ \ (_) @@@@ @ @@@@@@@@@@@ | | | |_ __ _ ___ _ __ @@@@@@@@ @@@@@@@@@@ | | | | '_ \| |/ _ \| '_ \ @@@@@@@@@@@@ @@@@@@@@@@ \ \_/ / | | | | (_) | | | | @@@@@@@@@@@@@@@@ @@@@@@@@@ \___/|_| |_|_|\___/|_| |_| @@@@@@@@@ @@@@@@@@@@@@@@@@ _____ _ @@@@@@@@@@ @@@@@@@@@@@@ / ___| | @@@@@@@@@@ @@@@@@@@ \ `--.| |__ __ _ _ __ ___ @@@@@@@@@@@ @ @@@@ `--. \ '_ \ / _` | '__/ _ \ @@@@@@@@@@@@@ @@@@@@ /\__/ / | | | (_| | | | __/ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \____/|_| |_|\__,_|_| \___| @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@ @@@@@@@@@ Compressing files. * Running on http://127.0.0.1:17647/ (Press CTRL+C to quit) Give this address to the recipient: http://onionshare:opposite-puppet@127.0.0.1:17647 Press Ctrl+C to stop the server 127.0.0.1 - - [12/Oct/2020 00:54:34] "GET / HTTP/1.1" 401 - 127.0.0.1 - - [12/Oct/2020 00:54:34] "GET / HTTP/1.1" 200 - 127.0.0.1 - - [12/Oct/2020 00:54:34] "GET /static_dsbsgunbxaqkzukffxlxaonkw4/img/logo.png HTTP/1.1" 200 - 127.0.0.1 - - [12/Oct/2020 00:54:34] "GET /static_dsbsgunbxaqkzukffxlxaonkw4/img/web_folder.png HTTP/1.1" 200 - 127.0.0.1 - - [12/Oct/2020 00:54:34] "GET /static_dsbsgunbxaqkzukffxlxaonkw4/css/style.css HTTP/1.1" 200 - 127.0.0.1 - - [12/Oct/2020 00:54:34] "GET /static_dsbsgunbxaqkzukffxlxaonkw4/img/web_file.png HTTP/1.1" 200 - 127.0.0.1 - - [12/Oct/2020 00:54:34] "GET /static_dsbsgunbxaqkzukffxlxaonkw4/js/send.js HTTP/1.1" 200 - 127.0.0.1 - - [12/Oct/2020 00:54:34] "GET /static_dsbsgunbxaqkzukffxlxaonkw4/img/favicon.ico HTTP/1.1" 200 - 127.0.0.1 - - [12/Oct/2020 00:54:47] "GET /download HTTP/1.1" 401 - 127.0.0.1 - - [12/Oct/2020 00:54:47] "GET /download HTTP/1.1" 200 - 21.1 MiB, 100.00% Stopped because transfer is complete
GithubのIssueを見ると報告されていた.
On Ubuntu 18.04, the version of Tor shipped seems to be 0.3.2.10 which likely contains this bug. You can try one of three things to see if it stops the issue for you: Enable 'Use legacy onions' - you'll use the shorter onion addresses, which aren't affected by this bug, but of course the newer v3 style onions are recommended Use the Tor Project's Apt repository instead of using Ubuntu's older version of Tor. You can add the Tor Project Apt repository by following these instructions (see Option 2): https://www.torproject.org/docs/debian.html.en . If you do this, you should be able to use OnionShare with v3 onions Download Tor Browser and then change your OnionShare settings to use Tor Browser's Tor rather than the system-installed Tor.
とりあえずお手軽な --legacy
で試してみるとやはり途中でOnionShareが終了してダウンロードに失敗する.
--stay-open
は未実装のようで使えない.
onionshare: error: unrecognized arguments: --stay-open
--receive
オプションでファイルを受け取れる.ファイルドロップモード.
ファイルは ~/OnionShare/西暦年-月-日/時.分.秒/
以下に保存された.
$ ./dev_scripts/onionshare --receive OnionShare 2.3.dev1 | https://onionshare.org/ @@@@@@@@@ @@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ___ _ @@@@@@ @@@@@@@@@@@@@ / _ \ (_) @@@@ @ @@@@@@@@@@@ | | | |_ __ _ ___ _ __ @@@@@@@@ @@@@@@@@@@ | | | | '_ \| |/ _ \| '_ \ @@@@@@@@@@@@ @@@@@@@@@@ \ \_/ / | | | | (_) | | | | @@@@@@@@@@@@@@@@ @@@@@@@@@ \___/|_| |_|_|\___/|_| |_| @@@@@@@@@ @@@@@@@@@@@@@@@@ _____ _ @@@@@@@@@@ @@@@@@@@@@@@ / ___| | @@@@@@@@@@ @@@@@@@@ \ `--.| |__ __ _ _ __ ___ @@@@@@@@@@@ @ @@@@ `--. \ '_ \ / _` | '__/ _ \ @@@@@@@@@@@@@ @@@@@@ /\__/ / | | | (_| | | | __/ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \____/|_| |_|\__,_|_| \___| @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@ @@@@@@@@@ Connecting to the Tor network: 100% - Done * Running on http://127.0.0.1:17645/ (Press CTRL+C to quit) Files sent to you appear in this folder: /home/matoken/OnionShare Warning: Receive mode lets people upload files to your computer. Some files can potentially take control of your computer if you open them. Only open things from people you trust, or if you know what you are doing. Give this address to the sender: http://onionshare:viscous-roping@6bh3urd2clrm7o334aqc623hwkjnifu5jdymrwmj7bkh6ejd6sih6aqd.onion Press Ctrl+C to stop the server 127.0.0.1 - - [12/Oct/2020 01:15:22] "GET / HTTP/1.1" 401 - 127.0.0.1 - - [12/Oct/2020 01:15:26] "GET / HTTP/1.1" 200 - 127.0.0.1 - - [12/Oct/2020 01:15:29] "GET /static_4ycypt3mnmqxvjujxa7gucinpu/css/style.css HTTP/1.1" 200 - 127.0.0.1 - - [12/Oct/2020 01:15:29] "GET /static_4ycypt3mnmqxvjujxa7gucinpu/js/jquery-3.5.1.min.js HTTP/1.1" 200 - 127.0.0.1 - - [12/Oct/2020 01:15:30] "GET /static_4ycypt3mnmqxvjujxa7gucinpu/img/logo.png HTTP/1.1" 200 - 127.0.0.1 - - [12/Oct/2020 01:15:30] "GET /static_4ycypt3mnmqxvjujxa7gucinpu/js/receive.js HTTP/1.1" 200 - 127.0.0.1 - - [12/Oct/2020 01:15:30] "GET /static_4ycypt3mnmqxvjujxa7gucinpu/img/logo_large.png HTTP/1.1" 200 - 127.0.0.1 - - [12/Oct/2020 01:15:36] "GET /static_4ycypt3mnmqxvjujxa7gucinpu/img/favicon.ico HTTP/1.1" 200 - Oct 12, 01:16AM: Upload of total size 19.0 KiB is starting => 18.8 KiB 20201012_011055-2969958.jpg 127.0.0.1 - - [12/Oct/2020 01:16:25] "POST /upload-ajax HTTP/1.1" 401 - 127.0.0.1 - - [12/Oct/2020 01:16:27] "GET /static_4ycypt3mnmqxvjujxa7gucinpu/img//ajax.gif HTTP/1.1" 200 - Oct 12, 01:16AM: Upload of total size 19.0 KiB is starting => 18.8 KiB 20201012_011055-2969958.jpg Received: /home/matoken/OnionShare/2020-10-12/01.16.28/20201012_011055-2969958.jpg 127.0.0.1 - - [12/Oct/2020 01:16:29] "POST /upload-ajax HTTP/1.1" 200 -
ファイルを受け取っても自動終了しないので注意.--auto-stop-timer
を利用すると良さそう.以下は600秒を指定していてファイルのアップロードの状態に関係なく10分ほどで終了する.
$ ./dev_scripts/onionshare --auto-stop-timer 600 --receive : Stopped because auto-stop timer ran out
--chat
オプションでtext chatモードになる.ファイル共有は一緒に出来ないみたい.同時にファイル共有もしたい場合はもう一つ起動する必要がありそう.
$ ./dev_scripts/onionshare --chat
日本語や絵文字は化ける
--website
オプションで指定したコンテンツをOnion siteで公開できる.既定値だと毎回アドレスが変わるのでアドホックで一時的に立てたいとき向けかな?
--public
でパスワードを無効にしたほうがいいかも?
普通にOnion Web Server立てる場合はTor入れて torrc
で HiddenServicePort 80 127.0.0.1:80
とかしてhttpdにVirtualhost設定する感じ.
コメント