質問するログイン新規登録

質問編集履歴

3

やったこと

2021/04/10 08:46

投稿

dlrow
dlrow

スコア22

title CHANGED
File without changes
body CHANGED
@@ -29,6 +29,7 @@
29
29
  tcp 0 0 localhost:3128 0.0.0.0:* LISTEN
30
30
  tcp6 0 0 localhost:3128 [::]:* LISTEN
31
31
  ```
32
+ - remoteにて`socat tcp4-listen:3128,reuseaddr,fork TCP:127.0.0.1:3128`を実行しました。結果、`E bind(5, {AF=2 0.0.0.0:3128}, 16): Address already in use`というメッセージがでてエラーになりました。netstat、lsofで確認しましたが、`0.0.0.0:3128`は使われていないみたいです。
32
33
 
33
34
  # 補足
34
35
  - GatewayPortsの設定を使わず別の手法を用いて、同じことを実現することはできると思います。しかし、できるだけこのやり方でやりたいです。

2

SSHの設定ファイルを投稿

2021/04/10 08:46

投稿

dlrow
dlrow

スコア22

title CHANGED
File without changes
body CHANGED
@@ -33,5 +33,66 @@
33
33
  # 補足
34
34
  - GatewayPortsの設定を使わず別の手法を用いて、同じことを実現することはできると思います。しかし、できるだけこのやり方でやりたいです。
35
35
 
36
+ # SSHの設定ファイル
37
+ GatewayPorts以外何もいじっていません。
38
+ ```
39
+ #KerberosOrLocalPasswd yes
40
+ #KerberosTicketCleanup yes
41
+ #KerberosGetAFSToken no
42
+
43
+ # GSSAPI options
44
+ #GSSAPIAuthentication no
45
+ #GSSAPICleanupCredentials yes
46
+ #GSSAPIStrictAcceptorCheck yes
47
+ #GSSAPIKeyExchange no
48
+
49
+ # Set this to 'yes' to enable PAM authentication, account processing,
50
+ # and session processing. If this is enabled, PAM authentication will
51
+ # be allowed through the ChallengeResponseAuthentication and
52
+ # PasswordAuthentication. Depending on your PAM configuration,
53
+ # PAM authentication via ChallengeResponseAuthentication may bypass
54
+ # the setting of "PermitRootLogin without-password".
55
+ # If you just want the PAM account and session checks to run without
56
+ # PAM authentication, then enable this but set PasswordAuthentication
57
+ # and ChallengeResponseAuthentication to 'no'.
58
+ UsePAM yes
59
+
60
+ #AllowAgentForwarding yes
61
+ #AllowTcpForwarding yes
62
+ GatewayPorts yes
63
+ X11Forwarding yes
64
+ #X11DisplayOffset 10
65
+ #X11UseLocalhost yes
66
+ #PermitTTY yes
67
+ PrintMotd no
68
+ #PrintLastLog yes
69
+ #TCPKeepAlive yes
70
+ #PermitUserEnvironment no
71
+ #Compression delayed
72
+ #ClientAliveInterval 0
73
+ #ClientAliveCountMax 3
74
+ #UseDNS no
75
+ #PidFile /var/run/sshd.pid
76
+ #MaxStartups 10:30:100
77
+ #PermitTunnel no
78
+ #ChrootDirectory none
79
+ #VersionAddendum none
80
+
81
+ # no default banner path
82
+ #Banner none
83
+
84
+ # Allow client to pass locale environment variables
85
+ AcceptEnv LANG LC_*
86
+
87
+ # override default of no subsystems
88
+ Subsystem sftp /usr/lib/openssh/sftp-server
89
+
90
+ # Example of overriding settings on a per-user basis
91
+ #Match User anoncvs
92
+ # X11Forwarding no
93
+ # AllowTcpForwarding no
94
+ # PermitTTY no
95
+ # ForceCommand cvs server
96
+ ```
36
97
  # 参考にしたもの
37
98
  https://blog.cles.jp/item/5699

1

タイトルの修正

2021/04/10 06:47

投稿

dlrow
dlrow

スコア22

title CHANGED
File without changes
body CHANGED
@@ -4,7 +4,7 @@
4
4
  **全体のイメージ**
5
5
  remote <==ssh== host
6
6
 
7
- **remoteについて**
7
+ **remote**
8
8
  GCPのVMインスタンス
9
9
  OSはdebian
10
10
 
@@ -13,14 +13,13 @@
13
13
  OSはubuntu
14
14
  localhost:3128にてnginxが起動している
15
15
 
16
- # 手順
16
+ # 実施した手順
17
17
  0. hostにて`vi /etc/ssh/sshd_config`でGatewayPortsの設定値をclientspecifiedに設定する
18
18
  0. hostにて`/etc/init.d/ssh reload`を実行する
19
19
  0. hostにて`ssh -R remoteのプライペートIP:3128:localhost:3128 -i ssh_key user@remoteのパブリックIP`を実行する
20
20
  0. remoteにて`curl localhost:3128`を実行すると、htmlファイルが帰って来て接続がリモートフォーワーディング自体がうまく行っていることが確認できる
21
21
  0. remoteにて`curl remoteのプライペートIP:3128`を実行すると、`curl: (7) Failed to connect to remoteのプライペートIP port 3128: Connection refused`というメッセージが表示される
22
22
 
23
-
24
23
  # やったこと
25
24
  - `/etc/init.d/ssh reload`で設定を反映させる
26
25
  - OSをubuntuからdebianに変えて同じことを試す