--解決しました。ベストアンサーでいただいた内容ですが、書いておきます。ありがとうございます。
$ sudo gestsebool httpd_can_network_connect on
を設定したら動く様になりました。
こちら を見させていただきました。
--
http://hogehogehoge.jp/index.rb をブラウザで開き、index.rb の中で open_uri で外部サーバからデータを取得しようとすると権限エラーが発生して何も取得できません。
しかし何の権限なのか分かりません。何の権限をどう直せば良いでしょうか。
ruby
1index.rb 2 3require 'open-uri' 4url = 'https://hogehoge.com?sample.cgi?a=1&b=2&c=3' 5io = OpenURI.open_uri(url) 6puts io.read
hogehogehoge.jp にターミナルからsshでアクセスして直接 ruby index.rb を実行すると取得できます。
以下ブラウザから実行時のエラーメッセージ
/etct/httpd/logs/error_logs [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] Failed to open TCP connection to hogehoge.jp:443 (Permission denied - connect(2) for "hogehoge.jp" port 443) [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] ( [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] Errno::EACCES [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] ) [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] \tfrom /usr/local/bin/rbenv/versions/2.4.2/lib/ruby/2.4.0/net/http.rb:903:in `block in connect' [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] \tfrom /usr/local/bin/rbenv/versions/2.4.2/lib/ruby/2.4.0/timeout.rb:93:in `block in timeout' [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] \tfrom /usr/local/bin/rbenv/versions/2.4.2/lib/ruby/2.4.0/timeout.rb:103:in `timeout' [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] \tfrom /usr/local/bin/rbenv/versions/2.4.2/lib/ruby/2.4.0/net/http.rb:902:in `connect' [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] \tfrom /usr/local/bin/rbenv/versions/2.4.2/lib/ruby/2.4.0/net/http.rb:887:in `do_start' [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] \tfrom /usr/local/bin/rbenv/versions/2.4.2/lib/ruby/2.4.0/net/http.rb:876:in `start' [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] \tfrom /usr/local/bin/rbenv/versions/2.4.2/lib/ruby/2.4.0/open-uri.rb:323:in `open_http' [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] \tfrom /usr/local/bin/rbenv/versions/2.4.2/lib/ruby/2.4.0/open-uri.rb:741:in `buffer_open' [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] \tfrom /usr/local/bin/rbenv/versions/2.4.2/lib/ruby/2.4.0/open-uri.rb:212:in `block in open_loop' [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] \tfrom /usr/local/bin/rbenv/versions/2.4.2/lib/ruby/2.4.0/open-uri.rb:210:in `catch' [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] \tfrom /usr/local/bin/rbenv/versions/2.4.2/lib/ruby/2.4.0/open-uri.rb:210:in `open_loop' [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] \tfrom /usr/local/bin/rbenv/versions/2.4.2/lib/ruby/2.4.0/open-uri.rb:151:in `open_uri' [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] \tfrom /var/www/html/paper/paper0.12/web-client/index.rb:117:in `(リクエストURL名)' [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] \tfrom /var/www/html/paper/paper0.12/web-client/index.rb:120:in `<main>'
/var/log/audit/audit.log type=USER_ERR msg=audit(oooooooooo.ooo:oooooo): user pid=26217 uid=0 auid=500 ses=2924 subj=unconfined_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=PAM:bad_ident acct="?" exe="/usr/sbin/sshd" hostname=oooo.oooo.hogehoge.jp addr=ooo.oo.ooo.oo terminal=ssh res=failed'
回答1件
あなたの回答
tips
プレビュー