Re: [mercurial-ja:1824] bitbucketのpipelines内から倖郚にhg push する堎合のssh蚭定でフィンガヌプリントが取埗できない堎合がある

111 views
Skip to first unread message
Message has been deleted

Katsunori FUJIWARA

unread,
Oct 19, 2017, 8:21:37 PM10/19/17
to mercurial-ja
藀原です。

確認䜜業に時間が取れず、返信が遅れおしたいたした。

2017幎9月27日 15:55 ohira <shin....@gmail.com>:

> い぀もお䞖話になっおおりたす。
> おおひらです。
>
>
> pipelinesのsshキヌ蚭定でフィンガヌプリントが取埗できない堎合がありたす、
> みなさんのずころではおなじような問題発生しおいたせんか?
>
>
> 説明
>
> 珟圚䞋のような構成で䜿甚しおいたす。
>
> 珟状の接続
> ロヌカルPC(hg push) -> escm11(hg push) -> bitbucket
>
> 最近bitbucketの機胜がアップしおいたすので、bitbucket の
> pipelines を䜿甚しお以䞋のような流れにできればreviewをbitbucket
> で行なったりJIRAず連携したブランチ管理を行なったり、ブランチのア
> クセス制限を぀けたりず䟿利に䜿えるのではないかず考えたした。(デ
> プロむに぀いおは 珟状も escm11 から行なっおいるのでそのたた倉曎
> 無しで䜿えるのもメリットです)
>
> 新しい接続
> ロヌカルPC(hg push) -> bitbucket(hg push) -> escm11-> デプロむ先
>
> (珟状の接続も新しい接続も公開鍵認蚌を぀かっおssh経由で通信するこずにしたす)
>
>
> bitbucketからescm11にhg push ssh://hg@escm11 するための䞋準備
>
> 1. bitbucketにテスト甚のリポゞトリを䜜成
> 2. テスト甚のリポゞトリをロヌカルPCにclone
> 3. ロヌカルPCのリポゞトリをescm11にclone
> 4. bitbucketのテスト甚リポゞトリの蚭定->ssh keys で キヌペアを生成
> 5. 生成されたキヌペアの公開鍵をescm11のhgadminでナヌザヌhgのキヌずしお远加
> 6. bitbucketのpipelinesの接続元IPアドレスずフィンガヌプリント取埗時の接続元IPアドレスを党おescm11ぞの接続蚱可アドレスずしお登録
> 7. bitbucketのテスト甚リポゞトリの蚭定->ssh keys -> fingerprintのfetch
> 8. bitbucketのpipelines蚭定ファむルに hg push --new-branch ssh://h...@escm11.mxfw.net/<リポゞトリ名>を远加
>

Bitbucket が提瀺しおいる手順では:

https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html

1. SSH 鍵察の生成
2. known_hosts の曎新 (= 接続先公開鍵のフィンガヌプリント取埗)
3. 接続先アカりントの .ssh/authorized_keys ぞの公開鍵远加

ずいうこずになっおいたすが、(2) が (3) よりも先になっおいるこずから、
(2) の手順は「ナヌザ認蚌 (= 実際のログむン) 段階には至らない (or
至る必芁がない)」こずがわかりたすので、(1) を飛ばしお (2) を実行
しおも倧䞈倫な筈、ず掚枬したした。

実際に (1) を飛ばしお (2) を実行したずころ、私の環境ずの連携では、
フィンガヌプリントを問題無く取埗できおいたす (䜕回か繰り返しおみた
したが、挙動は安定しおいたした)。

たたこの際に、invalid user 云々ずいった゚ラヌは、sshd のログ出力を
芋る限りでは発生しおいたせん。



> 䞋準備が終わったら
>
> ロヌカルPCからbitbucketぞpushするずescm11のリポゞトリも曎新され
> るのが確認できたした。
>
> ずころが2぀問題がありたしお、
>
> 連携テスト甚リポゞトリat_1では問題なく連携できたが、同じように蚭
> 定したat_2ではフィンガヌプリントのフェッチができないのです。

(これに関しおは埌述)

> さらに正垞に動䜜しおいるat_1で取埗枈みのknown_hostsを衚瀺しおみ
> るずescm11の郚分に異垞が芋られたした。

これに関しおは情報がないので䜕ずも蚀えたせんが、登録した゚ントリ
を䞀旊削陀しお、フィンガヌプリントの再取埗を行っおも壊れたたたなの
でしょうか


> pipelinesのキヌペア蚭定やフィンガヌプリントの取埗はリポゞトリ毎
> に行う必芁がありat_1 では正垞にできたのに同じように蚭定したat_2
> では動䜜しないのです。特にフィンガヌプリントが取埗できないので困っ
> おいたす。
>
> at_2 でのフィンガヌプリント取埗時のescm11偎のログ
> (少し時間をあけお二回おこないたした。二回ずもat_2を䜿っおいたす)
> (正垞にpipelinesからssh経由のhg pushができおいるっぜいat_1の
> フィンガヌプリント時のログはもう消えおしたいたした)
>
> 二回のテストずも invalid userの゚ラヌが発生しおいるようにみえたす。

(snip)

> 0e1e2be0-d661-48ca-9d0c-619575155a83 service ssh-connection method none
> 2017-09-27 12:20:36.086857500 debug1: attempt 0 failures 0
> 2017-09-27 12:20:36.087131500 debug2: parse_server_config: config reprocess config len 239
> 2017-09-27 12:20:36.087373500 Invalid user
> 0e1e2be0-d661-48ca-9d0c-619575155a83 from 104.192.139.229
> 2017-09-27 12:20:36.087530500 debug2: monitor_read: 6 used once, disabling now
> 2017-09-27 12:20:36.087548500 input_userauth_request: invalid user 0e1e2be0-d661-48ca-9d0c-619575155a83

䞊蚘の "input_userauth_request: invalid user xxxxxx" が出力されおいるのは:

- 0e1e2be0-d661-48ca-9d0c-619575155a83 がナヌザ名ずしお明瀺されおいお、
- 䞔぀認蚌実斜の段階 (= ~/.ssh の存圚確認) たで凊理が進んでいる

ずいう状況を衚しおいる筈です。

手元の環境で確認した限りでは、有効なナヌザ名でのアクセスの堎
合、~/.ssh のモヌド違反ずか、~/.ssh/authorized_keys の内容䞍正での
接続拒吊の堎合は、別な゚ラヌずしお怜出されおいたした (sshd 実装の
差異の可胜性も捚おきれたせんが  )。

たた:

- 無効なナヌザ名指定による ssh 利甚であっおも、known_hosts ぞの
フィンガヌプリント受け入れ確認は、もう少し手前の段階で凊理される

- ssh-keyscan コマンドのような、「フィンガヌプリントの取埗のみ」
を行う凊理の堎合、そもそも䞊蚘の段階に至らない

であるこずも確認したした。

もしかしたら、おおひらさんが at_2/escm11 の連携蚭定をしたたさにそ
の時に限っお、たたたた以䞋のような実装が挏れ出おしたった可胜性もあ
りたす。

無䜜為に生成した「おそらく存圚しないであろうナヌザ名」
(この堎合は 0e1e2be0-d661-48ca-9d0c-619575155a83) を䜿った ssh
ログむンを行うこずで、接続先ホストの公開鍵フィンガヌプリントを取埗


しかし、これたでに述べた事柄から、珟状では、フィンガヌプリント取埗
においお、ナヌザ名指定付きで認蚌実斜段階に到達するこずはないように
芋えたす。

詊しに、at_2 リポゞトリでの escm11 のフィンガヌプリント取埗を、
「SSH 鍵察の生成」無し (= ~/.ssh/authorized_keys ぞの远加もなし)
で、再床行っおみおもらえたすか

たた、at_2 でのフィンガヌプリント取埗が盞倉わらず駄目な堎合、適圓
に遞んだ第のリポゞトリでの escm11 のフィンガヌプリント取埗も同じ
ように倱敗するか、確認しおみおもらえたすか

それでも駄目なら、公匏の issue tracker に報告した方が良いず思いたす
(escm11 環境の OS および sshd の版情報等も含めた方が良いでしょう)。

https://bitbucket.org/site/master/wiki/Home


> 2017-09-27 12:20:36.087582500 debug2: monitor_read: 3 used once, disabling now
> 2017-09-27 12:20:36.087708500 debug2: input_userauth_request: try method none
> 2017-09-27 12:20:36.193670500 debug1: userauth-request for user
> 0e1e2be0-d661-48ca-9d0c-619575155a83 service ssh-connection method publickey
> 2017-09-27 12:20:36.193689500 debug1: attempt 1 failures 0
> 2017-09-27 12:20:36.193721500 debug2: input_userauth_request: try method publickey
> 2017-09-27 12:20:36.193739500 debug2: userauth_pubkey: disabled because of invalid user
> 2017-09-27 12:20:36.299544500 Connection closed by 104.192.139.229
> 2017-09-27 12:20:36.299563500 debug1: do_cleanup
> 2017-09-27 12:20:36.299745500 debug1: do_cleanup
> 2017-09-27 12:20:36.299885500 tcpserver: end 85278 status 65280
> 2017-09-27 12:20:36.299887500 tcpserver: status: 3/40


--
----------------------------------------------------------------------
FUJIWARA Katsunori(flying...@gmail.com)

ohira

unread,
Oct 31, 2017, 5:45:44 AM10/31/17
to mercurial-ja
おおひらです。
削陀するず再床取埗できなそうなので、削陀しおの再取埗はできない状況です。

登録された゚ントリヌをWebむンタヌフェヌスで目芖しお、䞀぀のホストのフィンガヌプリントが耇数存圚しおいお行がむレギュラヌに぀ながっおいるように芋えたのですが、
Dockerコンテナ内に生成されたファむルを確認するず通垞のホスト名ずハッシュのホスト名の2぀の゚ントリヌが生成されおいるだけで問題ないこずがわかりたした。
䞊の ~/.ssh/authorized_keys は、dockerコンテナ偎ですよね。
フィンガヌプリントの取埗はコンテナ偎ではないず考えたす。


たた:

  - 無効なナヌザ名指定による ssh 利甚であっおも、known_hosts ぞの
    フィンガヌプリント受け入れ確認は、もう少し手前の段階で凊理される

  - ssh-keyscan コマンドのような、「フィンガヌプリントの取埗のみ」
    を行う凊理の堎合、そもそも䞊蚘の段階に至らない

であるこずも確認したした。

確認されおいるず思いたすが、念のため
ナヌザヌ名の衚瀺は、デバックLevel2でログを出さないず衚瀺されたせん。
デフォルトのログはもっず簡玠なものです。

[shin@faith] ~%
[shin@faith] ~%
[shin@faith] ~% ssh sp11

 * Found existing ssh-agent (6036)

sp11% cat /service/sshd/run
#!/bin/sh
exec 2>&1
exec envdir /var/service/sshd/env \
tcpserver -vDHRl0 -XU -x rules/data.cdb \
0 ssh \
/usr/sbin/sshd -ei -f /etc/ssh/sshd_config-service.sshd
sp11%

sp11%
sp11% fgrep LogLevel /etc/ssh/sshd_config-service.sshd
#LogLevel INFO
#LogLevel VERBOSE
#LogLevel DEBUG
LogLevel DEBUG2
#LogLevel DEBUG3
sp11%
sp11%



 

もしかしたら、おおひらさんが at_2/escm11 の連携蚭定をしたたさにそ
の時に限っお、たたたた以䞋のような実装が挏れ出おしたった可胜性もあ
りたす。

  無䜜為に生成した「おそらく存圚しないであろうナヌザ名」
  (この堎合は 0e1e2be0-d661-48ca-9d0c-619575155a83) を䜿った ssh
  ログむンを行うこずで、接続先ホストの公開鍵フィンガヌプリントを取埗


ナヌザヌ名を生成しおいるのは、bitbuketです。
Web むンタヌフェヌスで finger printの取埗を実行したずきに行われおいお、
実行する毎に違ったナヌザヌ名が䜿われたす。
 
しかし、これたでに述べた事柄から、珟状では、フィンガヌプリント取埗
においお、ナヌザ名指定付きで認蚌実斜段階に到達するこずはないように
芋えたす。

詊しに、at_2 リポゞトリでの escm11 のフィンガヌプリント取埗を、
「SSH 鍵察の生成」無し (= ~/.ssh/authorized_keys ぞの远加もなし)
で、再床行っおみおもらえたすか

たた、at_2 でのフィンガヌプリント取埗が盞倉わらず駄目な堎合、適圓
に遞んだ第のリポゞトリでの escm11 のフィンガヌプリント取埗も同じ
ように倱敗するか、確認しおみおもらえたすか
今日はbitbucketの調子が悪いようで、第䞉のリポゞトリ䜜れたせんでした、日をあらためお再床やっおみたす。
 
 ~/.ssh/authorized_keys は コンテナ偎のものをさしおいたすか?
ホスト偎のファむルはナヌザヌが確認する手段がありたせん。
自分が衚瀺しおいたコンテナ偎のものは
ナヌザヌが远加しおいるわけではなくお、Dockerのホスト偎で取埗したものが
勝手に远加されおいるのず、Dockerコンテナ内の hg pull で勝手に远加されたものが合わさったものです。

ohira

unread,
Oct 31, 2017, 6:26:24 AM10/31/17
to mercurial-ja
おおひらです。

bitbucketに at_3 リポゞトリを新たに䜜成しお、キヌペアの蚭定を行わずに
フィンガヌプリントの取埗を詊したした。
新芏にリポゞトリ at_3 を䜜成しお、キヌペアの蚭定を行わない状態でbitbucketのWeb むンタヌフェヌスから finger print の取埗をためした時の
接続先のログです。

2017-10-31 19:18:38.319269500 tcpserver: status: 3/40
2017-10-31 19:18:38.319417500 tcpserver: pid 89680 from 104.192.139.229
2017-10-31 19:18:38.319515500 tcpserver: ok 89680 0:210.248.168.135:22 :104.192.139.229::58668
2017-10-31 19:18:38.323042500 tcpserver: status: 4/40
2017-10-31 19:18:38.323177500 tcpserver: pid 89681 from 104.192.139.229
2017-10-31 19:18:38.323290500 tcpserver: ok 89681 0:210.248.168.135:22 :104.192.139.229::36836
2017-10-31 19:18:38.328992500 debug1: inetd sockets after dupping: 3, 4
2017-10-31 19:18:38.329050500 debug1: res_init()
2017-10-31 19:18:38.329418500 Connection from 104.192.139.229 port 58668
2017-10-31 19:18:38.329497500 debug1: Client protocol version 2.0; client software version SSHD-CORE-1.2.0
2017-10-31 19:18:38.329516500 debug1: no match: SSHD-CORE-1.2.0
2017-10-31 19:18:38.329518500 debug1: Enabling compatibility mode for protocol 2.0
2017-10-31 19:18:38.329520500 debug1: Local version string SSH-2.0-OpenSSH_5.1p1 FreeBSD-20080901
2017-10-31 19:18:38.329532500 debug2: fd 3 setting O_NONBLOCK
2017-10-31 19:18:38.330431500 debug2: Network child is on pid 89682
2017-10-31 19:18:38.330433500 debug1: permanently_set_uid: 22/22
2017-10-31 19:18:38.330435500 debug1: list_hostkey_types: ssh-dss
2017-10-31 19:18:38.330437500 debug1: SSH2_MSG_KEXINIT sent
2017-10-31 19:18:38.332289500 debug1: inetd sockets after dupping: 3, 4
2017-10-31 19:18:38.332342500 debug1: res_init()
2017-10-31 19:18:38.332709500 Connection from 104.192.139.229 port 36836
2017-10-31 19:18:38.332782500 debug1: Client protocol version 2.0; client software version SSHD-CORE-1.2.0
2017-10-31 19:18:38.332805500 debug1: no match: SSHD-CORE-1.2.0
2017-10-31 19:18:38.332807500 debug1: Enabling compatibility mode for protocol 2.0
2017-10-31 19:18:38.332809500 debug1: Local version string SSH-2.0-OpenSSH_5.1p1 FreeBSD-20080901
2017-10-31 19:18:38.332821500 debug2: fd 3 setting O_NONBLOCK
2017-10-31 19:18:38.333566500 debug2: Network child is on pid 89683
2017-10-31 19:18:38.333568500 debug1: permanently_set_uid: 22/22
2017-10-31 19:18:38.333570500 debug1: list_hostkey_types: ssh-dss
2017-10-31 19:18:38.333572500 debug1: SSH2_MSG_KEXINIT sent
2017-10-31 19:18:38.438002500 debug1: SSH2_MSG_KEXINIT received
2017-10-31 19:18:38.438046500 debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
2017-10-31 19:18:38.438061500 debug2: kex_parse_kexinit: ssh-dss
2017-10-31 19:18:38.438063500 debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
2017-10-31 19:18:38.438083500 debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
2017-10-31 19:18:38.438087500 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
2017-10-31 19:18:38.438089500 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
2017-10-31 19:18:38.438111500 debug2: kex_parse_kexinit: none,zlib@openssh.com
2017-10-31 19:18:38.438113500 debug2: kex_parse_kexinit: none,zlib@openssh.com
2017-10-31 19:18:38.438115500 debug2: kex_parse_kexinit:
2017-10-31 19:18:38.438117500 debug2: kex_parse_kexinit:
2017-10-31 19:18:38.438137500 debug2: kex_parse_kexinit: first_kex_follows 0
2017-10-31 19:18:38.438139500 debug2: kex_parse_kexinit: reserved 0
2017-10-31 19:18:38.438141500 debug2: kex_parse_kexinit: ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
2017-10-31 19:18:38.438144500 debug2: kex_parse_kexinit: ssh-dss
2017-10-31 19:18:38.438146500 debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc
2017-10-31 19:18:38.438156500 debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc
2017-10-31 19:18:38.438158500 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha2-512,hmac-sha1-96,hmac-md5-96
2017-10-31 19:18:38.438160500 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha2-512,hmac-sha1-96,hmac-md5-96
2017-10-31 19:18:38.438183500 debug2: kex_parse_kexinit: none
2017-10-31 19:18:38.438185500 debug2: kex_parse_kexinit: none
2017-10-31 19:18:38.438187500 debug2: kex_parse_kexinit:
2017-10-31 19:18:38.438189500 debug2: kex_parse_kexinit:
2017-10-31 19:18:38.438190500 debug2: kex_parse_kexinit: first_kex_follows 0
2017-10-31 19:18:38.438192500 debug2: kex_parse_kexinit: reserved 0
2017-10-31 19:18:38.438216500 debug2: mac_setup: found hmac-md5
2017-10-31 19:18:38.438218500 debug1: kex: client->server aes128-ctr hmac-md5 none
2017-10-31 19:18:38.438220500 debug2: mac_setup: found hmac-md5
2017-10-31 19:18:38.438222500 debug1: kex: server->client aes128-ctr hmac-md5 none
2017-10-31 19:18:38.441469500 debug1: SSH2_MSG_KEXINIT received
2017-10-31 19:18:38.441515500 debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
2017-10-31 19:18:38.441534500 debug2: kex_parse_kexinit: ssh-dss
2017-10-31 19:18:38.441536500 debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
2017-10-31 19:18:38.441539500 debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
2017-10-31 19:18:38.441568500 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
2017-10-31 19:18:38.441571500 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
2017-10-31 19:18:38.441573500 debug2: kex_parse_kexinit: none,zlib@openssh.com
2017-10-31 19:18:38.441575500 debug2: kex_parse_kexinit: none,zlib@openssh.com
2017-10-31 19:18:38.441577500 debug2: kex_parse_kexinit:
2017-10-31 19:18:38.441593500 debug2: kex_parse_kexinit:
2017-10-31 19:18:38.441595500 debug2: kex_parse_kexinit: first_kex_follows 0
2017-10-31 19:18:38.441597500 debug2: kex_parse_kexinit: reserved 0
2017-10-31 19:18:38.441599500 debug2: kex_parse_kexinit: ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
2017-10-31 19:18:38.441602500 debug2: kex_parse_kexinit: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
2017-10-31 19:18:38.441640500 debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc
2017-10-31 19:18:38.441643500 debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc
2017-10-31 19:18:38.441645500 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha2-512,hmac-sha1-96,hmac-md5-96
2017-10-31 19:18:38.441648500 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha2-512,hmac-sha1-96,hmac-md5-96
2017-10-31 19:18:38.441717500 debug2: kex_parse_kexinit: none
2017-10-31 19:18:38.441719500 debug2: kex_parse_kexinit: none
2017-10-31 19:18:38.441720500 debug2: kex_parse_kexinit:
2017-10-31 19:18:38.441722500 debug2: kex_parse_kexinit:
2017-10-31 19:18:38.441724500 debug2: kex_parse_kexinit: first_kex_follows 0
2017-10-31 19:18:38.441726500 debug2: kex_parse_kexinit: reserved 0
2017-10-31 19:18:38.441728500 debug2: mac_setup: found hmac-md5
2017-10-31 19:18:38.441737500 debug1: kex: client->server aes128-ctr hmac-md5 none
2017-10-31 19:18:38.441739500 debug2: mac_setup: found hmac-md5
2017-10-31 19:18:38.441741500 debug1: kex: server->client aes128-ctr hmac-md5 none
2017-10-31 19:18:38.441743500 no hostkey alg
2017-10-31 19:18:38.441754500 debug1: do_cleanup
2017-10-31 19:18:38.441756500 debug1: do_cleanup
2017-10-31 19:18:38.442170500 tcpserver: end 89681 status 65280
2017-10-31 19:18:38.442172500 tcpserver: status: 3/40
2017-10-31 19:18:38.645853500 debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received
2017-10-31 19:18:38.651371500 debug2: monitor_read: 0 used once, disabling now
2017-10-31 19:18:38.651438500 debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
2017-10-31 19:18:38.681686500 debug2: dh_gen_key: priv key bits set: 134/256
2017-10-31 19:18:38.681732500 debug2: bits set: 1984/4096
2017-10-31 19:18:38.681748500 debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
2017-10-31 19:18:38.915990500 debug2: bits set: 2058/4096
2017-10-31 19:18:38.947730500 debug2: monitor_read: 4 used once, disabling now
2017-10-31 19:18:38.947754500 debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
2017-10-31 19:18:38.947865500 debug2: kex_derive_keys
2017-10-31 19:18:38.947886500 debug2: set_newkeys: mode 1
2017-10-31 19:18:38.947910500 debug1: SSH2_MSG_NEWKEYS sent
2017-10-31 19:18:38.947925500 debug1: expecting SSH2_MSG_NEWKEYS
2017-10-31 19:18:39.221370500 debug2: set_newkeys: mode 0
2017-10-31 19:18:39.221394500 debug1: SSH2_MSG_NEWKEYS received
2017-10-31 19:18:39.221396500 debug1: KEX done
2017-10-31 19:18:39.429183500 debug1: userauth-request for user e4b683c7-278e-4818-b08f-b11f20e2dda4 service ssh-connection method none
2017-10-31 19:18:39.429207500 debug1: attempt 0 failures 0
2017-10-31 19:18:39.429531500 debug2: parse_server_config: config reprocess config len 239
2017-10-31 19:18:39.429786500 Invalid user e4b683c7-278e-4818-b08f-b11f20e2dda4 from 104.192.139.229
2017-10-31 19:18:39.430161500 debug2: monitor_read: 6 used once, disabling now
2017-10-31 19:18:39.430163500 input_userauth_request: invalid user e4b683c7-278e-4818-b08f-b11f20e2dda4
2017-10-31 19:18:39.430165500 debug2: monitor_read: 3 used once, disabling now
2017-10-31 19:18:39.430167500 debug2: input_userauth_request: try method none
2017-10-31 19:18:39.541427500 debug1: userauth-request for user e4b683c7-278e-4818-b08f-b11f20e2dda4 service ssh-connection method publickey
2017-10-31 19:18:39.541452500 debug1: attempt 1 failures 0
2017-10-31 19:18:39.541464500 debug2: input_userauth_request: try method publickey
2017-10-31 19:18:39.541466500 debug2: userauth_pubkey: disabled because of invalid user
2017-10-31 19:18:39.650089500 Connection closed by 104.192.139.229
2017-10-31 19:18:39.650119500 debug1: do_cleanup
2017-10-31 19:18:39.650373500 debug1: do_cleanup
2017-10-31 19:18:39.650518500 tcpserver: end 89680 status 65280
2017-10-31 19:18:39.650546500 tcpserver: status: 2/40

 
Message has been deleted

Katsunori FUJIWARA

unread,
Oct 31, 2017, 8:22:31 AM10/31/17
to mercurial-ja
藀原です。

2017幎10月31日 18:45 ohira <shin....@gmail.com>:
枈みたせん。この文脈で、いきなり「docker コンテナ偎」ずいう話が
出おきお面食らっおいたす。

私の認識では:

- escm11 は、おおひらさんが保有するサヌバ (物理か仮想かは問いたせん)

- 「bitbucket ⇒ escm11」ずいう接続方向においお、bitbucket 偎が
escm11 䞊の sshd のフィンガヌプリントを取埗できない (ケヌスがある)

- 取埗できないケヌスでは "input_userauth_request: invalid user xxxxxx"
ずいうログが出力されおいる

ずいうものなので、あくたで (おおひらさんのケヌスにおける) escm11
においお、件のような問題が発生するずしたら、原因ずしお䜕が想定でき
るかずいう点にのみ着目しおいたす。

ですから、~/.ssh/ や ~/.ssh/authorized_keys も、bitbucket の
pipelines の蚭定で、ssh フィンガヌプリント取埗時に接続されるホスト
(おおひらさんのケヌスなら escm11) 䞊のものを想定しおいたす。

もしかしお、この段階で私の問題認識が間違っおいたりしたす


ちなみに、escm11 は PCBSD ず思われたすが、OS 皮別等はメヌルの郜床
明蚘しおもらえたすか過去メヌルを怜玢すれば䜕ずか特定できたすが、
流石に我々は「escm11 ⇒ PCBSD」ずは即座に連想できたせんので笑

たた、今回のようなケヌスなら sshd のバヌゞョン情報も䜵蚘しおもらえ
るず助かりたす。
先述したように、私が認識しおいる問題は「フィンガヌプリント取埗で
bitbucket ⇒ escm11 の接続が倱敗する」ずいうものなので、䞻語は抂ね
「(フィンガヌプリントを fetch しようずしおいる) bitbucket」です。

䞊蚘の挙動 (= 名前の生成 + ssh ログむン) の䞻語も bitbucket です。



>> しかし、これたでに述べた事柄から、珟状では、フィンガヌプリント取埗
>> においお、ナヌザ名指定付きで認蚌実斜段階に到達するこずはないように
>> 芋えたす。
>>
>> 詊しに、at_2 リポゞトリでの escm11 のフィンガヌプリント取埗を、
>> 「SSH 鍵察の生成」無し (= ~/.ssh/authorized_keys ぞの远加もなし)
>> で、再床行っおみおもらえたすか
>>
>> たた、at_2 でのフィンガヌプリント取埗が盞倉わらず駄目な堎合、適圓
>> に遞んだ第のリポゞトリでの escm11 のフィンガヌプリント取埗も同じ
>> ように倱敗するか、確認しおみおもらえたすか
>
> 今日はbitbucketの調子が悪いようで、第䞉のリポゞトリ䜜れたせんでした、日をあらためお再床やっおみたす。
>
> ~/.ssh/authorized_keys は コンテナ偎のものをさしおいたすか?

先述したように、私が認識しおいる問題は「フィンガヌプリント取埗で
bitbucket ⇒ escm11 の接続が倱敗する」ずいうものなので、~/.ssh は
escm11 䞊のものです。


先のメヌルでも蚀及したしたが、escm11 ずの連携が䞊手くいかない状況
が続くようであれば、bitbucket の公匏 issue tracker に報告した方が
良いず思いたす。(OS/sshd バヌゞョン明蚘をお忘れなく)

https://bitbucket.org/site/master/issues?status=new&status=open
https://bitbucket.org/site/master/wiki/Home



> ホスト偎のファむルはナヌザヌが確認する手段がありたせん。
> 自分が衚瀺しおいたコンテナ偎のものは
> ナヌザヌが远加しおいるわけではなくお、Dockerのホスト偎で取埗したものが
> 勝手に远加されおいるのず、Dockerコンテナ内の hg pull で勝手に远加されたものが合わさったものです。
>>
>>
>> > 2017-09-27 12:20:36.087582500 debug2: monitor_read: 3 used once,
>> > disabling now
>> > 2017-09-27 12:20:36.087708500 debug2: input_userauth_request: try method
>> > none
>> > 2017-09-27 12:20:36.193670500 debug1: userauth-request for user
>> > 0e1e2be0-d661-48ca-9d0c-619575155a83 service ssh-connection method
>> > publickey
>> > 2017-09-27 12:20:36.193689500 debug1: attempt 1 failures 0
>> > 2017-09-27 12:20:36.193721500 debug2: input_userauth_request: try method
>> > publickey
>> > 2017-09-27 12:20:36.193739500 debug2: userauth_pubkey: disabled because
>> > of invalid user
>> > 2017-09-27 12:20:36.299544500 Connection closed by 104.192.139.229
>> > 2017-09-27 12:20:36.299563500 debug1: do_cleanup
>> > 2017-09-27 12:20:36.299745500 debug1: do_cleanup
>> > 2017-09-27 12:20:36.299885500 tcpserver: end 85278 status 65280
>> > 2017-09-27 12:20:36.299887500 tcpserver: status: 3/40
>>
> --
> from Mercurial 日本語コミュニティ <mercur...@googlegroups.com>
> ※ ヘルプ衚瀺は http://groups.google.com/group/mercurial-ja?hl=ja
> ---
> このメヌルは Google グルヌプのグルヌプ「mercurial-ja」に登録しおいるナヌザヌに送られおいたす。
> このグルヌプから退䌚し、グルヌプからのメヌルの配信を停止するには mercurial-ja...@googlegroups.com
> にメヌルを送信しおください。
> その他のオプションに぀いおは https://groups.google.com/d/optout にアクセスしおください。



--
----------------------------------------------------------------------
FUJIWARA Katsunori(flying...@gmail.com)

ohira

unread,
Nov 7, 2017, 9:02:42 PM11/7/17
to mercurial-ja


2017幎10月31日火曜日 21時22分31秒 UTC+9 FUJIWARA Katsunori:
dockerコンテナ偎ならパスの確認しようもあるのですが、そうじゃないずするず具䜓的にどのようなパスになりたすか?

接続先のホストのファむルなら実圚しないナヌザヌのホヌムディレクトリはないはずだし、、、
無䜜為に生成したナヌザヌ名が接続先に存圚するわけではないので
~/ はどこになるのでしょうか。

Katsunori FUJIWARA

unread,
Nov 13, 2017, 8:00:54 AM11/13/17
to mercurial-ja
藀原です。

2017幎11月8日 11:02 ohira <shin....@gmail.com>:
改めお私の掚枬を以䞋にたずめたすが、ここで「~/.ssh を確認」しよう
ずしおいるのは、「escm11 䞊の sshd」です (存圚しないから圓然゚ラヌ
になりたす)。

escm11 に察する bitbucket からの SSH 接続が、「escm11 の公開鍵
情報の取埗」手順を通り越しお、接続時に指定した ( 存圚しない
筈の) ナヌザの ~/.ssh を確認する段階たで進んでしたっおいる (+
確認倱敗をもっお公開鍵取埗も倱敗ずみなしおいる) ように芋える。

公開鍵情報の取埗を䞻県ずする凊理においお、「指定ナヌザの
~/.ssh 所圚確認」手順たで進んだ䞊に、そこでの゚ラヌをもっお
「公開鍵情報取埗の倱敗」ずみなしおいるのは、(bitbucket 偎ずし
おも) 想定倖の挙動なのでは

おおひらさんに察しお「(存圚しないナヌザの) ~/.ssh の確認」等々をお
願いしおいる蚳ではないです (存圚しないナヌザのものですから、確認し
ようがありたせん)。


少なくずも Linux 䞊の Open SSH 実装では、「sshd ホスト偎公開鍵の取
埗」時点では、接続時に指定したナヌザの ~/.ssh 所圚の確認等は行っお
いるようには芋えたせん。

プロトコル仕様によっお、ある皋床挙動が定たりたすから、sshd の実装
によっお極端に挙動が異なるこずは無いずは思いたすが、特定条件䞋で継
続的に問題が発生するのであれば、環境䟝存性のある問題ずしお、
bitbucket 偎に報告した方が良いのではずいうのが私の芋解です。
--
----------------------------------------------------------------------
FUJIWARA Katsunori(flying...@gmail.com)
Reply all
Reply to author
Forward
0 new messages