プロジェクト

全般

プロフィール

バグ #321

未完了

SSH-2: コマンド実行機能実装 (4h)

Redmine Admin さんが約18時間前に追加.

ステータス:
新規
優先度:
高め
担当者:
-
開始日:
2025-06-07
期日:
進捗率:

0%

予定工数:

説明

SSH経由でのコマンド実行機能を実装する。

実装内容

コマンド実行機能

async execute(userId: string, host: string, command: string, timeout: number = 30000) {
  const ssh = await this.getConnection(userId, host);
  
  try {
    const result = await ssh.execCommand(command, {
      options: { timeout }
    });

    // 作業履歴を記録
    await this.logActivity(userId, host, 'execute', { command, result });

    return {
      content: [{
        type: "text",
        text: `stdout:\n${result.stdout}\n\nstderr:\n${result.stderr}\n\ncode: ${result.code}`
      }]
    };
  } catch (error) {
    throw new Error(`SSH execution failed: ${error.message}`);
  }
}

セキュリティ機能

  • コマンド実行ログ
  • タイムアウト制御
  • 危険コマンド検出
  • ユーザー権限チェック

成果物

  • コマンド実行機能
  • セキュリティチェック
  • 実行ログ機能

作業時間: 4時間

依存: SSH-1完了

表示するデータがありません

他の形式にエクスポート: Atom PDF