Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-shell
Commits
aec81968
Commit
aec81968
authored
Jun 10, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #62 from knu/use_cert_store
Add ca_file/ca_path configuration options.
parents
5519420e
932238eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
config.yml.example
config.yml.example
+2
-0
lib/gitlab_net.rb
lib/gitlab_net.rb
+21
-3
No files found.
config.yml.example
View file @
aec81968
...
...
@@ -7,6 +7,8 @@ gitlab_url: "http://localhost/"
http_settings:
# user: someone
# password: somepass
# ca_file: /etc/ssl/cert.pem
# ca_path: /etc/pki/tls/certs
self_signed_cert: false
# Repositories path
...
...
lib/gitlab_net.rb
View file @
aec81968
...
...
@@ -42,10 +42,14 @@ class GitlabNet
def
get
(
url
)
url
=
URI
.
parse
(
url
)
http
=
Net
::
HTTP
.
new
(
url
.
host
,
url
.
port
)
http
.
use_ssl
=
(
url
.
scheme
==
'https'
)
if
config
.
http_settings
[
'self_signed_cert'
]
&&
http
.
use_ssl?
http
.
verify_mode
=
OpenSSL
::
SSL
::
VERIFY_NONE
if
URI
::
HTTPS
===
url
http
.
use_ssl
=
true
http
.
cert_store
=
cert_store
if
config
.
http_settings
[
'self_signed_cert'
]
http
.
verify_mode
=
OpenSSL
::
SSL
::
VERIFY_NONE
end
end
request
=
Net
::
HTTP
::
Get
.
new
(
url
.
request_uri
)
...
...
@@ -55,4 +59,18 @@ class GitlabNet
http
.
start
{
|
http
|
http
.
request
(
request
)
}
end
def
cert_store
@cert_store
||=
OpenSSL
::
X509
::
Store
.
new
.
tap
{
|
store
|
store
.
set_default_paths
if
ca_file
=
config
.
http_settings
[
'ca_file'
]
store
.
add_file
(
ca_file
)
end
if
ca_path
=
config
.
http_settings
[
'ca_path'
]
store
.
add_path
(
ca_path
)
end
}
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment