solokit 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/README.markdown +29 -0
  2. data/chef/roles/base.json +13 -0
  3. data/chef/server.json +5 -0
  4. data/chef/solo.rb +6 -0
  5. data/cookbooks/site/users/definitions/add_keys.rb +45 -0
  6. data/cookbooks/site/users/recipes/default.rb +34 -0
  7. data/cookbooks/upstream/apt/files/default/apt-cacher +9 -0
  8. data/cookbooks/upstream/apt/files/default/apt-cacher.conf +144 -0
  9. data/cookbooks/upstream/apt/files/default/apt-proxy-v2.conf +50 -0
  10. data/cookbooks/upstream/apt/metadata.json +51 -0
  11. data/cookbooks/upstream/apt/metadata.rb +11 -0
  12. data/cookbooks/upstream/apt/recipes/cacher.rb +42 -0
  13. data/cookbooks/upstream/apt/recipes/default.rb +33 -0
  14. data/cookbooks/upstream/apt/recipes/proxy.rb +34 -0
  15. data/cookbooks/upstream/ruby-shadow/attributes/ruby-shadow.rb +1 -0
  16. data/cookbooks/upstream/ruby-shadow/files/default/shadow-1.4.1/HISTORY +34 -0
  17. data/cookbooks/upstream/ruby-shadow/files/default/shadow-1.4.1/MANIFEST +7 -0
  18. data/cookbooks/upstream/ruby-shadow/files/default/shadow-1.4.1/README +79 -0
  19. data/cookbooks/upstream/ruby-shadow/files/default/shadow-1.4.1/README.euc +80 -0
  20. data/cookbooks/upstream/ruby-shadow/files/default/shadow-1.4.1/depend +1 -0
  21. data/cookbooks/upstream/ruby-shadow/files/default/shadow-1.4.1/extconf.rb +26 -0
  22. data/cookbooks/upstream/ruby-shadow/files/default/shadow-1.4.1/shadow.c +281 -0
  23. data/cookbooks/upstream/ruby-shadow/recipes/default.rb +15 -0
  24. data/cookbooks/upstream/sudo/attributes/sudoers.rb +21 -0
  25. data/cookbooks/upstream/sudo/metadata.json +96 -0
  26. data/cookbooks/upstream/sudo/metadata.rb +31 -0
  27. data/cookbooks/upstream/sudo/recipes/default.rb +33 -0
  28. data/cookbooks/upstream/sudo/templates/default/sudoers.erb +22 -0
  29. data/cookbooks/upstream/users/attributes/default.rb +4 -0
  30. data/cookbooks/upstream/users/definitions/add_keys.rb +38 -0
  31. data/cookbooks/upstream/users/libraries/roles.rb +17 -0
  32. data/cookbooks/upstream/users/metadata.json +38 -0
  33. data/cookbooks/upstream/users/metadata.rb +4 -0
  34. data/cookbooks/upstream/users/recipes/default.rb +17 -0
  35. data/cookbooks/upstream/users/templates/default/authorized_keys.erb +5 -0
  36. data/lib/chef.rb +11 -10
  37. data/lib/solokit/version.rb +1 -1
  38. metadata +38 -4
  39. data/README +0 -1
data/README.markdown ADDED
@@ -0,0 +1,29 @@
1
+ A toolkit for provisioning (ubuntu-)servers using chef-solo.
2
+
3
+ Solokit
4
+ ---
5
+
6
+ * A set of wrappers around SSH and Chef Solo.
7
+ * Code for setting up user accounts (optionally setting passwords, ssh-keys and sudo access).
8
+ * Uses nesting to override configuration and cookbooks.
9
+
10
+ Cookbooks and configuration
11
+ ---
12
+
13
+ Solokit includes some defaults so that you don't have to repeat the same things for each server. Any "cookbook" or "chef" directories in the root of your project will be copied over the defaults (but not replace them entierly). The same goes for any "cookbook" or "chef" directories for a specific environment.
14
+
15
+ An environment can be anything from one server to a staging cluster. Within an environment you can run specific configuration for each server, but Solokit defaults to "server.json".
16
+
17
+ For each layer, Solokit looks for a directory structure like this:
18
+
19
+ cookbooks/upstream # Unchanged cookbooks downloaded from opscode, or simular.
20
+ cookbooks/site # Changes or entierly new cookbooks for Solokit, your project or env.
21
+ chef/solo.rb # Specifies where to find files.
22
+ chef/server.json # Default config, just calls roles/base.rb.
23
+ chef/roles/base.rb # Base configuration
24
+
25
+ Usage
26
+ ---
27
+
28
+ TBD
29
+
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "Base",
3
+ "chef_type": "role",
4
+ "json_class": "Chef::Role",
5
+ "override_attributes": {
6
+ // "tz": "Europe/Stockholm"
7
+ },
8
+ "run_list": [
9
+ "recipe[apt]",
10
+ "role[users]"
11
+ ]
12
+ }
13
+
data/chef/server.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "run_list": [
3
+ "role[base]"
4
+ ]
5
+ }
data/chef/solo.rb ADDED
@@ -0,0 +1,6 @@
1
+ file_cache_path "/tmp/chef-solo"
2
+ cookbook_path [ "/var/chef-solo/upstream-cookbooks", "/var/chef-solo/site-cookbooks" ]
3
+ role_path "/etc/chef/roles"
4
+ log_level :info
5
+ log_location STDOUT
6
+ ssl_verify_mode :verify_none
@@ -0,0 +1,45 @@
1
+ define :add_keys, :conf => {} do
2
+ config = params[:conf]
3
+ name = params[:name]
4
+ keys = Mash.new
5
+ keys[name] = node[:ssh_keys][name]
6
+
7
+ if config[:ssh_key_groups]
8
+ config[:ssh_key_groups].each do |group|
9
+ node[:users].find_all { |u| u.last[:groups].include?(group) }.each do |user|
10
+ keys[user.first] = node[:ssh_keys][user.first]
11
+ end
12
+ end
13
+ end
14
+
15
+ if config[:extra_ssh_keys]
16
+ config[:extra_ssh_keys].each do |username|
17
+ keys[username] = node[:ssh_keys][username]
18
+ end
19
+ end
20
+
21
+ # Made home configurable
22
+ ssh_dir = "#{node[:users][name][:home] || "/home/#{name}"}/.ssh"
23
+
24
+ directory ssh_dir do
25
+ action :create
26
+ owner name
27
+ group config[:groups] ? config[:groups].first.to_s : name
28
+ mode 0755
29
+ not_if { File.exists? ssh_dir }
30
+ end
31
+
32
+ template "#{ssh_dir}/authorized_keys" do
33
+ source "authorized_keys.erb"
34
+ action :create
35
+ owner name
36
+ group config[:groups] ? config[:groups].first.to_s : name
37
+ variables(:keys => keys)
38
+ mode 0600
39
+ not_if {
40
+ # To avoid stale handle on NFS mounted homes when writing.
41
+ system "cat #{ssh_dir}/authorized_keys > /dev/null; true"
42
+
43
+ defined?(node[:users][name][:preserve_keys]) ? node[:users][name][:preserve_keys] : false }
44
+ end
45
+ end
@@ -0,0 +1,34 @@
1
+ include_recipe "ruby-shadow"
2
+
3
+ if node[:users]
4
+
5
+ node[:users].keys.each do |username|
6
+ config = node[:users][username]
7
+ user username do
8
+ comment config[:comment]
9
+
10
+ # Added config for home in this site specific cookbook:
11
+ if config[:home]
12
+ if config[:home] != '/root'
13
+ parent_dir = config[:home].split("/")[0..-2].join("/")
14
+ FileUtils.mkdir_p(parent_dir) unless File.exists?(parent_dir)
15
+ end
16
+
17
+ home_path = config[:home]
18
+ home home_path
19
+ else
20
+ home_path = "/home/#{username}"
21
+ home home_path
22
+ end
23
+
24
+ Kernel.system "chmod 700 #{home_path}" if config[:hidden_home]
25
+
26
+ shell "/bin/bash"
27
+ password config[:password]
28
+ supports :manage_home => true
29
+ action [:create, :manage]
30
+ end
31
+
32
+ add_keys username
33
+ end
34
+ end
@@ -0,0 +1,9 @@
1
+ # apt-cacher startup configuration file
2
+
3
+ # IMPORTANT: check the apt-cacher.conf file before using apt-cacher as daemon.
4
+
5
+ # set to 1 to start the daemon at boot time
6
+ AUTOSTART=1
7
+
8
+ # extra settings to override the ones in apt-cacher.conf
9
+ # EXTRAOPT=" daemon_port=3142 limit=30 "
@@ -0,0 +1,144 @@
1
+ # This file has been modified by ./apt-proxy-to-apt-cacher
2
+ # Some lines may have been appended at the bottom of this file
3
+ # This file has been modified by /usr/share/apt-cacher/apt-proxy-to-apt-cacher
4
+ # Some lines may have been appended at the bottom of this file
5
+ #################################################################
6
+ # This is the config file for apt-cacher. On most Debian systems
7
+ # you can safely leave the defaults alone.
8
+ #################################################################
9
+
10
+ # cache_dir is used to set the location of the local cache. This can
11
+ # become quite large, so make sure it is somewhere with plenty of space.
12
+ cache_dir=/var/cache/apt-cacher
13
+
14
+ # The email address of the administrator is displayed in the info page
15
+ # and traffic reports.
16
+ admin_email=root@localhost
17
+
18
+ # For the daemon startup settings please edit the file /etc/default/apt-cacher.
19
+
20
+ # Daemon port setting, only useful in stand-alone mode. You need to run the
21
+ # daemon as root to use privileged ports (<1024).
22
+ daemon_port = 3142
23
+
24
+ # optional settings, user and group to run the daemon as. Make sure they have
25
+ # sufficient permissions on the cache and log directories. Comment the settings
26
+ # to run apt-cacher as the native user.
27
+ group=www-data
28
+ user=www-data
29
+
30
+ # optional setting, binds the listening daemon to one specified IP. Use IP
31
+ # ranges for more advanced configuration, see below.
32
+ # daemon_addr=localhost
33
+
34
+ # If your apt-cacher machine is directly exposed to the Internet and you are
35
+ # worried about unauthorised machines fetching packages through it, you can
36
+ # specify a list of IPv4 addresses which are allowed to use it and another
37
+ # list of IPv4 addresses which aren't.
38
+ # Localhost (127.0.0.1) is always allowed. Other addresses must be matched
39
+ # by allowed_hosts and not by denied_hosts to be permitted to use the cache.
40
+ # Setting allowed_hosts to "*" means "allow all".
41
+ # Otherwise the format is a comma-separated list containing addresses,
42
+ # optionally with masks (like 10.0.0.0/22), or ranges of addresses (two
43
+ # addresses separated by a hyphen, no masks, like '192.168.0.3-192.168.0.56').
44
+ allowed_hosts=*
45
+ denied_hosts=
46
+
47
+ # And similiarly for IPv6 with allowed_hosts_6 and denied_hosts_6.
48
+ # Note that IPv4-mapped IPv6 addresses (::ffff:w.x.y.z) are truncated to
49
+ # w.x.y.z and are handled as IPv4.
50
+ allowed_hosts_6=fec0::/16
51
+ denied_hosts_6=
52
+
53
+ # This thing can be done by Apache but is much simplier here - limit access to
54
+ # Debian mirrors based on server names in the URLs
55
+ #allowed_locations=ftp.uni-kl.de,ftp.nerim.net,debian.tu-bs.de
56
+
57
+ # Apt-cacher can generate usage reports every 24 hours if you set this
58
+ # directive to 1. You can view the reports in a web browser by pointing
59
+ # to your cache machine with '/apt-cacher/report' on the end, like this:
60
+ # http://yourcache.example.com/apt-cacher/report
61
+ # Generating reports is very fast even with many thousands of logfile
62
+ # lines, so you can safely turn this on without creating much
63
+ # additional system load.
64
+ generate_reports=1
65
+
66
+ # Apt-cacher can clean up its cache directory every 24 hours if you set
67
+ # this directive to 1. Cleaning the cache can take some time to run
68
+ # (generally in the order of a few minutes) and removes all package
69
+ # files that are not mentioned in any existing 'Packages' lists. This
70
+ # has the effect of deleting packages that have been superseded by an
71
+ # updated 'Packages' list.
72
+ clean_cache=1
73
+
74
+ # The directory to use for apt-cacher access and error logs.
75
+ # The access log records every request in the format:
76
+ # date-time|client ip address|HIT/MISS/EXPIRED|object size|object name
77
+ # The error log is slightly more free-form, and is also used for debug
78
+ # messages if debug mode is turned on.
79
+ # Note that the old 'logfile' and 'errorfile' directives are
80
+ # deprecated: if you set them explicitly they will be honoured, but it's
81
+ # better to just get rid of them from old config files.
82
+ logdir=/var/log/apt-cacher
83
+
84
+ # apt-cacher can use different methods to decide whether package lists need to
85
+ # be updated,
86
+ # A) looking at the age of the cached files
87
+ # B) getting HTTP header from server and comparing that with cached data. This
88
+ # method is more reliable and avoids desynchronisation of data and index files
89
+ # but needs to transfer few bytes from the server every time somebody requests
90
+ # the files ("apt-get update")
91
+ # Set the following value to the maximum age (in hours) for method A or to 0
92
+ # for method B
93
+ expire_hours=0
94
+
95
+ # Apt-cacher can pass all its requests to an external http proxy like
96
+ # Squid, which could be very useful if you are using an ISP that blocks
97
+ # port 80 and requires all web traffic to go through its proxy. The
98
+ # format is 'hostname:port', eg: 'proxy.example.com:8080'.
99
+ http_proxy=proxy.example.com:8080
100
+
101
+ # Use of an external proxy can be turned on or off with this flag.
102
+ # Value should be either 0 (off) or 1 (on).
103
+ use_proxy=0
104
+
105
+ # External http proxy sometimes need authentication to get full access. The
106
+ # format is 'username:password'.
107
+ http_proxy_auth=proxyuser:proxypass
108
+
109
+ # Use of external proxy authentication can be turned on or off with this flag.
110
+ # Value should be either 0 (off) or 1 (on).
111
+ use_proxy_auth=0
112
+
113
+ # Rate limiting sets the maximum bandwidth in bytes per second to use
114
+ # for fetching packages. Syntax is fully defined in 'man wget'.
115
+ # Use 'k' or 'm' to use kilobits or megabits / second: eg, 'limit=25k'.
116
+ # Use 0 or a negative value for no rate limiting.
117
+ limit=0
118
+
119
+ # Debug mode makes apt-cacher spew a lot of extra debug junk to the
120
+ # error log (whose location is defined with the 'logdir' directive).
121
+ # Leave this off unless you need it, or your error log will get very
122
+ # big. Acceptable values are 0 or 1.
123
+ debug=0
124
+
125
+ # Adapt the line in the usage info web page to match your server configuration
126
+ # example_sources_line=deb&nbsp;http://<b>my.cacher.server:3142/</b>ftp.au.debian.org/debian&nbsp;unstable&nbsp;main&nbsp;contrib&nbsp;non-free
127
+
128
+ # Print a 410 (Gone) HTTP message with the specified text when accessed via
129
+ # CGI. Useful to tell users to adapt their sources.list files when the
130
+ # apt-cacher server is beeing relocated (via apt-get's error messages while
131
+ # running "update")
132
+ #cgi_advise_to_use = Please use http://cacheserver:3142/ as apt-cacher access URL
133
+ #cgi_advise_to_use = Server relocated. To change sources.list, run perl -pe "s,/apt-cacher\??,:3142," -i /etc/apt/sources.list
134
+
135
+ # Server mapping - this allows to hide real server names behind virtual paths
136
+ # that appear in the access URL. This method is known from apt-proxy. This is
137
+ # also the only method to use FTP access to the target hosts. The syntax is simple, the part of the beginning to replace, followed by a list of mirror urls, all space separated. Multiple profile are separated by semicolons
138
+ # path_map = debian ftp.uni-kl.de/pub/linux/debian ftp2.de.debian.org/debian ; ubuntu archive.ubuntu.com/ubuntu ; security security.debian.org/debian-security ftp2.de.debian.org/debian-security
139
+ # Note that you need to specify all target servers in the allowed_locations
140
+ # options if you make use of it. Also note that the paths should not overlap
141
+ # each other. FTP access method not supported yet, maybe in the future.
142
+
143
+ # extra setting from apt-proxy configuration
144
+ path_map = ubuntu us.archive.ubuntu.com/ubuntu ; ubuntu-security security.ubuntu.com/ubuntu ; debian debian.osuosl.org/debian/ ; security security.debian.org/debian-security
@@ -0,0 +1,50 @@
1
+ [DEFAULT]
2
+ ;; All times are in seconds, but you can add a suffix
3
+ ;; for minutes(m), hours(h) or days(d)
4
+
5
+ ;; commented out address so apt-proxy will listen on all IPs
6
+ ;; address = 127.0.0.1
7
+ port = 9999
8
+ cache_dir = /var/cache/apt-proxy
9
+
10
+ ;; Control files (Packages/Sources/Contents) refresh rate
11
+ min_refresh_delay = 1s
12
+ complete_clientless_downloads = 1
13
+
14
+ ;; Debugging settings.
15
+ debug = all:4 db:0
16
+
17
+ time = 30
18
+ passive_ftp = on
19
+
20
+ ;;--------------------------------------------------------------
21
+ ;; Cache housekeeping
22
+
23
+ cleanup_freq = 1d
24
+ max_age = 120d
25
+ max_versions = 3
26
+
27
+ ;;---------------------------------------------------------------
28
+ ;; Backend servers
29
+ ;;
30
+ ;; Place each server in its own [section]
31
+
32
+ [ubuntu]
33
+ ; Ubuntu archive
34
+ backends =
35
+ http://us.archive.ubuntu.com/ubuntu
36
+
37
+ [ubuntu-security]
38
+ ; Ubuntu security updates
39
+ backends = http://security.ubuntu.com/ubuntu
40
+
41
+ [debian]
42
+ ;; Backend servers, in order of preference
43
+ backends =
44
+ http://debian.osuosl.org/debian/
45
+
46
+ [security]
47
+ ;; Debian security archive
48
+ backends =
49
+ http://security.debian.org/debian-security
50
+ http://ftp2.de.debian.org/debian-security
@@ -0,0 +1,51 @@
1
+ {
2
+ "maintainer": "Opscode, Inc.",
3
+ "description": "Configures apt and apt services",
4
+ "recommendations": {
5
+
6
+ },
7
+ "maintainer_email": "cookbooks@opscode.com",
8
+ "recipes": {
9
+ "apt::proxy": "Set up an APT proxy",
10
+ "apt": "",
11
+ "apt::cacher": "Set up an APT cache"
12
+ },
13
+ "suggestions": {
14
+
15
+ },
16
+ "platforms": {
17
+ "ubuntu": [
18
+
19
+ ],
20
+ "debian": [
21
+
22
+ ]
23
+ },
24
+ "version": "0.8.0",
25
+ "name": "apt",
26
+ "conflicting": {
27
+
28
+ },
29
+ "attributes": {
30
+
31
+ },
32
+ "providing": {
33
+ "apt::proxy": [
34
+
35
+ ],
36
+ "apt": [
37
+
38
+ ],
39
+ "apt::cacher": [
40
+
41
+ ]
42
+ },
43
+ "license": "Apache 2.0",
44
+ "long_description": "",
45
+ "replacing": {
46
+
47
+ },
48
+ "dependencies": {
49
+
50
+ }
51
+ }
@@ -0,0 +1,11 @@
1
+ maintainer "Opscode, Inc."
2
+ maintainer_email "cookbooks@opscode.com"
3
+ license "Apache 2.0"
4
+ description "Configures apt and apt services"
5
+ version "0.8"
6
+ recipe "apt::cacher", "Set up an APT cache"
7
+ recipe "apt::proxy", "Set up an APT proxy"
8
+
9
+ %w{ ubuntu debian }.each do |os|
10
+ supports os
11
+ end
@@ -0,0 +1,42 @@
1
+ #
2
+ # Cookbook Name:: apt
3
+ # Recipe:: cacher
4
+ #
5
+ # Copyright 2008-2009, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ package "apt-cacher" do
20
+ action :install
21
+ end
22
+
23
+ service "apt-cacher" do
24
+ supports :restart => true, :status => false
25
+ action [ :enable, :start ]
26
+ end
27
+
28
+ remote_file "/etc/apt-cacher/apt-cacher.conf" do
29
+ source "apt-cacher.conf"
30
+ owner "root"
31
+ group "root"
32
+ mode 0644
33
+ notifies :restart, resources(:service => "apt-cacher")
34
+ end
35
+
36
+ remote_file "/etc/default/apt-cacher" do
37
+ source "apt-cacher"
38
+ owner "root"
39
+ group "root"
40
+ mode 0644
41
+ notifies :restart, resources(:service => "apt-cacher")
42
+ end
@@ -0,0 +1,33 @@
1
+ #
2
+ # Cookbook Name:: apt
3
+ # Recipe:: default
4
+ #
5
+ # Copyright 2008-2009, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ e = execute "apt-get update" do
21
+ action :nothing
22
+ end
23
+
24
+ e.run_action(:run)
25
+
26
+ %w{/var/cache/local /var/cache/local/preseeding}.each do |dirname|
27
+ directory dirname do
28
+ owner "root"
29
+ group "root"
30
+ mode 0755
31
+ action :create
32
+ end
33
+ end
@@ -0,0 +1,34 @@
1
+ #
2
+ # Cookbook Name:: apt
3
+ # Recipe:: proxy
4
+ #
5
+ # Copyright 2008-2009, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ package "apt-proxy" do
20
+ action :install
21
+ end
22
+
23
+ service "apt-proxy" do
24
+ supports :restart => true, :status => false
25
+ action [ :enable, :start ]
26
+ end
27
+
28
+ remote_file "/etc/apt-proxy/apt-proxy-v2.conf" do
29
+ source "apt-proxy-v2.conf"
30
+ owner "root"
31
+ group "root"
32
+ mode 0644
33
+ notifies :restart, resources(:service => "apt-proxy")
34
+ end
@@ -0,0 +1 @@
1
+ set_unless[:ruby_shadow][:site_ruby] = "/usr/local/lib/ruby/site_ruby/1.8"
@@ -0,0 +1,34 @@
1
+ [1999/08/18]
2
+ * version 1.4.1
3
+ - extconf.rb supports glibc2(libc6).
4
+
5
+ [1999/03/09]
6
+ * version 1.4
7
+ - require ruby-1.3 or later version.
8
+ - sShadowPasswd,mShadow,eFileLock was renamed.
9
+ - FileLock class is inner class of Shadow Module.
10
+ - lock,unlock was changed.
11
+ - lock? method was added.
12
+ - getspent,fgetspent doesn't raise EOFError
13
+ - class hierarchy was changed.
14
+ Shadow Module
15
+ + Passwd Module
16
+ + Entry Structure
17
+ + Group Module (not implemented yet)
18
+ + Entry Structure (not implemented yet)
19
+ + FileLock Class
20
+
21
+ [1998/12/17]
22
+ * version 1.3
23
+ - require ruby-1.1d0 or later version.
24
+
25
+ [1998/10/31]
26
+ * version 1.2
27
+ - only some bug fix.
28
+
29
+ [1998/08/31]
30
+ * version 1.1
31
+ - structure Shadow::ShadowPasswd is added.
32
+
33
+ [1998/07/15]
34
+ * version 1.0 released.
@@ -0,0 +1,7 @@
1
+ HISTORY
2
+ MANIFEST
3
+ README
4
+ README.euc
5
+ depend
6
+ extconf.rb
7
+ shadow.c
@@ -0,0 +1,79 @@
1
+ Shadow Password module
2
+
3
+ Copyright (C) 1998-1999 Takaaki Tateishi <ttate@jaist.ac.jp>
4
+ Modified at: <1999/8/19 06:47:14 by ttate>
5
+ License: Free for any use with your own risk!
6
+
7
+
8
+ 1. What's this
9
+
10
+ This is the module which used when you access
11
+ linux shadow password files.
12
+
13
+
14
+ 2. install
15
+
16
+ ruby extconf.rb
17
+ make
18
+ (make install)
19
+
20
+ * Note:
21
+ version 1.3 require the ruby-1.3 or later version.
22
+
23
+ 3. Shadow::Passwd module's methods
24
+
25
+ getspent
26
+ getspnam(name)
27
+ setspent
28
+ endspent
29
+ fgetspent(file)
30
+ sgetspent(str)
31
+ putspent(entry,file)
32
+ lckpwdf,lock
33
+ ulckpwdf,unlock
34
+ lock?
35
+
36
+ 4. Structure
37
+
38
+ Shadow::Passwd::Entry (Struct::PasswdEntry)
39
+ sp_namp - pointer to null-terminated user name.
40
+ sp_pwdp - pointer to null-terminated password.
41
+ sp_lstchg - days since Jan 1, 1970 password was last
42
+ changed.
43
+ sp_min - days before which password may not be changed.
44
+ sp_max - days after which password must be changed.
45
+ sp_warn - days before password is to expire that user is
46
+ warned of pending password expiration.
47
+ sp_inact - days after password expires that account is
48
+ considered inactive and disabled.
49
+ sp_expire - days since Jan 1, 1970 when account will be
50
+
51
+
52
+ 5. Description
53
+
54
+ getspent, getspname, fgetspent and sgetspent each return
55
+ a structure Shadow::Passwd::Entry. getspent returns the
56
+ next entry from the file, and fgetspent returns the next
57
+ entry from the given stream. sgetspent returns a structure
58
+ Shadow::Passwd::Entry using the provided string as input.
59
+ getspnam searches from the current position in the file for
60
+ an entry matching name.
61
+ if you get EOF from each operation, you will get nil.
62
+
63
+ setspent and endspent may be used to begin and end, respe-
64
+ ctively, access to the shadow password file.
65
+
66
+ lckpwdf(lock) and ulckpwdf(unlock) methods should be used
67
+ to insure exclusive access to the /etc/shadow file.
68
+ when either method fail, Exception Shadow::FileLock is raised.
69
+ if you use lock as the iterator, unlock is automatically called
70
+ when you exit the iterator block.
71
+
72
+ 6. Reference
73
+
74
+ * man shadow
75
+ * /usr/include/shadow.h
76
+
77
+
78
+
79
+ ttate@jaist.ac.jp