tttls1.3 0.2.9 → 0.2.10

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: 89ddf39b7273edf08fbe46e3b043e3407e6858448643558c79e2d745956bb73a
4
- data.tar.gz: d3c67e1558ecf55ea64c6e1b7cf2ae8f76c52e25b02efd23161149532a0b35a9
3
+ metadata.gz: a88e723a99666a675766294bcd4693baad9d49f9d8d2c95e2c9361d74ea74e0a
4
+ data.tar.gz: e7c18f7242cf74229ae99232366d18854c898ce18e9f5805af8ca5694666e7bc
5
5
  SHA512:
6
- metadata.gz: 859ba8321cda498360389cc0fdb0cba509cec245f9b822855341e5a50bfcfd9ac38d69b976a55923aaa7026a0973b0d3349d5a1d25826ad70d73074904af0bf0
7
- data.tar.gz: 03a828102121e5bc70bdfc39e27e382355f0bc4d8ac9f3f925940d496dc845ec03c2e4c23d097de2a82f1edc3e3110ea4852d098f80239d9c0fa3e94b67fe63d
6
+ metadata.gz: a36f3a4f8dc7884a3927572285773390e0076ff6f154366aeb85dbda10ed1edbdb0964ab2201b236b77f1b7c862cd61796a5eae9574883790da83b5e2c52c375
7
+ data.tar.gz: 88688015bd166a0c93bf2c6663eda3649719362228c496a7662bf162e236f1a0a04d7f5aa18d477cb18a3986c97fe9e7cab89fd7c04ba09caa1dd92c70441433
@@ -0,0 +1,25 @@
1
+ name: workflow
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ branches:
9
+ - '*'
10
+
11
+ jobs:
12
+ ci:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v1
16
+ - uses: actions/setup-ruby@v1
17
+ - uses: thekuwayama/openssl@master
18
+ with:
19
+ ruby-version: '2.6.x'
20
+ - run: gem install bundler
21
+ - run: bundle install
22
+ - run: docker pull thekuwayama/openssl
23
+ - run: bundle exec rake
24
+ - run: bundle exec rake interop:client
25
+ - run: bundle exec rake interop:server
data/.rubocop.yml CHANGED
@@ -21,3 +21,7 @@ Metrics/BlockLength:
21
21
  - 'Rakefile'
22
22
  - 'spec/*.rb'
23
23
  - 'interop/*.rb'
24
+
25
+ Metrics/LineLength:
26
+ Exclude:
27
+ - 'tttls1.3.gemspec'
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # tttls1.3
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/tttls1.3.svg)](https://badge.fury.io/rb/tttls1.3)
4
- [![Build Status](https://travis-ci.org/thekuwayama/tttls1.3.svg?branch=master)](https://travis-ci.org/thekuwayama/tttls1.3)
4
+ [![Actions Status](https://github.com/thekuwayama/tttls1.3/workflows/workflow/badge.svg)](https://github.com/thekuwayama/tttls1.3/actions?query=workflow=.github/workflows/main.yml)
5
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/47f3c267d9cfd2c8e388/maintainability)](https://codeclimate.com/github/thekuwayama/tttls1.3/maintainability)
6
6
 
7
7
  tttls1.3 is Ruby implementation of [TLS 1.3](https://tools.ietf.org/html/rfc8446) protocol.
data/example/helper.rb CHANGED
@@ -21,17 +21,15 @@ def simple_http_request(hostname, path = '/')
21
21
  end
22
22
 
23
23
  def simple_http_response(body)
24
- s = <<~RESPONSE
24
+ h = <<~RESPONSE_HEADER_EOS
25
25
  HTTP/1.1 200 OK
26
26
  Date: #{Time.now.httpdate}
27
27
  Content-Type: text/html
28
28
  Content-Length: #{body.length}
29
29
  Server: tttls1.3/examples
30
+ RESPONSE_HEADER_EOS
30
31
 
31
- #{body}
32
- RESPONSE
33
-
34
- s.gsub(WEBrick::LF, WEBrick::CRLF)
32
+ h.gsub(WEBrick::LF, WEBrick::CRLF) + WEBrick::CRLF + body
35
33
  end
36
34
 
37
35
  def recv_http_response(client)
@@ -38,10 +38,10 @@ Etc.nprocessors.times do
38
38
  begin
39
39
  server.accept
40
40
  parser << server.read until server.eof?
41
- rescue HTTP::Parser::Error, TTTLS13::Error::ErrorAlerts
42
- logger.warn 'Parser Error'
41
+ server.close
42
+ rescue StandardError => e
43
+ logger.warn e
43
44
  ensure
44
- server.close unless server.eof?
45
45
  parser.reset!
46
46
  end
47
47
  end
@@ -177,10 +177,10 @@ RSpec.describe Client do
177
177
  pid = spawn('docker run ' \
178
178
  + "--volume #{FIXTURES_DIR}:/tmp " \
179
179
  + "--publish #{PORT}:#{PORT} " \
180
- + 'openssl ' + cmd)
180
+ + 'thekuwayama/openssl ' + cmd)
181
181
  Process.detach(pid)
182
182
 
183
- wait_to_listen(PORT)
183
+ wait_to_listen('127.0.0.1', PORT)
184
184
  end
185
185
 
186
186
  let(:client) do
data/interop/helper.rb CHANGED
@@ -12,6 +12,14 @@ include TTTLS13::Message::Extension
12
12
  include TTTLS13::Error
13
13
  # rubocop: enable Style/MixinUsage
14
14
 
15
- def wait_to_listen(port)
16
- sleep(0.2) while `lsof -ni :#{port}`.empty?
15
+ def wait_to_listen(host, port)
16
+ loop do
17
+ s = TCPSocket.open(host, port) # check by TCP handshake
18
+ rescue # rubocop: disable Style/RescueStandardError
19
+ sleep(0.2)
20
+ next
21
+ else
22
+ s.close
23
+ break
24
+ end
17
25
  end
@@ -176,16 +176,19 @@ RSpec.describe Server do
176
176
  ].each do |normal, opt, crt, key, settings|
177
177
  context 'server interop' do
178
178
  let(:server) do
179
- @socket = tcpserver.accept
179
+ loop do
180
+ @socket = tcpserver.accept
181
+ break unless @socket.eof?
182
+ end
180
183
  settings[:crt_file] = crt
181
184
  settings[:key_file] = key
182
185
  Server.new(@socket, settings)
183
186
  end
184
187
 
185
188
  let(:client) do
186
- wait_to_listen(PORT)
187
-
188
189
  ip = Socket.ip_address_list.find(&:ipv4_private?).ip_address
190
+ wait_to_listen(ip, PORT)
191
+
189
192
  cmd = 'echo -n ping | openssl s_client ' \
190
193
  + "-connect local:#{PORT} " \
191
194
  + '-tls1_3 ' \
@@ -195,7 +198,7 @@ RSpec.describe Server do
195
198
  + opt
196
199
  'docker run ' \
197
200
  + "--volume #{FIXTURES_DIR}:/tmp " \
198
- + "--add-host=local:#{ip} -it openssl " \
201
+ + "--add-host=local:#{ip} thekuwayama/openssl " \
199
202
  + "sh -c \"#{cmd}\" 2>&1 >/dev/null"
200
203
  end
201
204
 
@@ -216,6 +219,7 @@ RSpec.describe Server do
216
219
  it "should NOT accept request from openssl s_client ...#{opt}" do
217
220
  spawn(client)
218
221
  expect { server.accept }.to raise_error ErrorAlerts
222
+ expect { server.close }.to_not raise_error
219
223
  end
220
224
  end
221
225
  end
@@ -254,7 +254,7 @@ module TTTLS13
254
254
  end
255
255
  # rubocop: enable Metrics/CyclomaticComplexity
256
256
 
257
- # @param wcipher [TTTLS13::Cryptograph::Aead, Passer]
257
+ # @param cipher [TTTLS13::Cryptograph::Aead, Passer]
258
258
  #
259
259
  # @return [TTTLS13::Message::Record]
260
260
  def recv_record(cipher)
@@ -1,7 +1,8 @@
1
1
  # encoding: ascii-8bit
2
2
  # frozen_string_literal: true
3
3
 
4
- Dir[File.dirname(__FILE__) + '/extension/*.rb'].each { |f| require f }
4
+ # signature_algorithms_cert.rb needs signature_algorithms.rb so that `sort`
5
+ Dir[File.dirname(__FILE__) + '/extension/*.rb'].sort.each { |f| require f }
5
6
 
6
7
  module TTTLS13
7
8
  using Refinements
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TTTLS13
4
- VERSION = '0.2.9'
4
+ VERSION = '0.2.10'
5
5
  end
data/tttls1.3.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.version = TTTLS13::VERSION
10
10
  spec.authors = ['thekuwayama']
11
11
  spec.email = ['thekuwayama@gmail.com']
12
- spec.summary = 'TLS 1.3 implementation in Ruby'
12
+ spec.summary = 'TLS 1.3 implementation in Ruby (Tiny Trial TLS1.3 aka tttls1.3)'
13
13
  spec.description = spec.summary
14
14
  spec.homepage = 'https://github.com/thekuwayama/tttls1.3'
15
15
  spec.license = 'MIT'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tttls1.3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - thekuwayama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-23 00:00:00.000000000 Z
11
+ date: 2019-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,17 +52,17 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: TLS 1.3 implementation in Ruby
55
+ description: TLS 1.3 implementation in Ruby (Tiny Trial TLS1.3 aka tttls1.3)
56
56
  email:
57
57
  - thekuwayama@gmail.com
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".github/workflows/main.yml"
62
63
  - ".gitignore"
63
64
  - ".rspec"
64
65
  - ".rubocop.yml"
65
- - ".travis.yml"
66
66
  - Gemfile
67
67
  - LICENSE.txt
68
68
  - README.md
@@ -75,7 +75,6 @@ files:
75
75
  - example/https_client_using_hrr_and_ticket.rb
76
76
  - example/https_client_using_ticket.rb
77
77
  - example/https_server.rb
78
- - interop/Dockerfile
79
78
  - interop/client_spec.rb
80
79
  - interop/helper.rb
81
80
  - interop/server_spec.rb
@@ -195,7 +194,7 @@ requirements: []
195
194
  rubygems_version: 3.0.3
196
195
  signing_key:
197
196
  specification_version: 4
198
- summary: TLS 1.3 implementation in Ruby
197
+ summary: TLS 1.3 implementation in Ruby (Tiny Trial TLS1.3 aka tttls1.3)
199
198
  test_files:
200
199
  - spec/aead_spec.rb
201
200
  - spec/alert_spec.rb
data/.travis.yml DELETED
@@ -1,18 +0,0 @@
1
- sudo: false
2
-
3
- language: ruby
4
-
5
- rvm:
6
- - 2.6.3
7
- - 2.6.4
8
- - 2.7.0-preview1
9
-
10
- matrix:
11
- allow_failures:
12
- - rvm: ruby-2.7.0-preview1
13
-
14
- before_install:
15
- - gem install bundler -v 2.0.1
16
- - bundle install
17
-
18
- script: bundle exec rake
data/interop/Dockerfile DELETED
@@ -1,28 +0,0 @@
1
- FROM ubuntu:18.04
2
-
3
- ARG version="1.1.1c"
4
-
5
- RUN apt-get update && apt-get install -y --no-install-recommends \
6
- autoconf \
7
- bison \
8
- build-essential \
9
- ca-certificates \
10
- curl \
11
- gzip \
12
- libreadline-dev \
13
- patch \
14
- pkg-config \
15
- sed \
16
- zlib1g-dev
17
-
18
- RUN mkdir -p /build/openssl
19
- RUN curl -s https://www.openssl.org/source/openssl-${version}.tar.gz | tar -C /build/openssl -xzf - && \
20
- cd /build/openssl/openssl-${version} && \
21
- ./Configure \
22
- --prefix=/opt/openssl/openssl-${version} \
23
- enable-crypto-mdebug enable-crypto-mdebug-backtrace \
24
- linux-x86_64 && \
25
- make && make install_sw
26
-
27
- ENV LD_LIBRARY_PATH /opt/openssl/openssl-${version}/lib
28
- ENV PATH /opt/openssl/openssl-${version}/bin:$PATH