sshd_config 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +37 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +23 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/bin/sshd_config +38 -0
- data/lib/sshd_config.rb +94 -0
- data/spec/data/sshd_config +132 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/sshd_config_spec.rb +59 -0
- metadata +144 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "rspec", ">= 2.11.0"
|
10
|
+
gem "rdoc", ">= 3.12"
|
11
|
+
gem "bundler", ">= 1.0"
|
12
|
+
gem "jeweler", ">= 1.8.4"
|
13
|
+
gem "simplecov", ">= 0.6.4"
|
14
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.2.1)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.8.4)
|
7
|
+
bundler (~> 1.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rdoc
|
11
|
+
json (1.7.7)
|
12
|
+
multi_json (1.6.1)
|
13
|
+
rake (10.0.3)
|
14
|
+
rdoc (4.0.0)
|
15
|
+
json (~> 1.4)
|
16
|
+
rspec (2.13.0)
|
17
|
+
rspec-core (~> 2.13.0)
|
18
|
+
rspec-expectations (~> 2.13.0)
|
19
|
+
rspec-mocks (~> 2.13.0)
|
20
|
+
rspec-core (2.13.1)
|
21
|
+
rspec-expectations (2.13.0)
|
22
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
23
|
+
rspec-mocks (2.13.0)
|
24
|
+
simplecov (0.7.1)
|
25
|
+
multi_json (~> 1.0)
|
26
|
+
simplecov-html (~> 0.7.1)
|
27
|
+
simplecov-html (0.7.1)
|
28
|
+
|
29
|
+
PLATFORMS
|
30
|
+
ruby
|
31
|
+
|
32
|
+
DEPENDENCIES
|
33
|
+
bundler (>= 1.0)
|
34
|
+
jeweler (>= 1.8.4)
|
35
|
+
rdoc (>= 3.12)
|
36
|
+
rspec (>= 2.11.0)
|
37
|
+
simplecov (>= 0.6.4)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Ígor Bonadio
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
= SSHDConfig v0.1.0
|
2
|
+
|
3
|
+
Everytime that you want to configure OpenSSH you need to edit the sshd_config file... Isn't it annoying?
|
4
|
+
|
5
|
+
It was annoying. Now, you can use this gem to improve this task.
|
6
|
+
|
7
|
+
SSHDConfig helps you to configure OpenSSH via command line or API. You choose!
|
8
|
+
|
9
|
+
== Contributing to gritano-sshconfig
|
10
|
+
|
11
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
12
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
13
|
+
* Fork the project.
|
14
|
+
* Start a feature/bugfix branch.
|
15
|
+
* Commit and push until you are happy with your contribution.
|
16
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
17
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
18
|
+
|
19
|
+
== Copyright
|
20
|
+
|
21
|
+
Copyright (c) 2013 Ígor Bonadio. See LICENSE.txt for
|
22
|
+
further details.
|
23
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "sshd_config"
|
18
|
+
gem.homepage = "http://github.com/igorbonadio/sshd_config"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Configure OpenSSH using an awesome API}
|
21
|
+
gem.description = %Q{SSHDConfig helps you to configure OpenSSH via command line or API}
|
22
|
+
gem.email = "igorbonadio@gmail.com"
|
23
|
+
gem.authors = ["Igor Bonadio"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
task :default => :spec
|
40
|
+
|
41
|
+
require 'rdoc/task'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
+
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
46
|
+
rdoc.title = "gritano-sshconfig #{version}"
|
47
|
+
rdoc.rdoc_files.include('README*')
|
48
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/sshd_config
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
|
+
|
6
|
+
require 'sshd_config'
|
7
|
+
|
8
|
+
def help
|
9
|
+
"
|
10
|
+
sshd_config file command [value]
|
11
|
+
|
12
|
+
Examples:
|
13
|
+
|
14
|
+
sshd_config /etc/sshd_config set:port 22
|
15
|
+
sshd_config /etc/sshd_config get:port
|
16
|
+
|
17
|
+
"
|
18
|
+
end
|
19
|
+
|
20
|
+
puts help if ARGV[0] == "help"
|
21
|
+
|
22
|
+
if ARGV.length < 2
|
23
|
+
puts "invalid arguments..."
|
24
|
+
else
|
25
|
+
file, command, value = ARGV
|
26
|
+
sshd_config = SshdConfig::SshdConfig.read(file)
|
27
|
+
case command
|
28
|
+
when /^get:/ then
|
29
|
+
puts sshd_config.send(command.gsub(/^get:/, ''))
|
30
|
+
when /^set:/ then
|
31
|
+
begin
|
32
|
+
sshd_config.send("#{command.gsub(/^set:/, '')}=", value)
|
33
|
+
sshd_config.save
|
34
|
+
rescue
|
35
|
+
puts "error..."
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/sshd_config.rb
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
module SshdConfig
|
2
|
+
class SshdConfig
|
3
|
+
attr_reader :lines
|
4
|
+
|
5
|
+
def initialize(filename)
|
6
|
+
@filename = filename
|
7
|
+
@file = File.open(@filename, "r")
|
8
|
+
end
|
9
|
+
|
10
|
+
def load
|
11
|
+
@lines = []
|
12
|
+
@file.readlines.each do |line|
|
13
|
+
@lines << {content: line, type: type(line)}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def type(line)
|
18
|
+
case line[0]
|
19
|
+
when '#' then :comment
|
20
|
+
when "\n" then :empty
|
21
|
+
else :property
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.read(filename)
|
26
|
+
sshd_config = SshdConfig.new(filename)
|
27
|
+
sshd_config.load
|
28
|
+
return sshd_config
|
29
|
+
end
|
30
|
+
|
31
|
+
def property(prop)
|
32
|
+
content = prop.gsub("\n", "").split(" ")
|
33
|
+
return {name: content[0], value: content[1..-1].join(' ')}
|
34
|
+
end
|
35
|
+
|
36
|
+
def change_property(prop, value)
|
37
|
+
prop = prop.gsub("\n", "").split(" ")
|
38
|
+
([prop[0]].concat value.split(" ")).join(" ")
|
39
|
+
end
|
40
|
+
|
41
|
+
def save
|
42
|
+
@file.close
|
43
|
+
@file = File.open(@filename, "w")
|
44
|
+
@lines.each do |line|
|
45
|
+
@file.write(line[:content])
|
46
|
+
end
|
47
|
+
@file.close
|
48
|
+
@file = File.open(@filename, "r")
|
49
|
+
end
|
50
|
+
|
51
|
+
def close
|
52
|
+
@file.close
|
53
|
+
end
|
54
|
+
|
55
|
+
def set_value(name, value)
|
56
|
+
prop = @lines.select do |line|
|
57
|
+
(line[:type] == :property) and (property(line[:content])[:name].chomp.upcase == (name).chomp.upcase)
|
58
|
+
end
|
59
|
+
if prop.length == 1
|
60
|
+
new_value = change_property(prop[0][:content], value)
|
61
|
+
@lines.each_with_index do |line, i|
|
62
|
+
if line[:content] == prop[0][:content]
|
63
|
+
@lines[i][:content] = "#{new_value}\n"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
return new_value
|
67
|
+
else
|
68
|
+
new_value = "#{name} #{value}\n"
|
69
|
+
@lines << {content: new_value, type: :property}
|
70
|
+
return new_value
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def get_value(name)
|
75
|
+
prop = @lines.select do |line|
|
76
|
+
(line[:type] == :property) and (property(line[:content])[:name].chomp.upcase == name.chomp.upcase)
|
77
|
+
end
|
78
|
+
if prop.length == 1
|
79
|
+
return property(prop[0][:content])[:value]
|
80
|
+
else
|
81
|
+
raise NoMethodError
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def method_missing(name, *args, &block)
|
86
|
+
return case name
|
87
|
+
when /^.*=$/ then
|
88
|
+
set_value(name.to_s[0..-2], args[0])
|
89
|
+
else
|
90
|
+
get_value(name.to_s)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
# $OpenBSD: sshd_config,v 1.84 2011/05/23 03:30:07 djm Exp $
|
2
|
+
|
3
|
+
# This is the sshd server system-wide configuration file. See
|
4
|
+
# sshd_config(5) for more information.
|
5
|
+
|
6
|
+
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
7
|
+
|
8
|
+
# The strategy used for options in the default sshd_config shipped with
|
9
|
+
# OpenSSH is to specify options with their default value where
|
10
|
+
# possible, but leave them commented. Uncommented options override the
|
11
|
+
# default value.
|
12
|
+
|
13
|
+
Port 22
|
14
|
+
#AddressFamily any
|
15
|
+
#ListenAddress 0.0.0.0
|
16
|
+
#ListenAddress ::
|
17
|
+
|
18
|
+
# The default requires explicit activation of protocol 1
|
19
|
+
#Protocol 2
|
20
|
+
|
21
|
+
# HostKey for protocol version 1
|
22
|
+
#HostKey /etc/ssh/ssh_host_key
|
23
|
+
# HostKeys for protocol version 2
|
24
|
+
#HostKey /etc/ssh/ssh_host_rsa_key
|
25
|
+
#HostKey /etc/ssh/ssh_host_dsa_key
|
26
|
+
#HostKey /etc/ssh/ssh_host_ecdsa_key
|
27
|
+
|
28
|
+
# Lifetime and size of ephemeral version 1 server key
|
29
|
+
#KeyRegenerationInterval 1h
|
30
|
+
#ServerKeyBits 1024
|
31
|
+
|
32
|
+
# Logging
|
33
|
+
# obsoletes QuietMode and FascistLogging
|
34
|
+
SyslogFacility AUTHPRIV
|
35
|
+
#LogLevel INFO
|
36
|
+
|
37
|
+
# Authentication:
|
38
|
+
|
39
|
+
#LoginGraceTime 2m
|
40
|
+
#PermitRootLogin yes
|
41
|
+
#StrictModes yes
|
42
|
+
#MaxAuthTries 6
|
43
|
+
#MaxSessions 10
|
44
|
+
|
45
|
+
#RSAAuthentication yes
|
46
|
+
#PubkeyAuthentication yes
|
47
|
+
|
48
|
+
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
|
49
|
+
# but this is overridden so installations will only check .ssh/authorized_keys
|
50
|
+
AuthorizedKeysFile .ssh/authorized_keys
|
51
|
+
|
52
|
+
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
|
53
|
+
#RhostsRSAAuthentication no
|
54
|
+
# similar for protocol version 2
|
55
|
+
#HostbasedAuthentication no
|
56
|
+
# Change to yes if you don't trust ~/.ssh/known_hosts for
|
57
|
+
# RhostsRSAAuthentication and HostbasedAuthentication
|
58
|
+
#IgnoreUserKnownHosts no
|
59
|
+
# Don't read the user's ~/.rhosts and ~/.shosts files
|
60
|
+
#IgnoreRhosts yes
|
61
|
+
|
62
|
+
# To disable tunneled clear text passwords both PasswordAuthentication and
|
63
|
+
# ChallengeResponseAuthentication must be set to "no".
|
64
|
+
#PasswordAuthentication no
|
65
|
+
#PermitEmptyPasswords no
|
66
|
+
|
67
|
+
# Change to no to disable s/key passwords
|
68
|
+
#ChallengeResponseAuthentication yes
|
69
|
+
|
70
|
+
# Kerberos options
|
71
|
+
#KerberosAuthentication no
|
72
|
+
#KerberosOrLocalPasswd yes
|
73
|
+
#KerberosTicketCleanup yes
|
74
|
+
|
75
|
+
# GSSAPI options
|
76
|
+
#GSSAPIAuthentication no
|
77
|
+
#GSSAPICleanupCredentials yes
|
78
|
+
#GSSAPIStrictAcceptorCheck yes
|
79
|
+
#GSSAPIKeyExchange no
|
80
|
+
|
81
|
+
# Set this to 'yes' to enable PAM authentication, account processing,
|
82
|
+
# and session processing. If this is enabled, PAM authentication will
|
83
|
+
# be allowed through the ChallengeResponseAuthentication and
|
84
|
+
# PasswordAuthentication. Depending on your PAM configuration,
|
85
|
+
# PAM authentication via ChallengeResponseAuthentication may bypass
|
86
|
+
# the setting of "PermitRootLogin without-password".
|
87
|
+
# If you just want the PAM account and session checks to run without
|
88
|
+
# PAM authentication, then enable this but set PasswordAuthentication
|
89
|
+
# and ChallengeResponseAuthentication to 'no'.
|
90
|
+
# Also, PAM will deny null passwords by default. If you need to allow
|
91
|
+
# null passwords, add the " nullok" option to the end of the
|
92
|
+
# securityserver.so line in /etc/pam.d/sshd.
|
93
|
+
#UsePAM yes
|
94
|
+
|
95
|
+
#AllowAgentForwarding yes
|
96
|
+
#AllowTcpForwarding yes
|
97
|
+
#GatewayPorts no
|
98
|
+
#X11Forwarding no
|
99
|
+
#X11DisplayOffset 10
|
100
|
+
#X11UseLocalhost yes
|
101
|
+
#PrintMotd yes
|
102
|
+
#PrintLastLog yes
|
103
|
+
#TCPKeepAlive yes
|
104
|
+
#UseLogin no
|
105
|
+
#UsePrivilegeSeparation sandbox
|
106
|
+
#PermitUserEnvironment no
|
107
|
+
#Compression delayed
|
108
|
+
#ClientAliveInterval 0
|
109
|
+
#ClientAliveCountMax 3
|
110
|
+
#UseDNS yes
|
111
|
+
#PidFile /var/run/sshd.pid
|
112
|
+
#MaxStartups 10
|
113
|
+
#PermitTunnel no
|
114
|
+
#ChrootDirectory none
|
115
|
+
|
116
|
+
# pass locale information
|
117
|
+
AcceptEnv LANG LC_*
|
118
|
+
|
119
|
+
# no default banner path
|
120
|
+
#Banner none
|
121
|
+
|
122
|
+
# override default of no subsystems
|
123
|
+
Subsystem sftp /usr/libexec/sftp-server
|
124
|
+
|
125
|
+
# Example of overriding settings on a per-user basis
|
126
|
+
#Match User anoncvs
|
127
|
+
# X11Forwarding no
|
128
|
+
# AllowTcpForwarding no
|
129
|
+
# ForceCommand cvs server
|
130
|
+
|
131
|
+
# XAuthLocation added by XQuartz (http://xquartz.macosforge.org)
|
132
|
+
XAuthLocation /opt/X11/bin/xauth
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
add_filter "/features/"
|
4
|
+
add_filter "/spec/"
|
5
|
+
end
|
6
|
+
|
7
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
8
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
9
|
+
require 'rspec'
|
10
|
+
require 'sshd_config'
|
11
|
+
|
12
|
+
# Requires supporting files with custom matchers and macros, etc,
|
13
|
+
# in ./support/ and its subdirectories.
|
14
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
15
|
+
|
16
|
+
RSpec.configure do |config|
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
module SshdConfig
|
4
|
+
describe "SshdConfig" do
|
5
|
+
it "should open a sshd_config file" do
|
6
|
+
File.should_receive(:open).with(File.join(File.dirname(__FILE__), 'data', 'sshd_config'), "r")
|
7
|
+
SshdConfig.new(File.join(File.dirname(__FILE__), 'data', 'sshd_config'))
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should read a sshd_config file" do
|
11
|
+
File.any_instance.should_receive(:readlines).and_return([])
|
12
|
+
SshdConfig.read(File.join(File.dirname(__FILE__), 'data', 'sshd_config'))
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have an internal representation of the sshd_config file" do
|
16
|
+
sshd_config = SshdConfig.read(File.join(File.dirname(__FILE__), 'data', 'sshd_config'))
|
17
|
+
sshd_config.lines.length.should be == 132
|
18
|
+
sshd_config.lines[0][:type].should be == :comment
|
19
|
+
sshd_config.lines[1][:type].should be == :empty
|
20
|
+
sshd_config.lines[12][:type].should be == :property
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should get parameters from sshd_config file" do
|
24
|
+
sshd_config = SshdConfig.read(File.join(File.dirname(__FILE__), 'data', 'sshd_config'))
|
25
|
+
sshd_config.port.should be == "22"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should raise an error if the parameter doesn't exist and you try to get it" do
|
29
|
+
sshd_config = SshdConfig.read(File.join(File.dirname(__FILE__), 'data', 'sshd_config'))
|
30
|
+
lambda { sshd_config.invalid_parameter }.should raise_error NoMethodError
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should set parameters from sshd_config file" do
|
34
|
+
sshd_config = SshdConfig.read(File.join(File.dirname(__FILE__), 'data', 'sshd_config'))
|
35
|
+
sshd_config.port = "33"
|
36
|
+
sshd_config.port.should be == "33"
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should set new parameters to sshd_config file" do
|
40
|
+
sshd_config = SshdConfig.read(File.join(File.dirname(__FILE__), 'data', 'sshd_config'))
|
41
|
+
sshd_config.new_parameter = "new"
|
42
|
+
sshd_config.new_parameter.should be == "new"
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should write a sshd_config file" do
|
46
|
+
file = File.open(File.join(File.dirname(__FILE__), 'data', 'sshd_config_tmp'), "w")
|
47
|
+
file.write(File.open(File.join(File.dirname(__FILE__), 'data', 'sshd_config')).readlines.join)
|
48
|
+
file.close
|
49
|
+
|
50
|
+
sshd_config = SshdConfig.read(File.join(File.dirname(__FILE__), 'data', 'sshd_config_tmp'))
|
51
|
+
sshd_config.port = "33"
|
52
|
+
sshd_config.save
|
53
|
+
sshd_config.close
|
54
|
+
|
55
|
+
sshd_config = SshdConfig.read(File.join(File.dirname(__FILE__), 'data', 'sshd_config_tmp'))
|
56
|
+
sshd_config.port.should be == "33"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sshd_config
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Igor Bonadio
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.11.0
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.11.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rdoc
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.12'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.12'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bundler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: jeweler
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.8.4
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.8.4
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: simplecov
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.6.4
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.6.4
|
94
|
+
description: SSHDConfig helps you to configure OpenSSH via command line or API
|
95
|
+
email: igorbonadio@gmail.com
|
96
|
+
executables:
|
97
|
+
- sshd_config
|
98
|
+
extensions: []
|
99
|
+
extra_rdoc_files:
|
100
|
+
- LICENSE.txt
|
101
|
+
- README.rdoc
|
102
|
+
files:
|
103
|
+
- .document
|
104
|
+
- .rspec
|
105
|
+
- Gemfile
|
106
|
+
- Gemfile.lock
|
107
|
+
- LICENSE.txt
|
108
|
+
- README.rdoc
|
109
|
+
- Rakefile
|
110
|
+
- VERSION
|
111
|
+
- bin/sshd_config
|
112
|
+
- lib/sshd_config.rb
|
113
|
+
- spec/data/sshd_config
|
114
|
+
- spec/spec_helper.rb
|
115
|
+
- spec/sshd_config_spec.rb
|
116
|
+
homepage: http://github.com/igorbonadio/sshd_config
|
117
|
+
licenses:
|
118
|
+
- MIT
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
segments:
|
130
|
+
- 0
|
131
|
+
hash: -2396062633037850329
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
none: false
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 1.8.25
|
141
|
+
signing_key:
|
142
|
+
specification_version: 3
|
143
|
+
summary: Configure OpenSSH using an awesome API
|
144
|
+
test_files: []
|