V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
AnyISalIn
V2EX  ›  分享创造

SSHWrapper - 通过 SSH 协议给 Linux 命令提供交互接口

  •  1
     
  •   AnyISalIn ·
    anyisalin · 2022-05-21 01:27:50 +08:00 · 1219 次点击
    这是一个创建于 698 天前的主题,其中的信息可能已经有所发展或是发生改变。

    最近在研究 SSH 协议,做一个简单的封装,可以给命令暴露一个 ssh 的服务接口,基于此功能可以基于简单的 shell 命令实现类似 堡垒机、容器登录 /自动申请、等功能

    代码:https://github.com/AnyISalIn/sshwrapper,求 star 哈哈

    演示如下: asciicast

    交互方式只需要通过 ssh <user>@<host> -t "<api_path>" 命令即可完成,注意 ssh 命令一定要带 -t 参数

    $ ssh [email protected] -t "/apis" 
    
    SSH Wrapper API List:
    - /bastion
    - /kube-watchtower
    - /run-container
    
    $ ssh [email protected] -t "/run-container" 
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3656 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 04:44 · PVG 12:44 · LAX 21:44 · JFK 00:44
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.