Skip to content

Commit

Permalink
Merge pull request #2 from at-point/ruby3-upgrade
Browse files Browse the repository at this point in the history
Ruby3 Upgrade
  • Loading branch information
sled authored Dec 4, 2023
2 parents 05205a2 + 09f37b4 commit 0294f2f
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 75 deletions.
28 changes: 11 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
name: CI

on:
push:
branches:
- main
pull_request:
pull_request_target:
branches:
- main

on: [push, pull_request]ad
jobs:
ci:
name: CI
strategy:
matrix:
os-version: [ 'ubuntu-latest' ]
ruby-version:
- 2.5
- 2.6
- 2.7
- 3.0
- 3.1
- 3.2
include:
- ruby-version: '3.0'
- ruby-version: '3.1'
coverage: 'true'
fail-fast: false

Expand All @@ -32,7 +22,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -41,7 +31,11 @@ jobs:
bundler-cache: true

- name: Run bundler-audit
run: bundle exec bundler-audit
run: |
bundle exec bundler-audit update
bundle exec bundler-audit
- name: Run rspec
run: bundle exec rspec
env:
OPENSSL_CONF: etc/openssl.cnf
run: bundle exec rspec
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ build-iPhoneSimulator/
.tool-versions

# MacOS
.DS_Store
.DS_Store

Gemfile.lock
52 changes: 0 additions & 52 deletions Gemfile.lock

This file was deleted.

11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ If you'd rather install net-http-ntlm using `bundler`, add a line for it in your
gem 'net-http-ntlm'
```

## Note about Ruby 3 and OpenSSL 3

NTLM potentially uses legacy ciphers, which need to be enabled explicitly.

You can either create a custom OpenSSL profile in Ruby or load a custom SSL
configuration by setting `OPENSSL_CONF=` before Ruby loads.

There's an example in the [Github Actions][.github/workflows/ci.yml]

## Usage

```rb
Expand All @@ -34,4 +43,4 @@ response = http.request(request)
## References

* rubyntlm: https://github.com/WinRb/rubyntlm
* ruby-ntlm: https://github.com/macks/ruby-ntlm
* ruby-ntlm: https://github.com/macks/ruby-ntlm
17 changes: 17 additions & 0 deletions etc/openssl.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Needed because NTLM requires legacy ciphers.

openssl_conf = openssl_init
config_diagnostics = 1

[openssl_init]
providers = provider_sect

[provider_sect]
default = default_sect
legacy = legacy_sect

[default_sect]
activate = 1

[legacy_sect]
activate = 1
8 changes: 4 additions & 4 deletions net-http-ntlm.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
spec.summary = 'NTLM authentication for Net::HTTP'
spec.description = 'Adds NTLM authentication support for Net::HTTP using rubyntlm'
spec.homepage = 'https://github.com/at-point/net-http-ntlm'
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
spec.required_ruby_version = Gem::Requirement.new('>= 3.0.0')

spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://github.com/at-point/net-http-ntlm'
Expand All @@ -20,17 +20,17 @@ Gem::Specification.new do |spec|
# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|etc)/}) }
end
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.add_dependency 'rubyntlm', '~> 0.6'

spec.add_development_dependency 'bundler-audit', '~> 0.8'
spec.add_development_dependency 'bundler-audit', '~> 0.9'
spec.add_development_dependency 'codecov'
spec.add_development_dependency 'rake', '~> 12.0'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'simplecov'

Expand Down

0 comments on commit 0294f2f

Please sign in to comment.