riseup_vpn 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5749722468abc5f22914e79b50843c565be88d489d8fba1ef5cb9d26f30bdb52
4
- data.tar.gz: 76f3542e75019a9dea6d319664a1bb1b5fe0f8c28b2e75939cc02e44418aeadd
3
+ metadata.gz: b9fb7defcb7a949292d44dc949acfdc4524eb599a21ec1c90f5f1680c8b9d0ff
4
+ data.tar.gz: dcbb98a3d236a6bf35d3fab3f073549836e98d976a747a4dd134417f6f3ad43e
5
5
  SHA512:
6
- metadata.gz: f70b3352d7e5be2ba70e765dc346b8948e1819fe5b60195963651fe9ff8627f5171eee642dfd0a28ca83cc0c620b9451f4bf72c6d020da47c8a4eabf02e1254d
7
- data.tar.gz: a2adafe678f656818a760dd453b2e599d7ecfc47c086b424fc88a57fa1bcfb47443398d29cc718af2bde226688e47b3afd9f4b8eb2b6bd686a43c478b2a7ed0f
6
+ metadata.gz: 01bf804c22e6edde11abfd61073f3a9093d33b9463e05f5456aa66f7537e44e19ef37708979499ca8193b05045439acdba5b3a46337ef4edc219053e9603e373
7
+ data.tar.gz: 219ee6e1de2521e85e94a558e28dda6347b3cb74e288bb293f04a86599975f76e00f4477b1d73493562403971f2e0435ff9fb4bde77404a774a690bd489dbd7f
data/CHANGELOG.md CHANGED
@@ -1,10 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [1.0.0] - 2025-04-21
3
+ ## [1.1.0] - 2025-04-22
4
4
 
5
5
  ### New features
6
6
 
7
- - upgrade TLS to 1.3, if supported by client
7
+ - add ability to import VPN client configs into Network Manager (Linux)
8
+
9
+ ## [1.0.0] - 2025-04-21
8
10
 
9
11
  ### Breaking changes
10
12
 
@@ -12,6 +14,10 @@
12
14
  - `#write_files` no longer takes an dir path arg
13
15
  - All errors subclass `RiseupVPN::Error`
14
16
 
17
+ ### New features
18
+
19
+ - upgrade TLS to 1.3, if supported by client
20
+
15
21
  ## [0.1.0] - 2025-04-19
16
22
 
17
23
  - Initial release
data/README.md CHANGED
@@ -28,20 +28,20 @@ gem install riseup_vpn
28
28
  ```ruby
29
29
  require 'riseup_vpn'
30
30
 
31
- manager = RiseupVPN::Manager.new # takes an optional positional arg for the dir path. Default is '~/.config/riseup_vpn'
31
+ @manager = RiseupVPN::Manager.new # takes an optional positional arg for the dir path. Default is '~/.config/riseup_vpn'
32
32
  # => instance_of RiseupVPN::Manager
33
33
 
34
- manager.ovpns
34
+ @manager.ovpns
35
35
  # => {"vpn01-sea.riseup.net" => "client\ntls-client\ndev tun\nproto udp\nremote 204.13.164.252 1194 ...
36
36
 
37
- manager.ovpns.size
37
+ @manager.ovpns.size
38
38
  # => 21
39
39
 
40
40
  RiseupVPN::Manager::OPTS # returns a list of valid options which maybe passed as an optional hash at initialization.
41
41
  # => {proto: ["udp", "tcp"]} defaults are the first values e.g. 'udp' for :proto
42
42
  # For example; RiseupVPN::Manager.new('/some/path', proto: 'tcp')
43
43
 
44
- manager.write_files # (over)writes the VPN client config files to the dir path
44
+ @manager.write_files # (over)writes the VPN client config files to the dir path
45
45
  ```
46
46
  The last command creates (or overwrites) the following files:
47
47
  - an .ovpn file for each VPN gateway
@@ -49,9 +49,16 @@ The last command creates (or overwrites) the following files:
49
49
  - the client private key file (client.key)
50
50
  - the client cert file (client.crt)
51
51
 
52
- Note: The last 2 expire after 30 days and therefore need to be updated regularly
52
+ Note: The last 2 expire after 30 days and therefore need to be updated regularly.
53
+
53
54
  Also note: OpenVPN requires that cert & key files shared across .ovpn client config files are present in the same directory.
54
55
 
56
+ On Linux, you can do this to make Riseup's VPNs available in Network Manager. It uses `nmcli` under the hood:
57
+ ```Ruby
58
+ @manager.import_ovpn_configs # writes the files and (re)imports the VPN configs into Network Manager
59
+ # the client key and cert files are updated too
60
+ ```
61
+
55
62
  ## \_why?
56
63
 
57
64
  I can use Riseup's white-labeled [desktop app](https://leap.se) to access Riseup's VPNs, so why the need?
data/Rakefile CHANGED
@@ -5,8 +5,6 @@ require 'minitest/test_task'
5
5
  require 'rake/testtask'
6
6
  require 'rubocop/rake_task'
7
7
 
8
- # Minitest::TestTask.create
9
-
10
8
  namespace :test do
11
9
  Rake::TestTask.new do |t|
12
10
  t.name = 'api'
@@ -26,6 +26,13 @@ module RiseupVPN
26
26
  raise ArgumentError, "Dir #{@dir} doesn't exist or isn't writable"
27
27
  end
28
28
 
29
+ def import_ovpn_configs
30
+ raise NoMethodError, 'nmcli does not appear to be installed' unless Utils.nmcli?
31
+
32
+ write_files
33
+ Dir["#{@dir}/*.ovpn"].each { |f| Nmcli.import_openvpn f }
34
+ end
35
+
29
36
  private
30
37
 
31
38
  def write_ovpn_files
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'generator'
4
+
5
+ module RiseupVPN
6
+ # in the absence of an nmcli gem..
7
+ module Nmcli
8
+ def self.nmcli(command_string)
9
+ `nmcli #{command_string}`
10
+ end
11
+
12
+ def self.import_openvpn(file)
13
+ nmcli "con import type openvpn file #{file}"
14
+ end
15
+ end
16
+ end
@@ -17,5 +17,9 @@ module RiseupVPN
17
17
  def self.tls_version
18
18
  "1.#{OpenSSL::VERSION.to_i}".to_f
19
19
  end
20
+
21
+ def self.nmcli?
22
+ !`which nmcli`.empty?
23
+ end
20
24
  end
21
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RiseupVPN
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
data/lib/riseup_vpn.rb CHANGED
@@ -7,6 +7,7 @@ require_relative 'riseup_vpn/api'
7
7
  require_relative 'riseup_vpn/errors'
8
8
  require_relative 'riseup_vpn/generator'
9
9
  require_relative 'riseup_vpn/manager'
10
+ require_relative 'riseup_vpn/nmcli'
10
11
  require_relative 'riseup_vpn/version'
11
12
 
12
13
  # namespace
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riseup_vpn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MatzFan
@@ -26,6 +26,7 @@ files:
26
26
  - lib/riseup_vpn/errors.rb
27
27
  - lib/riseup_vpn/generator.rb
28
28
  - lib/riseup_vpn/manager.rb
29
+ - lib/riseup_vpn/nmcli.rb
29
30
  - lib/riseup_vpn/template_ovpn.yml
30
31
  - lib/riseup_vpn/utils.rb
31
32
  - lib/riseup_vpn/version.rb
@@ -53,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
54
  - !ruby/object:Gem::Version
54
55
  version: '0'
55
56
  requirements: []
56
- rubygems_version: 3.7.0.dev
57
+ rubygems_version: 3.6.7
57
58
  specification_version: 4
58
59
  summary: RiseupVPN configuration
59
60
  test_files: []