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?

More than 1 year has passed since last update.

openSUSEから認証Proxy(http)経由でSSH

Posted at

TL;DR

sshコマンドで認証プロキシを突破して外部のhostにログインするときはnmapのncatを使ってProxyCommand ncat --proxy-type http --proxy-auth <pxy-user>:<pxy-pass> --proxy proxy.example.com:8080 %h %pとすると手っ取り早い。

ことのはじまり

内部から直接アクセスできるホストと認証プロキシ経由でしかアクセスできないホストがあり、後者の接続にrloginとかつかっていたのだけど、WSLにopenSUSE Leap 15.5が追加されていたのでこいつから接続できるようにしようと試み始めたのがことの発端。

ncでは認証プロキシを通す設定が見つからなかったのと、ググったところよく出てくるconnect-proxyをopenSUSEに入れるのが面倒だったので、標準パッケージでできるやつないかなーと探していたところ、nmapのncatでできると見つけた。なので、これを試すことに。

インストール&設定

ncatのインストール

sudo zypper --no-refresh in ncat

これ↓が入った。

Information for package ncat:
-----------------------------
Repository     : Main Repository
Name           : ncat
Version        : 7.92-150400.1.8
Arch           : x86_64
Vendor         : SUSE LLC <https://www.suse.com/>
Installed Size : 429.1 KiB
Installed      : Yes
Status         : up-to-date
Source package : nmap-7.92-150400.1.8.src
Upstream URL   : https://nmap.org/
Summary        : Network tool to concatenate and redirect sockets
Description    :
    Ncat is a networking utility which will read and write data across a
    network from the command line. It uses both TCP and UDP for
    communication and provides network connectivity to other applications
    and users.

sshする

~/.ssh/configに以下のように記述してアクセスを試みたらうまく接続できた。

Host __hoge02-ext
  HostName hoge02.ext.example.com
  User bounoki
  ProxyCommand ncat --proxy-type http --proxy-auth <pxy-user>:<pxy-pass> --proxy proxy.example.com:8080 %h %p
  IdentityFile ~/.ssh/id_rsa

Links

https://nmap.org/ncat/guide/ncat-proxy.html
https://qiita.com/u-koji/items/c23c06ef594e34655666

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?