0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OpenWrt Connect SSH鍵認証自動化 Windowsアプリ

0
Last updated at Posted at 2026-02-16

:flag_jp: Japanese article
OpenWrt_icon.png

はじめに

この記事で出来る事

  • SSH鍵認証の自動化:
    初回接続時にパスワードを入力するだけで、以降はパスワード不要で接続
  • カスタムスクリプトの実行:
    設定ファイルで定義したコマンドをワンクリックで実行
  • 複数デバイスの管理:
    IPアドレスごとに異なるSSH鍵を自動生成・管理

本ツールについて

動作環境

  • Windows 10/11 (64bit)
  • OpenWrt 21.02+ (Dropbear/OpenSSH対応)

初心者対応構成

  • Windowsからの導入(インストーラー形式)
  • スクリプトでの自動設定(コマンド1つで完了)
  • 検証はUCILuCISFTPの併用を推奨:exclamation:

SSH鍵認証アプリ

アプリ (Windows用)

OpenWrt Connect

リードミー

ダウンロード


ワンパスで完結する仕組み

鍵の転送

公開鍵の転送とSSH接続を1コマンドで完結

type "%USERPROFILE%\.ssh\owrt-connect_<IP>_rsa.pub" | ssh root@<IP> "cat >> /etc/dropbear/authorized_keys"

type(標準出力)をsshにパイプすることで、鍵転送とSSHログインを1セッションで同時実行

  1. 鍵生成(自動)
  2. 公開鍵転送(パスワード認証・1回のみ)
  3. authorized_keysへの登録(自動)

SSH鍵ペアの自動生成と配置

初回接続時

Dropbearのキーベース認証

以下の処理を自動実行:

  • SSH鍵ペア (RSA 2048bit) の生成
  • 公開鍵をOpenWrtデバイスに送信
  • Dropbear/OpenSSHを自動判別して適切な場所に配置

鍵の保存場所 (Windows)

%USERPROFILE%\.ssh\owrt-connect_<IP>_rsa
%USERPROFILE%\.ssh\owrt-connect_<IP>_rsa.pub

鍵の配置先 (OpenWrt)

# Dropbear
/etc/dropbear/authorized_keys
# OpenSSH
/root/.ssh/authorized_keys

設定ファイル

コマンド定義
フィールド 説明 必須 反映先
label 表示名 EXEバナー + MSIショートカット説明
icon アイコンファイル名 MSIショートカット
url リモートスクリプトURL EXEテンプレート展開
dir デバイス上の一時ディレクトリ EXEテンプレート展開
bin デバイス上の永続化パス EXEテンプレート展開

url指定時のみ必須

例:スクリプトリンクを追加した場合

[general]
product_name = OpenWrt Connect
default_ip = 192.168.1.1
ssh_user = root
ssh_key_prefix = owrt-connect

[command.aios2]
label = OpenWrt Persistent Installation
icon = aios2.ico
url = https://site-u.pages.dev/www/aios2.sh
dir = /tmp/aios2
bin = /usr/bin/aios2

[command.aios]
label = OpenWrt Menu Script (Old version)
icon = aios.ico
url = https://raw.githubusercontent.com/site-u2023/aios/main/aios.sh
dir = /tmp/aios
bin = /usr/bin/aios

[command.ssh]
label = SSH Connection
icon = openwrt-connect.ico

コマンド追加手順

  • EXEと同じディレクトリの .conf ファイルに [command.新コマンド名] セクション追加
  • 対応する .ico ファイルを配置(任意)
  • openwrt-connect-build.bat 実行 → EXE + MSI に自動反映

.conf ファイル名は自由(例:myrouter.conf
EXEは同じディレクトリにある最初の .conf を自動検出


フラッシュ&インストールシステム

aios.png

あとがき

  • 2026年2月17日
    窓の杜に自薦で申請したら昨日の今日でダイジェストニュースに掲載された!
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?