spior 0.1.6 → 0.2.8
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 +4 -4
- checksums.yaml.gz.sig +3 -3
- data/.github/workflows/rubocop-analysis.yml +47 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile +5 -0
- data/README.md +13 -3
- data/Rakefile +20 -9
- data/lib/spior/dep.rb +45 -23
- data/lib/spior/helpers.rb +19 -19
- data/lib/spior/iptables/default.rb +19 -13
- data/lib/spior/iptables/root.rb +35 -36
- data/lib/spior/iptables/rules.rb +103 -0
- data/lib/spior/iptables/tor.rb +23 -20
- data/lib/spior/iptables.rb +3 -0
- data/lib/spior/menu.rb +16 -23
- data/lib/spior/msg.rb +22 -8
- data/lib/spior/options.rb +16 -19
- data/lib/spior/service/enable.rb +63 -0
- data/lib/spior/service/restart.rb +4 -12
- data/lib/spior/service/start.rb +5 -17
- data/lib/spior/service/stop.rb +12 -0
- data/lib/spior/service.rb +5 -0
- data/lib/spior/status.rb +32 -24
- data/lib/spior/tor/config.rb +100 -0
- data/lib/spior/tor/data.rb +53 -0
- data/lib/spior/tor/start.rb +59 -0
- data/lib/spior/tor/stop.rb +32 -0
- data/lib/spior/tor.rb +8 -1
- data/lib/spior/version.rb +3 -1
- data/lib/spior.rb +16 -23
- data/spior.gemspec +24 -21
- data/test/test_install.rb +2 -2
- data/test/test_options.rb +2 -0
- data.tar.gz.sig +0 -0
- metadata +57 -51
- metadata.gz.sig +0 -0
- data/lib/spior/clear.rb +0 -35
- data/lib/spior/copy.rb +0 -84
- data/lib/spior/persist.rb +0 -51
- data/lib/spior/tor/info.rb +0 -96
data/lib/spior/tor/info.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require 'nomansland'
|
3
|
-
require 'tty-which'
|
4
|
-
|
5
|
-
module Spior
|
6
|
-
module Tor
|
7
|
-
class Info
|
8
|
-
attr_accessor :dns, :uid, :trans_port, :virt_addr
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
@systemctl = Helpers::Exec.new("systemctl")
|
12
|
-
@dns = search_dns
|
13
|
-
@uid = search_uid
|
14
|
-
@trans_port = search_trans_port
|
15
|
-
@virt_addr = search_virt_addr
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def check_deps
|
21
|
-
Spior::Copy.new.save
|
22
|
-
add_torrc
|
23
|
-
Spior::Service.start
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.grep?(file, regex)
|
27
|
-
is_found = false
|
28
|
-
return is_found if ! File.exist? file
|
29
|
-
File.open(file) do |f|
|
30
|
-
f.each do |line|
|
31
|
-
is_found = true if line.match(regex)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
is_found
|
35
|
-
end
|
36
|
-
|
37
|
-
def add_torrc
|
38
|
-
user = 'User tor'
|
39
|
-
pid = ''
|
40
|
-
dir = 'DataDirectory /var/lib/tor'
|
41
|
-
|
42
|
-
case Nomansland::distro?
|
43
|
-
when :gentoo
|
44
|
-
pid = 'PIDFile /run/tor/tor.pid'
|
45
|
-
dir = 'DataDirectory /var/lib/tor/data'
|
46
|
-
when :debian
|
47
|
-
user = 'debian-tor'
|
48
|
-
when :ubuntu
|
49
|
-
user = 'debian-tor'
|
50
|
-
end
|
51
|
-
|
52
|
-
string = <<EOF
|
53
|
-
# Generated by Spior
|
54
|
-
#{user}
|
55
|
-
#{pid}
|
56
|
-
#{dir}
|
57
|
-
GeoIPExcludeUnknown 1
|
58
|
-
DNSPort 127.0.0.1:9061
|
59
|
-
AutomapHostsOnResolve 1
|
60
|
-
AutomapHostsSuffixes .exit,.onion
|
61
|
-
SocksPort 9050
|
62
|
-
VirtualAddrNetworkIPv4 10.192.0.0/10
|
63
|
-
TransPort 9040 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
|
64
|
-
TestSocks 1
|
65
|
-
MaxCircuitDirtiness 600
|
66
|
-
EOF
|
67
|
-
new_file = Helpers::NewFile.new(string, "torrc", "/etc/tor")
|
68
|
-
new_file.add
|
69
|
-
new_file.perm("root", "644")
|
70
|
-
end
|
71
|
-
|
72
|
-
def search_dns
|
73
|
-
9061
|
74
|
-
end
|
75
|
-
|
76
|
-
def search_uid
|
77
|
-
case Nomansland::distro?
|
78
|
-
when :debian
|
79
|
-
`id -u debian-tor`.chomp
|
80
|
-
when :ubuntu
|
81
|
-
`id -u debian-tor`.chomp
|
82
|
-
else
|
83
|
-
`id -u tor`.chomp
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def search_trans_port
|
88
|
-
9040
|
89
|
-
end
|
90
|
-
|
91
|
-
def search_virt_addr
|
92
|
-
"10.192.0.0/10"
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|