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 5 years have passed since last update.

WSL上のコマンドがKasperskiに弾かれる

0
Posted at

問題

gitなどのコマンドがネットワーク接続に失敗する。
環境はWindows 10 Home内のUbuntu 18.04LTS(WSL)。
セキュリティソフトはKaspersky 19.0.0.1088を使用。
私自身はaptやnpmは失敗しないが、失敗する環境もあるらしい。

例えばgit cloneが以下のように失敗する。

fatal: unable to access 'https://github.com/hoge/piyo': gnutls_handshake() failed: The TLS connection was non-properly terminated.

原因

なぜかと思いながら検索していたところ、WSLが9月頃からおかしくなった...がヒットした。
どうも443(https)と80(http)のポートがKasperskyに監視されていて、そこで何かしらの不具合が起こっているか、パケットが落とされているのではないかという気がする。

解決

一般的な対策はKasperskyを終了すること、先述の記事ではこれらのポートの監視を無効にすること、ですり抜けていた。
私自身はgitだけで問題が起こっているので、gitコマンドで使うプロトコルをhttpsではなくsshにすることで抜けることができた。

公開鍵を新しく作る場合には以下のようなコマンドで公開鍵暗号のキーペアを作る。

ssh-keygen -t rsa -b 4096

その後、~/.ssh/id_rsa.pubの内容をgithubの、Settings -> SSH and GPG keysからNew SSH keyボタンを押して登録する。
私自身はecdsa 521を使ってキーペアを作ったが、このへんは安全だと言われている暗号アルゴリズムと鍵長を選んでほしい。

あとはgit cloneをするときのURLを以下のように変更する。
もとはhttps://github.com/hoge/piyohttps://hoge@github.com/hoge/piyoのように記述していたものを、

git clone git@github.com:hoge/piyo.git

とすればよい。
これでうまく行っているということは、おそらくhttp/httpsのポート監視は厳しすぎて弾かれるものがあるが、sshが使う22番は監視が厳しくない(あるいはsshプロトコルのやり取りをKasperskyが安全だとみなしている)のではないだろうか。

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?