localhost 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 645f6d3160f878906fedd5129d3941b5d05a1072bc40da1aa4c95200bf5d7faa
4
- data.tar.gz: 4266815c74d38f8b099f45e07dcc2bea6af3a056055fbfe6f7208422cd06ef1d
3
+ metadata.gz: 43b262a968bffc41686157f8aeb624e0521827a90e33e73c6611296bd6e73e87
4
+ data.tar.gz: edef20da4668a9b95afe5c20da1a6d967ab6af0cfb920b8f5359d9c206ca6bee
5
5
  SHA512:
6
- metadata.gz: 6bbe70b4011f0da73a79da43bb215af49cca9c00944acc9a2a3d858097212848080d7c39981aa247264fc49aa0637aa6e0d665c91d33600c8d92c0bf50f2daa1
7
- data.tar.gz: 524195981b8dc2cbb545095adf152aa778a16c1e8792d2fe639b64e3dc05e70f072c8b3ed5223a16d9112bd50be2a5b4ffa15b63b78f2b55f25077762394bcc9
6
+ metadata.gz: bd194a986200716fcc1989e6048269f399f7b91c4ec7e03c5214dd7e815da067ec854e079abedb1ca55fd0e260a0b787c0436a85e4f849baecb77ae583f9ed06
7
+ data.tar.gz: 98288d9c362a8d9f7b1fdd23bf5b24c110652cd480eb17a38218e16384155385ecbc87a5e210ea1fa02dd4c210297898dd2dac0fc81d6503ae086a08b1972501
@@ -68,7 +68,7 @@ module Localhost
68
68
  end
69
69
 
70
70
  def name
71
- @name ||= OpenSSL::X509::Name.parse("O=Development/CN=#{@hostname}")
71
+ @name ||= OpenSSL::X509::Name.parse("/O=Development/CN=#{@hostname}")
72
72
  end
73
73
 
74
74
  def name= name
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Localhost
22
- VERSION = "1.1.6"
22
+ VERSION = "1.1.7"
23
23
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localhost
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-29 00:00:00.000000000 Z
11
+ date: 2021-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: covered
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
28
+ name: covered
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -66,31 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
- description:
69
+ description:
70
70
  email:
71
- - samuel.williams@oriontransfer.co.nz
72
71
  executables: []
73
72
  extensions: []
74
73
  extra_rdoc_files: []
75
74
  files:
76
- - ".editorconfig"
77
- - ".gitignore"
78
- - ".rspec"
79
- - ".travis.yml"
80
- - Gemfile
81
- - README.md
82
- - Rakefile
83
- - examples/https.rb
84
75
  - lib/localhost.rb
85
76
  - lib/localhost/authority.rb
86
77
  - lib/localhost/version.rb
87
- - localhost.gemspec
88
- - media/chrome.png
89
- - media/safari.png
90
78
  homepage: https://github.com/socketry/localhost
91
- licenses: []
79
+ licenses:
80
+ - MIT
92
81
  metadata: {}
93
- post_install_message:
82
+ post_install_message:
94
83
  rdoc_options: []
95
84
  require_paths:
96
85
  - lib
@@ -105,8 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
94
  - !ruby/object:Gem::Version
106
95
  version: '0'
107
96
  requirements: []
108
- rubygems_version: 3.0.3
109
- signing_key:
97
+ rubygems_version: 3.1.2
98
+ signing_key:
110
99
  specification_version: 4
111
100
  summary: Manage a local certificate authority for self-signed localhost development
112
101
  servers.
data/.editorconfig DELETED
@@ -1,6 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = tab
5
- indent_size = 2
6
-
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
-
13
- /ssl/
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.travis.yml DELETED
@@ -1,22 +0,0 @@
1
- language: ruby
2
- dist: xenial
3
- cache: bundler
4
-
5
- matrix:
6
- include:
7
- - rvm: 2.3
8
- - rvm: 2.4
9
- - rvm: 2.5
10
- - rvm: 2.6
11
- - rvm: 2.6
12
- os: osx
13
- - rvm: 2.6
14
- env: COVERAGE=BriefSummary,Coveralls
15
- - rvm: truffleruby
16
- - rvm: jruby-head
17
- env: JRUBY_OPTS="--debug -X+O"
18
- - rvm: ruby-head
19
- allow_failures:
20
- - rvm: truffleruby
21
- - rvm: ruby-head
22
- - rvm: jruby-head
data/Gemfile DELETED
@@ -1,13 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in localhost.gemspec
6
- gemspec
7
-
8
- group :development do
9
- gem 'async-io'
10
- gem 'async-rspec'
11
-
12
- gem 'async-process'
13
- end
data/README.md DELETED
@@ -1,139 +0,0 @@
1
- # Localhost
2
-
3
- This gem provides a convenient API for generating per-user self-signed root certificates.
4
-
5
- [![Build Status](https://travis-ci.com/socketry/localhost.svg)](https://travis-ci.com/socketry/localhost)
6
- [![Coverage Status](https://coveralls.io/repos/socketry/localhost/badge.svg)](https://coveralls.io/r/socketry/localhost)
7
-
8
- ## Motivation
9
-
10
- HTTP/2 requires SSL in web browsers. If you want to use HTTP/2 for development (and you should), you need to start using URLs like `https://localhost:8080`. In most cases, this requires adding a self-signed certificate to your certificate store (e.g. Keychain on macOS), and storing the private key for the web-server to use.
11
-
12
- I wanted to provide a server-agnostic way of doing this, primarily because I think it makes sense to minimise the amount of junky self-signed keys you add to your certificate store for `localhost`.
13
-
14
- ## Installation
15
-
16
- Add this line to your application's Gemfile:
17
-
18
- ```ruby
19
- gem 'localhost'
20
- ```
21
-
22
- And then execute:
23
-
24
- $ bundle
25
-
26
- Or install it yourself as:
27
-
28
- $ gem install localhost
29
-
30
- ## Usage
31
-
32
- This example shows how to generate a certificate for an SSL secured server:
33
-
34
- ```ruby
35
- require 'socket'
36
- require 'thread'
37
-
38
- require 'localhost/authority'
39
-
40
- # Get the self-signed authority for localhost:
41
- authority = Localhost::Authority.fetch
42
-
43
- ready = Thread::Queue.new
44
-
45
- # Start a server thread:
46
- server_thread = Thread.new do
47
- server = OpenSSL::SSL::SSLServer.new(TCPServer.new("localhost", 4050), authority.server_context)
48
-
49
- server.listen
50
-
51
- ready << true
52
-
53
- peer = server.accept
54
-
55
- peer.puts "Hello World!"
56
- peer.flush
57
-
58
- peer.close
59
- end
60
-
61
- ready.pop
62
-
63
- client = OpenSSL::SSL::SSLSocket.new(TCPSocket.new("localhost", 4050), authority.client_context)
64
-
65
- # Initialize SSL connection:
66
- client.connect
67
-
68
- # Read the encrypted message:
69
- puts client.read(12)
70
-
71
- client.close
72
- server_thread.join
73
- ```
74
-
75
- If you use Safari to access such a server, it will allow you to add the certificate to your keychain without much work. Once you've done this, you won't need to do it again for any other site when running such a development environment from the same user account.
76
-
77
- For an example of how to make your own HTTPS web server, see [examples/https.rb](examples/https.rb).
78
-
79
- ### Safari
80
-
81
- If you use this with a web server, when you open the site in Safari:
82
-
83
- ![Safari](media/safari.png)
84
-
85
- - Click "View the certificate" to check that it is the correct certificate.
86
- - Click "visit this website" which will prompt you to add the certificate to your keychain. Once you've done this, it should work for a long time.
87
-
88
- ### Chrome
89
-
90
- If you use this with a web server, when you open the site in Chrome:
91
-
92
- ![Chrome](media/chrome.png)
93
-
94
- - Click "ADVANCED" to see additional details, including...
95
- - Click "Proceed to localhost (unsafe)" which will allow you to use the site for the current browser session.
96
-
97
- #### Self-Signed Localhost
98
-
99
- The best way to use Chrome with self-signed localhost certificates is to allow it in your chrome settings: [chrome://flags/#allow-insecure-localhost](chrome://flags/#allow-insecure-localhost).
100
-
101
- ### Files
102
-
103
- The certificate and private key are stored in `~/.localhost/`. You can delete them and they will be regenerated. If you added the certificate to your keychain, you'll probably want to delete that too.
104
-
105
- ## Contributing
106
-
107
- 1. Fork it
108
- 2. Create your feature branch (`git checkout -b my-new-feature`)
109
- 3. Commit your changes (`git commit -am 'Add some feature'`)
110
- 4. Push to the branch (`git push origin my-new-feature`)
111
- 5. Create new Pull Request
112
-
113
- ## See Also
114
-
115
- - [falcon](https://github.com/socketry/falcon) — Uses this `Localhost::Authority` to provide HTTP/2 with minimal configuration for `localhost`.
116
-
117
- ## License
118
-
119
- Released under the MIT license.
120
-
121
- Copyright, 2018, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
122
-
123
- Permission is hereby granted, free of charge, to any person obtaining a copy
124
- of this software and associated documentation files (the "Software"), to deal
125
- in the Software without restriction, including without limitation the rights
126
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
127
- copies of the Software, and to permit persons to whom the Software is
128
- furnished to do so, subject to the following conditions:
129
-
130
- The above copyright notice and this permission notice shall be included in
131
- all copies or substantial portions of the Software.
132
-
133
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
134
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
135
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
136
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
137
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
138
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
139
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
data/examples/https.rb DELETED
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'async'
4
- require 'async/io/host_endpoint'
5
- require 'async/io/ssl_endpoint'
6
- require 'async/http/server'
7
- require 'async/http/client'
8
- require 'localhost/authority'
9
-
10
- # The (self-signed) authority to use:
11
- hostname = "localhost"
12
- authority = Localhost::Authority.fetch(hostname)
13
-
14
- # The server app:
15
- app = lambda do |request|
16
- Async::HTTP::Response[200, {}, ["Hello World!"]]
17
- end
18
-
19
- # Bind to the specified host:
20
- endpoint = Async::IO::Endpoint.tcp(hostname, "8080")
21
-
22
- # Prepare the server, endpoint will be used for `bind`:
23
- server_endpoint = Async::IO::SSLEndpoint.new(endpoint, ssl_context: authority.server_context)
24
- server = Async::HTTP::Server.new(app, server_endpoint, Async::HTTP::Protocol::HTTP1)
25
-
26
- # Prepare the client, endpoint will be used for `connect`:
27
- client_endpoint = Async::IO::SSLEndpoint.new(endpoint, ssl_context: authority.client_context)
28
- client = Async::HTTP::Client.new(client_endpoint, Async::HTTP::Protocol::HTTP1)
29
-
30
- # Run the reactor:
31
- Async::Reactor.run do |task|
32
- # Start the server task:
33
- server_task = task.async do
34
- server.run
35
- end
36
-
37
- # Connect to the server:
38
- response = client.get("/")
39
- puts "Status: #{response.status}\n#{response.read}"
40
-
41
- # Stop the server:
42
- server_task.stop
43
- end
data/localhost.gemspec DELETED
@@ -1,23 +0,0 @@
1
-
2
- require_relative "lib/localhost/version"
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "localhost"
6
- spec.version = Localhost::VERSION
7
- spec.authors = ["Samuel Williams"]
8
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
9
-
10
- spec.summary = "Manage a local certificate authority for self-signed localhost development servers."
11
- spec.homepage = "https://github.com/socketry/localhost"
12
-
13
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
14
- f.match(%r{^(test|spec|features)/})
15
- end
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.require_paths = ["lib"]
18
-
19
- spec.add_development_dependency "covered"
20
- spec.add_development_dependency "bundler"
21
- spec.add_development_dependency "rake", "~> 10.0"
22
- spec.add_development_dependency "rspec", "~> 3.0"
23
- end
data/media/chrome.png DELETED
Binary file
data/media/safari.png DELETED
Binary file