質問編集履歴

7

丁寧にした

2017/10/24 03:25

投稿

kimurayu
kimurayu

スコア158

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- --解決しました。ベストアンサー内容ですが、書いておきます。
1
+ --解決しました。ベストアンサーでいただいた内容ですが、書いておきます。ありがとうございます。
2
2
 
3
3
 
4
4
 

6

解放を記入

2017/10/24 03:25

投稿

kimurayu
kimurayu

スコア158

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,39 @@
1
+ --解決しました。ベストアンサーの内容ですが、書いておきます。
2
+
3
+
4
+
5
+ ```
6
+
7
+ $ sudo gestsebool httpd_can_network_connect on
8
+
9
+ ```
10
+
11
+
12
+
13
+ を設定したら動く様になりました。
14
+
15
+
16
+
17
+ [こちら](http://siburu.hatenablog.com/entry/2014/10/07/012707) を見させていただきました。
18
+
19
+
20
+
21
+ --  
22
+
23
+     
24
+
25
+
26
+
27
+
28
+
29
+ -------
30
+
31
+
32
+
33
+
34
+
35
+
36
+
1
37
  http://hogehogehoge.jp/index.rb をブラウザで開き、index.rb の中で open_uri で外部サーバからデータを取得しようとすると権限エラーが発生して何も取得できません。
2
38
 
3
39
  しかし何の権限なのか分かりません。何の権限をどう直せば良いでしょうか。

5

説明記載

2017/10/24 03:18

投稿

kimurayu
kimurayu

スコア158

test CHANGED
File without changes
test CHANGED
@@ -21,6 +21,10 @@
21
21
  hogehogehoge.jp にターミナルからsshでアクセスして直接 ruby index.rb を実行すると取得できます。
22
22
 
23
23
 
24
+
25
+
26
+
27
+ 以下ブラウザから実行時のエラーメッセージ
24
28
 
25
29
  ```
26
30
 

4

エラー記載

2017/10/24 01:06

投稿

kimurayu
kimurayu

スコア158

test CHANGED
File without changes
test CHANGED
@@ -19,3 +19,71 @@
19
19
  ```
20
20
 
21
21
  hogehogehoge.jp にターミナルからsshでアクセスして直接 ruby index.rb を実行すると取得できます。
22
+
23
+
24
+
25
+ ```
26
+
27
+ /etct/httpd/logs/error_logs
28
+
29
+
30
+
31
+
32
+
33
+ [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)
34
+
35
+ [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] (
36
+
37
+ [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] Errno::EACCES
38
+
39
+ [Mon Oct 23 01:10:10 2017] [error] [client ooo.oo.ooo.oo] )
40
+
41
+ [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'
42
+
43
+ [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'
44
+
45
+ [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'
46
+
47
+ [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'
48
+
49
+ [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'
50
+
51
+ [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'
52
+
53
+ [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'
54
+
55
+ [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'
56
+
57
+ [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'
58
+
59
+ [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'
60
+
61
+ [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'
62
+
63
+ [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'
64
+
65
+ [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名)'
66
+
67
+ [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>'
68
+
69
+ ```
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ ```
80
+
81
+
82
+
83
+ /var/log/audit/audit.log
84
+
85
+
86
+
87
+ 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'
88
+
89
+ ```

3

コードミス

2017/10/24 01:06

投稿

kimurayu
kimurayu

スコア158

test CHANGED
File without changes
test CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  io = OpenURI.open_uri(url)
16
16
 
17
- puts = io.read
17
+ puts io.read
18
18
 
19
19
  ```
20
20
 

2

日本語おかしい

2017/10/23 01:45

投稿

kimurayu
kimurayu

スコア158

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- http://hogehogehoge.jp/index.rb をブラウザで開き、index.rb の中で open_uri で外部サイト のデータを取得しようとすると権限エラーが発生して何も取得できません。
1
+ http://hogehogehoge.jp/index.rb をブラウザで開き、index.rb の中で open_uri で外部サーバからデータを取得しようとすると権限エラーが発生して何も取得できません。
2
2
 
3
3
  しかし何の権限なのか分かりません。何の権限をどう直せば良いでしょうか。
4
4
 

1

タイトルの日本語

2017/10/23 01:44

投稿

kimurayu
kimurayu

スコア158

test CHANGED
@@ -1 +1 @@
1
- cgi から get リクエストするのに何か権限が必要でしょうか。
1
+ cgi から get リクエストする権限エラーになる
test CHANGED
File without changes