vidibus-pureftpd 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.md +173 -0
- data/Rakefile +13 -31
- data/lib/vidibus-pureftpd.rb +3 -3
- data/lib/vidibus/pureftpd.rb +23 -16
- data/lib/vidibus/pureftpd/user.rb +109 -0
- data/lib/vidibus/pureftpd/version.rb +5 -0
- metadata +142 -71
- data/.bundle/config +0 -2
- data/.gitignore +0 -21
- data/.rspec +0 -2
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -23
- data/README.rdoc +0 -48
- data/VERSION +0 -1
- data/spec/spec_helper.rb +0 -6
- data/spec/vidibus/pureftpd_spec.rb +0 -80
- data/vidibus-pureftpd.gemspec +0 -58
data/LICENSE
CHANGED
data/README.md
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
# Vidibus::Pureftpd
|
2
|
+
|
3
|
+
Allows control of [Pure-FTPd](http://www.pureftpd.org/project/pure-ftpd), the free, secure, production-quality and standard-conformant FTP server.
|
4
|
+
|
5
|
+
This gem is part of [Vidibus](http://vidibus.org), an open source toolset for building distributed (video) applications.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add the dependency to the Gemfile of your application: `gem 'vidibus-pureftpd'`. Then call bundle install on your console.
|
10
|
+
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
Add a user:
|
15
|
+
|
16
|
+
```
|
17
|
+
Vidibus::Pureftpd.add_user({
|
18
|
+
:login => 'someuser',
|
19
|
+
:password => 'verysecret',
|
20
|
+
:directory => '/tmp'
|
21
|
+
})
|
22
|
+
```
|
23
|
+
|
24
|
+
Delete a user:
|
25
|
+
|
26
|
+
```
|
27
|
+
Vidibus::Pureftpd.delete_user(:login => 'someuser')
|
28
|
+
```
|
29
|
+
|
30
|
+
Change a user's password:
|
31
|
+
|
32
|
+
```
|
33
|
+
Vidibus::Pureftpd.change_password({
|
34
|
+
:login => 'someuser',
|
35
|
+
:password => 'whatever'
|
36
|
+
})
|
37
|
+
```
|
38
|
+
|
39
|
+
|
40
|
+
## Install Pure-FTPd on Debian Lenny
|
41
|
+
|
42
|
+
Get the package:
|
43
|
+
|
44
|
+
```
|
45
|
+
aptitude install pure-ftpd-common pure-ftpd
|
46
|
+
```
|
47
|
+
|
48
|
+
Add group pureftpd_group:
|
49
|
+
|
50
|
+
```
|
51
|
+
groupadd pureftpd_group
|
52
|
+
```
|
53
|
+
|
54
|
+
Add user pureftpd_user without permission to a home directory or any shell:
|
55
|
+
|
56
|
+
```
|
57
|
+
useradd -g pureftpd_group -d /dev/null -s /etc pureftpd_user
|
58
|
+
```
|
59
|
+
|
60
|
+
By default all user data will be saved in /etc/pure-ftpd/pureftpd.passwd, so make sure this file exists:
|
61
|
+
|
62
|
+
```
|
63
|
+
touch /etc/pure-ftpd/pureftpd.passwd
|
64
|
+
```
|
65
|
+
|
66
|
+
For fast access of user data, Pure-FTPd creates a "database", which is a binary file that is ordered and has an index for quick access. Let's create this database:
|
67
|
+
|
68
|
+
```
|
69
|
+
pure-pw mkdb
|
70
|
+
```
|
71
|
+
|
72
|
+
Set Pure-FTPd as a standalone server:
|
73
|
+
|
74
|
+
```
|
75
|
+
vim /etc/default/pure-ftpd-common
|
76
|
+
|
77
|
+
# Replace this:
|
78
|
+
STANDALONE_OR_INETD=inetd
|
79
|
+
# With this:
|
80
|
+
STANDALONE_OR_INETD=standalone
|
81
|
+
```
|
82
|
+
|
83
|
+
Ensure that Pure-FTPd server gets valid users from our pureftpd database file:
|
84
|
+
|
85
|
+
```
|
86
|
+
cd /etc/pure-ftpd/conf
|
87
|
+
vim PureDB
|
88
|
+
|
89
|
+
# Check if the following line exists:
|
90
|
+
/etc/pure-ftpd/pureftpd.pdb
|
91
|
+
```
|
92
|
+
|
93
|
+
Now you have point a symbolic link to the PureDB file:
|
94
|
+
|
95
|
+
```
|
96
|
+
cd /etc/pure-ftpd/auth
|
97
|
+
ln -s /etc/pure-ftpd/conf/PureDB 50pure
|
98
|
+
```
|
99
|
+
|
100
|
+
You should now see a new file "50pure" linking to ../conf/PureDB:
|
101
|
+
|
102
|
+
```
|
103
|
+
ls -ls
|
104
|
+
```
|
105
|
+
|
106
|
+
Finally, (re)start Pure-FTPd:
|
107
|
+
|
108
|
+
```
|
109
|
+
/etc/init.d/pure-ftpd restart
|
110
|
+
```
|
111
|
+
|
112
|
+
For more instructions, please [check this resource](http://linux.justinhartman.com/PureFTPd_Installation_and_Setup).
|
113
|
+
|
114
|
+
|
115
|
+
## Install Pure-FTPd on OSX for testing
|
116
|
+
|
117
|
+
```
|
118
|
+
brew install pure-ftpd
|
119
|
+
```
|
120
|
+
|
121
|
+
Create the user `pureftpd_user` with ID 483:
|
122
|
+
|
123
|
+
```
|
124
|
+
sudo dscl . create /Users/pureftpd_user uid 483
|
125
|
+
sudo dscl . create /Users/pureftpd_user gid 483
|
126
|
+
sudo dscl . create /Users/pureftpd_user UserShell /etc/pure-ftpd
|
127
|
+
sudo dscl . create /Users/pureftpd_user NFSHomeDirectory /dev/null
|
128
|
+
```
|
129
|
+
|
130
|
+
Create the group `pureftpd_group` with ID 483:
|
131
|
+
|
132
|
+
```
|
133
|
+
sudo dscl . create /Groups/pureftpd_group gid 483
|
134
|
+
sudo dscl . merge /Groups/pureftpd_group users pureftpd_user
|
135
|
+
```
|
136
|
+
|
137
|
+
Check if user and group exist:
|
138
|
+
|
139
|
+
```
|
140
|
+
dscacheutil -q user
|
141
|
+
dscacheutil -q group
|
142
|
+
```
|
143
|
+
|
144
|
+
Ensure that the database exists and is writable for the user that executes RSpec:
|
145
|
+
|
146
|
+
```
|
147
|
+
sudo mkdir /etc/pure-ftpd/
|
148
|
+
sudo touch /etc/pure-ftpd/pureftpd.passwd
|
149
|
+
sudo chown -R `whoami` /etc/pure-ftpd/
|
150
|
+
```
|
151
|
+
|
152
|
+
To start the server (not needed for testing), type:
|
153
|
+
|
154
|
+
```
|
155
|
+
sudo /usr/local/sbin/pure-ftpd &
|
156
|
+
```
|
157
|
+
|
158
|
+
You should be able to connect via ftp:
|
159
|
+
|
160
|
+
```
|
161
|
+
ftp localhost
|
162
|
+
```
|
163
|
+
|
164
|
+
Shut it down with:
|
165
|
+
|
166
|
+
```
|
167
|
+
pkill pure-ftpd
|
168
|
+
```
|
169
|
+
|
170
|
+
|
171
|
+
## Copyright
|
172
|
+
|
173
|
+
Copyright (c) 2010-2012 Andre Pankratz. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,36 +1,18 @@
|
|
1
|
-
|
2
|
-
require "rake"
|
3
|
-
require "rake/rdoctask"
|
4
|
-
require "rspec"
|
5
|
-
require "rspec/core/rake_task"
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
6
2
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
gem.summary = %Q{Provides interface for Pure-FTPd}
|
12
|
-
gem.description = %Q{Description...}
|
13
|
-
gem.email = "andre@vidibus.com"
|
14
|
-
gem.homepage = "http://github.com/vidibus/vidibus-pureftpd"
|
15
|
-
gem.authors = ["Andre Pankratz"]
|
16
|
-
gem.add_dependency "vidibus-core_extensions"
|
17
|
-
end
|
18
|
-
Jeweler::GemcutterTasks.new
|
19
|
-
rescue LoadError
|
20
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
|
-
end
|
3
|
+
require 'bundler'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'rspec'
|
6
|
+
require 'rspec/core/rake_task'
|
22
7
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
t.rcov_opts = ["--exclude", "^spec,/gems/"]
|
27
|
-
end
|
8
|
+
require 'vidibus/pureftpd'
|
9
|
+
|
10
|
+
Bundler::GemHelper.install_tasks
|
28
11
|
|
29
12
|
Rake::RDocTask.new do |rdoc|
|
30
|
-
|
31
|
-
rdoc.
|
32
|
-
rdoc.
|
33
|
-
rdoc.rdoc_files.include(
|
34
|
-
rdoc.
|
35
|
-
rdoc.options << "--charset=utf-8"
|
13
|
+
rdoc.rdoc_dir = 'rdoc'
|
14
|
+
rdoc.title = "Vidibus::Pureftpd #{Vidibus::Pureftpd::VERSION}"
|
15
|
+
rdoc.rdoc_files.include('README*')
|
16
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
17
|
+
rdoc.options << '--charset=utf-8'
|
36
18
|
end
|
data/lib/vidibus-pureftpd.rb
CHANGED
data/lib/vidibus/pureftpd.rb
CHANGED
@@ -1,15 +1,19 @@
|
|
1
|
-
module Vidibus
|
1
|
+
module Vidibus
|
2
2
|
module Pureftpd
|
3
|
+
VERSION = '0.1.0'
|
4
|
+
|
3
5
|
class Error < StandardError; end
|
4
|
-
|
6
|
+
|
5
7
|
class << self
|
6
|
-
|
8
|
+
|
7
9
|
# Default settings for Pure-FTPd.
|
10
|
+
# You may overwrite settings like this:
|
11
|
+
# Vidibus::Pureftpd.settings[:sysuser] = 'desaster_master'
|
8
12
|
def settings
|
9
13
|
@settings ||= {
|
10
|
-
:sysuser =>
|
11
|
-
:sysgroup =>
|
12
|
-
:password_file =>
|
14
|
+
:sysuser => 'pureftpd_user',
|
15
|
+
:sysgroup => 'pureftpd_group',
|
16
|
+
:password_file => '/etc/pure-ftpd/pureftpd.passwd'
|
13
17
|
}
|
14
18
|
end
|
15
19
|
|
@@ -18,10 +22,10 @@ module Vidibus # :nodoc
|
|
18
22
|
# :login, :password, :directory
|
19
23
|
def add_user(options)
|
20
24
|
unless options.keys?(:login, :password, :directory)
|
21
|
-
raise ArgumentError.new(
|
25
|
+
raise ArgumentError.new('Required options are :login, :password, :directory')
|
22
26
|
end
|
23
27
|
password = options.delete(:password)
|
24
|
-
cmd =
|
28
|
+
cmd = 'pure-pw useradd %{login} -f %{password_file} -u %{sysuser} -g %{sysgroup} -d %{directory} -m' % settings.merge(options)
|
25
29
|
perform(cmd) do |stdin, stdout, stderr|
|
26
30
|
stdin.puts(password)
|
27
31
|
stdin.puts(password)
|
@@ -33,19 +37,21 @@ module Vidibus # :nodoc
|
|
33
37
|
# :login
|
34
38
|
def delete_user(options)
|
35
39
|
unless options.key?(:login)
|
36
|
-
raise ArgumentError.new(
|
40
|
+
raise ArgumentError.new('Required option is :login')
|
37
41
|
end
|
38
|
-
cmd =
|
42
|
+
cmd = 'pure-pw userdel %{login} -f %{password_file} -m' % settings.merge(options)
|
39
43
|
perform(cmd)
|
40
44
|
end
|
41
45
|
|
42
|
-
# Changes password of existing user
|
46
|
+
# Changes password of existing user.
|
47
|
+
# Required options:
|
48
|
+
# :login, :password
|
43
49
|
def change_password(options)
|
44
50
|
unless options.keys?(:login, :password)
|
45
|
-
raise ArgumentError.new(
|
51
|
+
raise ArgumentError.new('Required options are :login, :password')
|
46
52
|
end
|
47
53
|
password = options.delete(:password)
|
48
|
-
cmd =
|
54
|
+
cmd = 'pure-pw passwd %{login} -f %{password_file} -m' % settings.merge(options)
|
49
55
|
perform(cmd) do |stdin, stdout, stderr|
|
50
56
|
stdin.puts(password)
|
51
57
|
stdin.puts(password)
|
@@ -56,14 +62,15 @@ module Vidibus # :nodoc
|
|
56
62
|
|
57
63
|
# Performs given command. Accepts a block with |stdin, stdout, stderr|.
|
58
64
|
def perform(cmd, &block)
|
59
|
-
error =
|
65
|
+
error = ''
|
60
66
|
Open3.popen3(cmd) do |stdin, stdout, stderr|
|
61
67
|
yield(stdin, stdout, stderr) if block_given?
|
62
68
|
error = stderr.read
|
63
69
|
end
|
64
|
-
unless error ==
|
65
|
-
raise Error.new("Error while
|
70
|
+
unless error == ''
|
71
|
+
raise Error.new("Error while executing this command:\n#{cmd}\n\n#{error}")
|
66
72
|
end
|
73
|
+
true
|
67
74
|
end
|
68
75
|
end
|
69
76
|
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
module Vidibus
|
2
|
+
module Pureftpd
|
3
|
+
class User
|
4
|
+
include ActiveModel::Validations
|
5
|
+
include ActiveModel::Dirty
|
6
|
+
|
7
|
+
attr_accessor :login, :password, :directory
|
8
|
+
|
9
|
+
validate :login, :password, :directory, :presence => true
|
10
|
+
validates :unique_login
|
11
|
+
|
12
|
+
def initialize(values = {})
|
13
|
+
attributes = values
|
14
|
+
end
|
15
|
+
|
16
|
+
def save
|
17
|
+
persisted? ? update : create
|
18
|
+
end
|
19
|
+
|
20
|
+
def destroy
|
21
|
+
cmd = 'userdel %{login} -f %{password_file} -m' % settings
|
22
|
+
perform(cmd)
|
23
|
+
user.instance_variable_set('@is_persisted', false)
|
24
|
+
end
|
25
|
+
|
26
|
+
def persisted?
|
27
|
+
@is_persisted || User.find(login)
|
28
|
+
end
|
29
|
+
|
30
|
+
def attributes
|
31
|
+
hash = {}
|
32
|
+
[:login, :password, :directory].each do |a|
|
33
|
+
hash[a] = send(a)
|
34
|
+
end
|
35
|
+
hash
|
36
|
+
end
|
37
|
+
|
38
|
+
def attributes=(values)
|
39
|
+
values.each {|a| self.send("#{a}=")}
|
40
|
+
end
|
41
|
+
|
42
|
+
def reload
|
43
|
+
attributes = User.find(login).attributes
|
44
|
+
end
|
45
|
+
|
46
|
+
def settings
|
47
|
+
attributes.merge(Vidibus::Pureftpd.settings)
|
48
|
+
end
|
49
|
+
|
50
|
+
class << self
|
51
|
+
|
52
|
+
def find(login)
|
53
|
+
cmd = 'show %{login} -f %{password_file}' % settings
|
54
|
+
data = Vidibus::Pureftpd.perform(cmd)
|
55
|
+
attributes = {}
|
56
|
+
User.new(attributes).tap do |user|
|
57
|
+
user.instance_variable_set('@is_persisted', true)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def create(attributes)
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def unique_login
|
69
|
+
puts %(login = #{login.inspect})
|
70
|
+
puts %(login_was = #{login_was.inspect})
|
71
|
+
end
|
72
|
+
|
73
|
+
def update
|
74
|
+
if login_changed?
|
75
|
+
a = attributes
|
76
|
+
end
|
77
|
+
if password_changed?
|
78
|
+
update_password
|
79
|
+
end
|
80
|
+
|
81
|
+
# usermod
|
82
|
+
end
|
83
|
+
|
84
|
+
def create
|
85
|
+
cmd = 'useradd %{login} -f %{password_file} -u %{sysuser} -g %{sysgroup} -d %{directory} -m' % settings
|
86
|
+
perform_with_password_input(cmd)
|
87
|
+
end
|
88
|
+
|
89
|
+
def update_password
|
90
|
+
cmd = 'pure-pw passwd %{login} -f %{password_file} -m' % settings
|
91
|
+
perform_with_password_input(cmd)
|
92
|
+
end
|
93
|
+
|
94
|
+
def perform(cmd)
|
95
|
+
Vidibus::Pureftpd.perform(cmd)
|
96
|
+
rescue Vidibus::Pureftpd::Error => e
|
97
|
+
raise fucked
|
98
|
+
end
|
99
|
+
|
100
|
+
def perform_with_password_input(cmd)
|
101
|
+
perform(cmd) do |stdin, stdout, stderr|
|
102
|
+
stdin.puts(password)
|
103
|
+
stdin.puts(password)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
metadata
CHANGED
@@ -1,95 +1,166 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: vidibus-pureftpd
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
version: 0.0.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Andre Pankratz
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-09-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: vidibus-core_extensions
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
33
22
|
type: :runtime
|
34
|
-
|
35
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.0.0
|
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: 1.0.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '2'
|
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: '2'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rr
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
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: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
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'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rdoc
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: simplecov
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
description: Interface for Pure-FTPd
|
36
127
|
email: andre@vidibus.com
|
37
128
|
executables: []
|
38
|
-
|
39
129
|
extensions: []
|
40
|
-
|
41
|
-
|
42
|
-
-
|
43
|
-
-
|
44
|
-
|
45
|
-
- .
|
46
|
-
- .gitignore
|
47
|
-
- .rspec
|
48
|
-
- Gemfile
|
49
|
-
- Gemfile.lock
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- lib/vidibus/pureftpd/user.rb
|
133
|
+
- lib/vidibus/pureftpd/version.rb
|
134
|
+
- lib/vidibus/pureftpd.rb
|
135
|
+
- lib/vidibus-pureftpd.rb
|
50
136
|
- LICENSE
|
51
|
-
- README.
|
137
|
+
- README.md
|
52
138
|
- Rakefile
|
53
|
-
-
|
54
|
-
- lib/vidibus-pureftpd.rb
|
55
|
-
- lib/vidibus/pureftpd.rb
|
56
|
-
- spec/spec_helper.rb
|
57
|
-
- spec/vidibus/pureftpd_spec.rb
|
58
|
-
- vidibus-pureftpd.gemspec
|
59
|
-
has_rdoc: true
|
60
|
-
homepage: http://github.com/vidibus/vidibus-pureftpd
|
139
|
+
homepage: https://github.com/vidibus/vidibus-pureftpd
|
61
140
|
licenses: []
|
62
|
-
|
63
141
|
post_install_message:
|
64
|
-
rdoc_options:
|
65
|
-
|
66
|
-
require_paths:
|
142
|
+
rdoc_options: []
|
143
|
+
require_paths:
|
67
144
|
- lib
|
68
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
146
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
segments:
|
147
|
+
requirements:
|
148
|
+
- - ! '>='
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
segments:
|
75
152
|
- 0
|
76
|
-
|
77
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
hash: -1082857674235287288
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
155
|
none: false
|
79
|
-
requirements:
|
80
|
-
- -
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
|
83
|
-
segments:
|
84
|
-
- 0
|
85
|
-
version: "0"
|
156
|
+
requirements:
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 1.3.6
|
86
160
|
requirements: []
|
87
|
-
|
88
161
|
rubyforge_project:
|
89
|
-
rubygems_version: 1.
|
162
|
+
rubygems_version: 1.8.24
|
90
163
|
signing_key:
|
91
164
|
specification_version: 3
|
92
|
-
summary:
|
93
|
-
test_files:
|
94
|
-
- spec/spec_helper.rb
|
95
|
-
- spec/vidibus/pureftpd_spec.rb
|
165
|
+
summary: Ruby module for controlling Pure-FTPd
|
166
|
+
test_files: []
|
data/.bundle/config
DELETED
data/.gitignore
DELETED
data/.rspec
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://gemcutter.org/
|
3
|
-
specs:
|
4
|
-
diff-lcs (1.1.2)
|
5
|
-
relevance-rcov (0.9.2.1)
|
6
|
-
rspec (2.0.0.beta.20)
|
7
|
-
rspec-core (= 2.0.0.beta.20)
|
8
|
-
rspec-expectations (= 2.0.0.beta.20)
|
9
|
-
rspec-mocks (= 2.0.0.beta.20)
|
10
|
-
rspec-core (2.0.0.beta.20)
|
11
|
-
rspec-expectations (2.0.0.beta.20)
|
12
|
-
diff-lcs (>= 1.1.2)
|
13
|
-
rspec-mocks (2.0.0.beta.20)
|
14
|
-
vidibus-core_extensions (0.3.6)
|
15
|
-
|
16
|
-
PLATFORMS
|
17
|
-
ruby
|
18
|
-
|
19
|
-
DEPENDENCIES
|
20
|
-
bundler (~> 1.0.0.beta)
|
21
|
-
relevance-rcov
|
22
|
-
rspec (~> 2.0.0.beta.20)
|
23
|
-
vidibus-core_extensions
|
data/README.rdoc
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
= vidibus-pureftpd
|
2
|
-
|
3
|
-
This gem is part of the open source SOA framework Vidibus: http://www.vidibus.org
|
4
|
-
|
5
|
-
TODO: describe
|
6
|
-
|
7
|
-
|
8
|
-
== Installation
|
9
|
-
|
10
|
-
Add the dependency to the Gemfile of your application:
|
11
|
-
|
12
|
-
gem "vidibus-pureftpd"
|
13
|
-
|
14
|
-
Then call bundle install on your console.
|
15
|
-
|
16
|
-
|
17
|
-
== Usage
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
== Install Pure-FTPd on Debian Lenny
|
22
|
-
|
23
|
-
# Get the package:
|
24
|
-
aptitude install pure-ftpd-common pure-ftpd
|
25
|
-
|
26
|
-
# Add group pureftpd_group:
|
27
|
-
groupadd pureftpd_group
|
28
|
-
|
29
|
-
# Add user pureftpd_user without permission to a home directory or any shell:
|
30
|
-
useradd -g pureftpd_group -d /dev/null -s /etc pureftpd_user
|
31
|
-
|
32
|
-
|
33
|
-
# By default all user data will be saved in /etc/pure-ftpd/pureftpd.passwd, so make sure this file exists:
|
34
|
-
touch /etc/pure-ftpd/pureftpd.passwd
|
35
|
-
|
36
|
-
# For fast access of user data, Pure-FTPd creates a "database", which is a binary file that is ordered and has an index for quick access. Let's create this database:
|
37
|
-
pure-pw mkdb
|
38
|
-
|
39
|
-
# For more instructions, please refer to http://linux.justinhartman.com/PureFTPd_Installation_and_Setup
|
40
|
-
|
41
|
-
|
42
|
-
== TODO
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
== Copyright
|
47
|
-
|
48
|
-
Copyright (c) 2010 Andre Pankratz. See LICENSE for details.
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.0
|
data/spec/spec_helper.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "Vidibus::Pureftpd" do
|
4
|
-
let(:pureftpd) do
|
5
|
-
Vidibus::Pureftpd.tap do |p|
|
6
|
-
p.settings[:sysuser] = "pureftpd_user"
|
7
|
-
p.settings[:sysgroup] = "pureftpd_group"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:login) { "pureftpd_tester" }
|
12
|
-
let(:password) { "secret" }
|
13
|
-
let(:directory) { "/tmp/tester" }
|
14
|
-
|
15
|
-
def setup
|
16
|
-
pureftpd.add_user(:login => login, :password => password, :directory => directory)
|
17
|
-
rescue
|
18
|
-
end
|
19
|
-
|
20
|
-
def teardown
|
21
|
-
pureftpd.delete_user(:login => login)
|
22
|
-
rescue
|
23
|
-
end
|
24
|
-
|
25
|
-
describe ".add_user" do
|
26
|
-
it "should raise an error unless all required options are given" do
|
27
|
-
expect { pureftpd.add_user(:login => login, :password => password) }.to raise_error(ArgumentError)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should add a new ftp user" do
|
31
|
-
pureftpd.add_user(:login => login, :password => password, :directory => directory)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should raise an error if user already exists" do
|
35
|
-
pureftpd.add_user(:login => login, :password => password, :directory => directory)
|
36
|
-
expect {
|
37
|
-
pureftpd.add_user(:login => login, :password => password, :directory => directory)
|
38
|
-
}.to raise_error(Vidibus::Pureftpd::Error)
|
39
|
-
end
|
40
|
-
|
41
|
-
after { teardown }
|
42
|
-
end
|
43
|
-
|
44
|
-
describe ".delete_user" do
|
45
|
-
before { setup }
|
46
|
-
|
47
|
-
it "should raise an error unless all required options are given" do
|
48
|
-
expect { pureftpd.delete_user }.to raise_error(ArgumentError)
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should delete an existing ftp user" do
|
52
|
-
pureftpd.delete_user(:login => login)
|
53
|
-
end
|
54
|
-
|
55
|
-
it "should raise an error if user does not exist" do
|
56
|
-
pureftpd.delete_user(:login => login)
|
57
|
-
expect {
|
58
|
-
pureftpd.delete_user(:login => login)
|
59
|
-
}.to raise_error(Vidibus::Pureftpd::Error)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe ".change_password" do
|
64
|
-
it "should raise an error unless all required options are given" do
|
65
|
-
expect { pureftpd.change_password(:login => login) }.to raise_error(ArgumentError)
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should change the password of an existing ftp user" do
|
69
|
-
setup
|
70
|
-
pureftpd.change_password(:login => login, :password => password)
|
71
|
-
teardown
|
72
|
-
end
|
73
|
-
|
74
|
-
it "should raise an error if user does not exist" do
|
75
|
-
expect {
|
76
|
-
pureftpd.change_password(:login => login, :password => password)
|
77
|
-
}.to raise_error(Vidibus::Pureftpd::Error)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
data/vidibus-pureftpd.gemspec
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{vidibus-pureftpd}
|
8
|
-
s.version = "0.0.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Andre Pankratz"]
|
12
|
-
s.date = %q{2010-09-23}
|
13
|
-
s.description = %q{Description...}
|
14
|
-
s.email = %q{andre@vidibus.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".bundle/config",
|
21
|
-
".gitignore",
|
22
|
-
".rspec",
|
23
|
-
"Gemfile",
|
24
|
-
"Gemfile.lock",
|
25
|
-
"LICENSE",
|
26
|
-
"README.rdoc",
|
27
|
-
"Rakefile",
|
28
|
-
"VERSION",
|
29
|
-
"lib/vidibus-pureftpd.rb",
|
30
|
-
"lib/vidibus/pureftpd.rb",
|
31
|
-
"spec/spec_helper.rb",
|
32
|
-
"spec/vidibus/pureftpd_spec.rb",
|
33
|
-
"vidibus-pureftpd.gemspec"
|
34
|
-
]
|
35
|
-
s.homepage = %q{http://github.com/vidibus/vidibus-pureftpd}
|
36
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
37
|
-
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = %q{1.3.7}
|
39
|
-
s.summary = %q{Provides interface for Pure-FTPd}
|
40
|
-
s.test_files = [
|
41
|
-
"spec/spec_helper.rb",
|
42
|
-
"spec/vidibus/pureftpd_spec.rb"
|
43
|
-
]
|
44
|
-
|
45
|
-
if s.respond_to? :specification_version then
|
46
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
|
-
s.specification_version = 3
|
48
|
-
|
49
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
|
-
s.add_runtime_dependency(%q<vidibus-core_extensions>, [">= 0"])
|
51
|
-
else
|
52
|
-
s.add_dependency(%q<vidibus-core_extensions>, [">= 0"])
|
53
|
-
end
|
54
|
-
else
|
55
|
-
s.add_dependency(%q<vidibus-core_extensions>, [">= 0"])
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|