• home
  • about
  • 全ての投稿
  • ソフトウェア・ハードウェアの設定のまとめ
  • 分析関連のまとめ
  • ヘルスケア関連のまとめ
  • 生涯学習関連のまとめ

bore

date: 2022-04-14 excerpt: boreの使い方

tag: borerustngrok


boreの使い方

概要

  • /ngrok/のOSS版
    • ngrokが数分でexpireすることに比べて制限がない
  • cargoでインストールできる
  • サーブするホストを自分で所有できる(セキュリティで多少有利か)
  • サポートするプロトコルはTCP
  • 暗黙のコントールポートは7835 でこれの公開が必要
  • macOSでlaunchdでサービス化できる
  • TCPのアイドルタイムアウト等の影響で終了することがあり、whileループで再接続するのが手軽

インストール

cargoでインストール

$ cargo install bore-cli

macOS

$ brew install bore-cli

localの22をyour_host_or_ipの2022に転送

  • your_host_or_ipはbore serverが起動しているホスト
  • your_host_or_ip:2022にアクセスするとローカルの22にアクセスできる
    • リモート側に2022が空きがない場合は接続失敗する
$ bore local 22 --to your_host_or_ip --port 2022

boreのサーバを立ち上げる

  • 7835ポートを公開する必要がある

どのアクセスでも受け入れる場合

$ bore server 

簡単な鍵を設定する場合

$ bore server --secret my_secret_string

ローカルのjupyterのポートを転送

  • bore serverが起動しているサーバ(oci.hut42.tech)にローカルの8888ポートを転送する
  • 終了時に2秒待って再接続する
$ while :; do bore local 8888 --to oci.hut42.tech --port 8888; echo "bore exited ($?)"; sleep 2; done
2025-08-31T06:55:17.882125Z  INFO bore_cli::client: connected to server remote_port=8888
2025-08-31T06:55:17.882153Z  INFO bore_cli::client: listening at oci.hut42.tech:8888

Linuxでsystemdでサービス化する場合

  • ~/.config/systemd/user/bore-server.service を作成する
  • systemctl --user daemon-reload
  • systemctl --user enable bore-server.service
  • systemctl --user start bore-server.service

~/.config/systemd/user/bore-server.service

[Unit]
Description=Bore Server
After=network.target

[Service]
Type=simple
ExecStart=/home/myname/.cargo/bin/bore server --secret MY_SECRET_HERE
Restart=always
RestartSec=5

[Install]
# ユーザーログイン時に自動起動する設定
WantedBy=default.target


borerustngrok Share Tweet