spior 0.5.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -1
- data/CHANGELOG.md +5 -0
- data/lib/spior/helpers.rb +3 -0
- data/lib/spior/ipv6.rb +29 -2
- data/lib/spior/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b7a17588e2c9700a222a35e57fbb165ae2d12f54f4fa5779370e8219b29d104
|
4
|
+
data.tar.gz: 1316b42e62d0fcf5bb0cc4048a9168df1c158e6d45a5fb1d3f89c552d103a949
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3ad900a13bd7f0118a739993328a6ad2e52ab79bbb3b2a7401333877a11c57f5c7e97b6c1460411e3252157b59ee350f055bfb76b5e8815dd4008770dfdef76
|
7
|
+
data.tar.gz: 011fd4db96c4cbf9c5f1fc99dbffab69c86b19cf88f47915377a822d86559c6f15c39eb9c905a6c87979c2736503846eeec6d02e65ccc803f544616eb2fc2320
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
7���-�� �r���j�����0�,kE]+�}����u�E�p�}
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
### Fix
|
2
|
+
* sysctl no more generate blank line.
|
3
|
+
* ipv6 - check if ipv6 is alrealy blocked before trying to allow or block.
|
4
|
+
* config for tor and spior, not enough permission - now fixed at 0644.
|
5
|
+
|
1
6
|
## 0.5.0, release 2024-10
|
2
7
|
* Correct runtime with openrc on Gentoo
|
3
8
|
* Remove a lots of old codes.
|
data/lib/spior/helpers.rb
CHANGED
@@ -4,6 +4,7 @@ require 'fileutils'
|
|
4
4
|
require 'tempfile'
|
5
5
|
require 'open3'
|
6
6
|
|
7
|
+
# Various function for Spior
|
7
8
|
module Helpers
|
8
9
|
def self.auth?
|
9
10
|
return :root if Process.uid == '0'
|
@@ -33,8 +34,10 @@ module Helpers
|
|
33
34
|
def self.mv(src, dest)
|
34
35
|
if Process::Sys.getuid == '0'
|
35
36
|
FileUtils.mv(src, dest)
|
37
|
+
FileUtils.chmod 0644, dest
|
36
38
|
else
|
37
39
|
cmd("mv #{src} #{dest}")
|
40
|
+
cmd("chmod 644 #{dest}")
|
38
41
|
end
|
39
42
|
end
|
40
43
|
|
data/lib/spior/ipv6.rb
CHANGED
@@ -8,21 +8,30 @@ module Spior
|
|
8
8
|
class Ipv6
|
9
9
|
def initialize
|
10
10
|
@dest = '/etc/sysctl.d/40-ipv6.conf'
|
11
|
+
@cmdline_path = '/proc/cmdline'
|
12
|
+
@opened = false
|
13
|
+
collect_cmdline_args
|
11
14
|
gen_flags
|
12
15
|
end
|
13
16
|
|
14
17
|
def allow
|
15
|
-
|
18
|
+
return if check_ipv6_disabled?
|
19
|
+
|
20
|
+
@flags.each { |f| Helpers.cmd("sysctl -q -w '#{f}=0'") }
|
16
21
|
Msg.p 'ipv6 allowed'
|
17
22
|
Helpers.cmd("rm #{@dest}") if File.exist? @dest
|
18
23
|
end
|
19
24
|
|
20
25
|
def block
|
21
|
-
|
26
|
+
return if check_ipv6_disabled?
|
27
|
+
|
28
|
+
@flags.each { |f| Helpers.cmd("sysctl -q -w '#{f}=1'") }
|
22
29
|
Msg.p 'ipv6 blocked'
|
23
30
|
end
|
24
31
|
|
25
32
|
def block_persist
|
33
|
+
return if check_ipv6_disabled?
|
34
|
+
|
26
35
|
Auth.new.mkdir '/etc/sysctl.d'
|
27
36
|
myflags = []
|
28
37
|
@flags.each { |f| myflags << "#{f}=1" }
|
@@ -37,5 +46,23 @@ module Spior
|
|
37
46
|
'net.ipv6.conf.default.disable_ipv6']
|
38
47
|
Interfacez.all { |i| @flags << "net.ipv6.conf.#{i}.disable_ipv6" }
|
39
48
|
end
|
49
|
+
|
50
|
+
def collect_cmdline_args
|
51
|
+
if !File.exist?(@cmdline_path) || !File.readable?(@cmdline_path)
|
52
|
+
@opened = false
|
53
|
+
else
|
54
|
+
@opened = true
|
55
|
+
@all_args = File.read(@cmdline_path)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def check_ipv6_disabled?
|
60
|
+
return false unless @opened
|
61
|
+
|
62
|
+
@all_args.split.each do |a|
|
63
|
+
return true.to_s if a.match(/^ipv6.disable=1$/)
|
64
|
+
end
|
65
|
+
false
|
66
|
+
end
|
40
67
|
end
|
41
68
|
end
|
data/lib/spior/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spior
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- szorfein
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
urXgRIzALxd/xazPCnoLSXPzfJSI6Y77S1EBvhPd9RaSO8IyH9RhPDP9mnTvW2Kl
|
37
37
|
NAUnoL+txK5a
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date: 2024-10-
|
39
|
+
date: 2024-10-22 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: interfacez
|
metadata.gz.sig
CHANGED
Binary file
|