「Gateone」の版間の差分
表示
削除された内容 追加された内容
翻訳 |
Blackteahamburger (トーク | 投稿記録) アーカイブ タグ: 新規リダイレクト |
||
| (2人の利用者による、間の2版が非表示) | |||
| 1行目: | 1行目: | ||
#redirect [[ArchWiki:アーカイブ]] |
|||
[[Category:ネットワーク]] |
|||
[[Category: |
[[Category:アーカイブ]] |
||
[[en:Gateone]] |
|||
[http://liftoffsoftware.com/Products/GateOne Gate One ✈ Web Terminal Emulator and SSH Client] より: |
|||
:''Gate One™ はコマンドラインの力をウェブにもたらすウェブベースのターミナルエミュレータであり SSH クライアントです。ブラウザプラグインは必要とせず、強力なプラグインシステムによって外観・機能をカスタマイズすることができます。'' |
|||
Gate One を使うことでウェブから SSH サーバーにアクセスすることができおます。似たようなソフトウェアとして [http://guac-dev.org/ Guacamole] が存在します。Gate One の特徴として他のブラウザからセッションを復帰したりセッションを再生することが可能です。 |
|||
このガイドでは [[nginx]] をリバースプロキシとして使用して Gate One をセットアップする方法を説明します。 |
|||
== インストール == |
|||
Gate One は [[AUR]] から {{AUR|gateone-git}} パッケージでインストールできます。 |
|||
=== 任意の依存パッケージ === |
|||
ユーザーのセッション接続を保ったまま Gate One をアップグレード (再起動) したい場合、[[dtach]] をインストールしてください。デフォルトで設定オプションが有効になっています。 |
|||
== 設定 == |
|||
{{Warning|デフォルトでは gateone は匿名ユーザーからのアクセスを許可しています。設定を変更するようにしてください。}} |
|||
インストールが完了したら gateone を起動して自己署名 ssl 証明書とデフォルト設定を生成します: |
|||
# gateone |
|||
そして設定を自由に編集してください。デフォルトでは {{ic|/etc/gateone/conf.d/}} に3つの設定ファイルが存在します。 |
|||
全てのオプションは http://liftoff.github.io/GateOne/About/index.html#configuration で解説されています。 |
|||
=== メイン設定 === |
|||
メインのサーバー設定は {{ic|/etc/gateone/conf.d/10server.conf}} にあります。 |
|||
{{hc|/etc/gateone/conf.d/10server.conf|2=<nowiki> |
|||
{ |
|||
// "gateone" server-wide settings fall under "*" |
|||
"*": { |
|||
"gateone": { // These settings apply to all of Gate One |
|||
"address": "", |
|||
"ca_certs": null, |
|||
"cache_dir": "/tmp/gateone_cache", |
|||
"certificate": "/etc/gateone/ssl/certificate.pem", |
|||
"combine_css": "", |
|||
"combine_css_container": "gateone", |
|||
"combine_js": "", |
|||
"cookie_secret": "ZTRiOGUzNjM5ZmNjNDJjODllNDRmODk3Y2RjZTVlNTc4M", |
|||
"debug": false, |
|||
"disable_ssl": false, |
|||
"embedded": false, |
|||
"enable_unix_socket": false, |
|||
"gid": "0", |
|||
"https_redirect": false, |
|||
"js_init": "", |
|||
"keyfile": "/etc/gateone/ssl/keyfile.pem", |
|||
"locale": "en_US", |
|||
"log_file_max_size": 100000000, |
|||
"log_file_num_backups": 10, |
|||
"log_file_prefix": "/var/log/gateone/gateone.log", |
|||
"log_to_stderr": null, |
|||
"logging": "info", |
|||
"origins": ["localhost", "127.0.0.1", "10.1.1.100"], |
|||
"pid_file": "/var/run/gateone.pid", |
|||
"port": 443, |
|||
"session_dir": "/tmp/gateone", |
|||
"session_timeout": "5d", |
|||
"syslog_facility": "daemon", |
|||
"syslog_host": null, |
|||
"uid": "0", |
|||
"unix_socket_path": "/tmp/gateone.sock", |
|||
"url_prefix": "/", |
|||
"user_dir": "/var/lib/gateone/users", |
|||
"user_logs_max_age": "30d" |
|||
} |
|||
} |
|||
} |
|||
</nowiki>}} |
|||
* {{Ic|"address": ""}} は Gate One で使用するアドレスを指定します。例えば {{Ic|"address": "localhost;::1;10.1.1.100"}} とした場合 Gate One は localhost (IPv4 と IPv6) と 10.1.1.100 を listen します。 |
|||
* SSL のオフロードを別のところで処理する場合 {{Ic|"disable_ssl": false}} を true にしてください。 |
|||
* {{Ic|"origins": ["localhost", "127.0.0.1", "serverhostname", "10.1.1.100", "full.domain.name",}} には Gate One に接続するときに使用する URL を追加します。 |
|||
* {{Ic|"port": 443}} は Gate One が使用する TCP ポートです。 |
|||
* {{Ic|"url_prefix": "/"}} には URL のパスを設定します。"/gateone/" と設定した場合、アドレスは https://10.1.1.100/gateone/ になります。 |
|||
=== 認証設定 === |
|||
認証設定は {{ic|/etc/gateone/conf.d/20authentication.conf}} にあります。 |
|||
{{hc|/etc/gateone/conf.d/20authentication.conf|2=<nowiki> |
|||
// This is Gate One's authentication settings file. |
|||
{ |
|||
// "gateone" server-wide settings fall under "*" |
|||
"*": { |
|||
"gateone": { // These settings apply to all of Gate One |
|||
"api_timestamp_window": "30s", |
|||
"auth": "none", |
|||
"pam_realm": "hostname", |
|||
"pam_service": "login", |
|||
"ssl_auth": "none", |
|||
"sso_keytab": null, |
|||
"sso_realm": null, |
|||
"sso_service": "HTTP" |
|||
} |
|||
} |
|||
} |
|||
</nowiki>}} |
|||
* {{Ic|"auth": "none"}} には "none", "pam", google", "kerberos", "api" のどれかを指定できます。 |
|||
==== None ==== |
|||
None は認証を行いません。匿名アクセスが許可されます。セッションはブラウザの cookie と紐付けられます。 |
|||
==== PAM ==== |
|||
PAM 認証を使うことでローカルユーザーで認証することができます。さらに htpasswd ファイルで認証することなども可能です。{{AUR|libpam_pwdfile}} が必要です。 |
|||
{{hc|/etc/gateone/conf.d/20authentication.conf|2=<nowiki> |
|||
"auth": "pam" |
|||
"pam_service": "gateonepwd" |
|||
</nowiki>}} |
|||
Gate One は Crypt 暗号化を使用するため {{ic|-d}} スイッチを使ってください: |
|||
# htpasswd -c -d /etc/gateone/users.passwd user1 |
|||
PAM サービスファイルを作成してください。空白は全て {{ic|<TAB>}} なので注意してください。 |
|||
{{hc|/etc/pam.d/gateonepwd|2=<nowiki> |
|||
#%PAM-1.0 |
|||
# Login using a htpasswd file |
|||
#@include common-sessionauth |
|||
auth required pam_pwdfile.so pwdfile /etc/gateone/users.passwd |
|||
account required pam_permit.so |
|||
</nowiki>}} |
|||
==== Google ==== |
|||
Google Authentication は Google で認証を行います (Gmail または Google+)。 |
|||
=== ターミナル設定 === |
|||
ターミナルとオプションを追加することができます。詳しくは https://github.com/liftoff/GateOne/blob/master/gateone/applications/terminal/docs/configuration.rst を見てください。 |
|||
{{ic|example@gmail.com}} と {{ic|test@gmail.com}} で SSH アプリケーションへのアクセスを許可する例: |
|||
{{hc|/etc/gateone/conf.d/20authentication.conf|2=<nowiki> |
|||
// This is Gate One's Terminal application settings file. |
|||
{ |
|||
// "*" means "apply to all users" or "default" |
|||
"*": { |
|||
"terminal": { // These settings apply to the "terminal" application |
|||
"commands": { |
|||
"SSH": {"command": "/usr/lib/python2.7/site-packages/gateone/applications/terminal/plugins/ssh/scripts/ssh_connect.py -S '%SESSION_DIR%/%SESSION%/%SHORT_SOCKET%' --sshfp -a '-oUserKnownHostsFile=\\\"%USERDIR%/%USER%/ |
|||
.ssh/known_hosts\\\"'", "description": "Connect to hosts via SSH."} |
|||
}, |
|||
"default_command": "SSH", |
|||
"dtach": true, |
|||
"environment_vars": {"TERM": "xterm-256color"}, |
|||
"session_logging": true, |
|||
"syslog_session_logging": false, |
|||
"allow": false |
|||
} |
|||
}, |
|||
// "*" means "apply to all users" or "default" |
|||
"user.upn=(example@gmail.com|test@gmail.com)": { |
|||
"terminal": { // These settings apply to the "terminal" application |
|||
"commands": { |
|||
"SSH": {"command": "/usr/lib/python2.7/site-packages/gateone/applications/terminal/plugins/ssh/scripts/ssh_connect.py -S '%SESSION_DIR%/%SESSION%/%SHORT_SOCKET%' --sshfp -a '-oUserKnownHostsFile=\\\"%USERDIR%/%USER%/ |
|||
.ssh/known_hosts\\\"'", "description": "Connect to hosts via SSH."} |
|||
}, |
|||
"default_command": "SSH", |
|||
"dtach": true, |
|||
"environment_vars": {"TERM": "xterm-256color"}, |
|||
"session_logging": true, |
|||
"syslog_session_logging": false, |
|||
"allow": true |
|||
} |
|||
} |
|||
} |
|||
</nowiki>}} |
|||
=== リバースプロキシ === |
|||
リバースプロキシを使って SSL を処理したり同一の IP アドレスで Gate One 以外を使うことができるようになります。ただし Gate One は WebSocket を使用するためリバースプロキシが WebSocket に対応している必要があります。 |
|||
==== Nginx ==== |
|||
Gate One サーバーが使用するポートを ([[iptables]] など) ファイアウォールによって塞ぐか、あるいは Gate One と nginx を同一サーバー上で動かす場合、ローカルホストだけを listen するようにしてください。詳しくは [[Nginx]] を参照。 |
|||
nginx の設定ファイルを以下のように編集してください: |
|||
{{Note|以下には nginx 設定の server 部分だけを記載しています。}} |
|||
{{hc|/etc/nginx/nginx.conf|<nowiki> |
|||
# HTTPS server |
|||
server { |
|||
listen [::]:443; |
|||
listen 443; |
|||
server_name mysslhost; |
|||
ssl on; |
|||
ssl_certificate server.crt; |
|||
ssl_certificate_key server.key; |
|||
ssl_session_timeout 5m; |
|||
ssl_prefer_server_ciphers on; |
|||
location /gateone/ { |
|||
#auth_basic "Restricted"; #One extra layer of authentication |
|||
#auth_basic_user_file /etc/nginx/.htpasswd; |
|||
proxy_pass_header Server; |
|||
proxy_set_header Host $http_host; |
|||
proxy_redirect off; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Scheme $scheme; |
|||
proxy_pass http://localhost:8888; |
|||
proxy_http_version 1.1; |
|||
proxy_set_header Upgrade $http_upgrade; |
|||
proxy_set_header Connection "upgrade"; |
|||
} |
|||
location /other { |
|||
rewrite /other/(.*) /$1 break; |
|||
include /etc/nginx/proxy.conf; |
|||
proxy_pass http://10.1.1.200:80; |
|||
break; |
|||
} |
|||
} |
|||
</nowiki>}} |
|||
{{Note|上記の設定を使うには以下のように Gate One を設定する必要があります。}} |
|||
{{hc|/etc/gateone/conf.d/10server.conf|<nowiki> |
|||
"disable_ssl": true, |
|||
"https_redirect": false, |
|||
"port": 8888, |
|||
"url_prefix": "/gateone/" |
|||
</nowiki>}} |
|||
Gate One には {{ic|<nowiki>https://your-nginx-server:443/gateone/</nowiki>}} からアクセスできます。 |
|||
== Systemd の統合 == |
|||
Gate One パッケージには [[systemd]] のサービスファイルが付属しています: {{ic|gateone.service}}。 |
|||
== トラブルシューティング == |
|||
Gate One でターミナルを開けないという問題が報告されています。原因は Gate One が {{ic|python}} を実行しようとするためです。[[Python#Python 2]] を参照してください。 |
|||
2020年7月18日 (土) 18:26時点における最新版
転送先: