openshift-origin-controller 1.3.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of openshift-origin-controller might be problematic. Click here for more details.

Files changed (180) hide show
  1. data/COPYRIGHT +1 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +12 -0
  4. data/README.md +3 -0
  5. data/Rakefile +9 -0
  6. data/app/controllers/app_events_controller.rb +115 -0
  7. data/app/controllers/application_templates_controller.rb +19 -0
  8. data/app/controllers/applications_controller.rb +214 -0
  9. data/app/controllers/base_controller.rb +367 -0
  10. data/app/controllers/cartridges_controller.rb +48 -0
  11. data/app/controllers/descriptors_controller.rb +23 -0
  12. data/app/controllers/dns_resolvable_controller.rb +35 -0
  13. data/app/controllers/domains_controller.rb +156 -0
  14. data/app/controllers/emb_cart_controller.rb +276 -0
  15. data/app/controllers/emb_cart_events_controller.rb +52 -0
  16. data/app/controllers/environment_controller.rb +11 -0
  17. data/app/controllers/estimates_controller.rb +71 -0
  18. data/app/controllers/gear_groups_controller.rb +53 -0
  19. data/app/controllers/gears_controller.rb +70 -0
  20. data/app/controllers/keys_controller.rb +96 -0
  21. data/app/controllers/legacy_broker_controller.rb +510 -0
  22. data/app/controllers/quickstarts_controller.rb +29 -0
  23. data/app/controllers/user_controller.rb +38 -0
  24. data/app/helpers/cartridge_helper.rb +25 -0
  25. data/app/helpers/legacy_broker_helper.rb +21 -0
  26. data/app/helpers/user_action_logger.rb +38 -0
  27. data/app/models/application.rb +1718 -0
  28. data/app/models/application_template.rb +27 -0
  29. data/app/models/cartridge_cache.rb +51 -0
  30. data/app/models/cloud_user.rb +334 -0
  31. data/app/models/component_instance.rb +228 -0
  32. data/app/models/connection_endpoint.rb +10 -0
  33. data/app/models/district.rb +210 -0
  34. data/app/models/domain.rb +234 -0
  35. data/app/models/gear.rb +376 -0
  36. data/app/models/group_instance.rb +306 -0
  37. data/app/models/key.rb +20 -0
  38. data/app/models/legacy_reply.rb +15 -0
  39. data/app/models/legacy_request.rb +126 -0
  40. data/app/models/link.rb +11 -0
  41. data/app/models/message.rb +10 -0
  42. data/app/models/name_server_cache.rb +46 -0
  43. data/app/models/optional_param.rb +12 -0
  44. data/app/models/param.rb +13 -0
  45. data/app/models/remote_job.rb +57 -0
  46. data/app/models/rest_application.rb +126 -0
  47. data/app/models/rest_application10.rb +106 -0
  48. data/app/models/rest_application12.rb +124 -0
  49. data/app/models/rest_application_estimate.rb +12 -0
  50. data/app/models/rest_application_template.rb +20 -0
  51. data/app/models/rest_cartridge10.rb +41 -0
  52. data/app/models/rest_cartridge11.rb +151 -0
  53. data/app/models/rest_domain.rb +43 -0
  54. data/app/models/rest_domain10.rb +42 -0
  55. data/app/models/rest_estimates.rb +16 -0
  56. data/app/models/rest_gear.rb +14 -0
  57. data/app/models/rest_gear_group.rb +26 -0
  58. data/app/models/rest_key.rb +24 -0
  59. data/app/models/rest_reply.rb +31 -0
  60. data/app/models/rest_user.rb +43 -0
  61. data/app/models/result_io.rb +67 -0
  62. data/app/models/usage_record.rb +37 -0
  63. data/app/models/validators/app_validator.rb +30 -0
  64. data/app/models/validators/key_validator.rb +30 -0
  65. data/app/models/validators/namespace_validator.rb +18 -0
  66. data/config/routes.rb +36 -0
  67. data/lib/controller_engine.rb +7 -0
  68. data/lib/openshift-origin-controller.rb +14 -0
  69. data/lib/openshift/application_container_proxy.rb +241 -0
  70. data/lib/openshift/auth_service.rb +101 -0
  71. data/lib/openshift/data_store.rb +33 -0
  72. data/lib/openshift/dns_service.rb +41 -0
  73. data/lib/openshift/mongo_data_store.rb +671 -0
  74. data/openshift-origin-controller.gemspec +42 -0
  75. data/rubygem-openshift-origin-controller.spec +274 -0
  76. data/test/cucumber/application-estimate.feature +25 -0
  77. data/test/cucumber/cartridge-10gen-mms-agent.feature +28 -0
  78. data/test/cucumber/cartridge-cron.feature +32 -0
  79. data/test/cucumber/cartridge-haproxy.feature +31 -0
  80. data/test/cucumber/cartridge-jenkins-build.feature +12 -0
  81. data/test/cucumber/cartridge-jenkins-client.feature +10 -0
  82. data/test/cucumber/cartridge-lifecycle-diy.feature +21 -0
  83. data/test/cucumber/cartridge-lifecycle-jbossas.feature +61 -0
  84. data/test/cucumber/cartridge-lifecycle-jbosseap.feature +61 -0
  85. data/test/cucumber/cartridge-lifecycle-jbossews10.feature +61 -0
  86. data/test/cucumber/cartridge-lifecycle-jenkins.feature +41 -0
  87. data/test/cucumber/cartridge-lifecycle-nodejs.feature +59 -0
  88. data/test/cucumber/cartridge-lifecycle-perl.feature +40 -0
  89. data/test/cucumber/cartridge-lifecycle-php.feature +106 -0
  90. data/test/cucumber/cartridge-lifecycle-python.feature +40 -0
  91. data/test/cucumber/cartridge-lifecycle-ruby18.feature +49 -0
  92. data/test/cucumber/cartridge-lifecycle-ruby19.feature +41 -0
  93. data/test/cucumber/cartridge-mongodb.feature +31 -0
  94. data/test/cucumber/cartridge-mysql.feature +30 -0
  95. data/test/cucumber/cartridge-php.feature +14 -0
  96. data/test/cucumber/cartridge-phpmyadmin.feature +32 -0
  97. data/test/cucumber/cartridge-postgresql.feature +32 -0
  98. data/test/cucumber/cartridge-runtime-extended-db.feature +64 -0
  99. data/test/cucumber/cartridge-runtime-extended-jboss.feature +24 -0
  100. data/test/cucumber/cartridge-runtime-extended-nodejs.feature +21 -0
  101. data/test/cucumber/cartridge-runtime-extended-perl.feature +18 -0
  102. data/test/cucumber/cartridge-runtime-extended-php.feature +19 -0
  103. data/test/cucumber/cartridge-runtime-extended-python.feature +18 -0
  104. data/test/cucumber/cartridge-runtime-extended-ruby.feature +22 -0
  105. data/test/cucumber/cartridge-runtime-standard-diy.feature +6 -0
  106. data/test/cucumber/cartridge-runtime-standard-jbossas.feature +7 -0
  107. data/test/cucumber/cartridge-runtime-standard-jbosseap.feature +7 -0
  108. data/test/cucumber/cartridge-runtime-standard-jbossews10.feature +7 -0
  109. data/test/cucumber/cartridge-runtime-standard-jenkins.feature +8 -0
  110. data/test/cucumber/cartridge-runtime-standard-nodejs.feature +7 -0
  111. data/test/cucumber/cartridge-runtime-standard-perl.feature +6 -0
  112. data/test/cucumber/cartridge-runtime-standard-php.feature +6 -0
  113. data/test/cucumber/cartridge-runtime-standard-python.feature +6 -0
  114. data/test/cucumber/cartridge-runtime-standard-ruby.feature +19 -0
  115. data/test/cucumber/cartridge-switchyard.feature +36 -0
  116. data/test/cucumber/descriptor.feature +40 -0
  117. data/test/cucumber/embedded.feature +44 -0
  118. data/test/cucumber/idler.feature +75 -0
  119. data/test/cucumber/misc/descriptor/manifest.yml +22 -0
  120. data/test/cucumber/misc/php/db_test.php +21 -0
  121. data/test/cucumber/openshift-node.feature +21 -0
  122. data/test/cucumber/rest-application-templates.feature +31 -0
  123. data/test/cucumber/rest-applications.feature +431 -0
  124. data/test/cucumber/rest-cartridge-types.feature +16 -0
  125. data/test/cucumber/rest-domains.feature +276 -0
  126. data/test/cucumber/rest-gears.feature +38 -0
  127. data/test/cucumber/rest-keys.feature +247 -0
  128. data/test/cucumber/rest-quickstarts.feature +27 -0
  129. data/test/cucumber/rest-workflow.feature +64 -0
  130. data/test/cucumber/step_definitions/api_steps.rb +369 -0
  131. data/test/cucumber/step_definitions/application-estimate-steps.rb +51 -0
  132. data/test/cucumber/step_definitions/application_steps.rb +215 -0
  133. data/test/cucumber/step_definitions/cartridge-10gen-mms-agent_steps.rb +11 -0
  134. data/test/cucumber/step_definitions/cartridge-cron_steps.rb +51 -0
  135. data/test/cucumber/step_definitions/cartridge-haproxy_steps.rb +30 -0
  136. data/test/cucumber/step_definitions/cartridge-jenkins_steps.rb +93 -0
  137. data/test/cucumber/step_definitions/cartridge-lifecycle-nodejs_steps.rb +30 -0
  138. data/test/cucumber/step_definitions/cartridge-mongodb_steps.rb +60 -0
  139. data/test/cucumber/step_definitions/cartridge-mysql_steps.rb +56 -0
  140. data/test/cucumber/step_definitions/cartridge-php_steps.rb +72 -0
  141. data/test/cucumber/step_definitions/cartridge-postgresql_steps.rb +59 -0
  142. data/test/cucumber/step_definitions/cartridge-switchyard_steps.rb +29 -0
  143. data/test/cucumber/step_definitions/client_steps.rb +12 -0
  144. data/test/cucumber/step_definitions/descriptor_step.rb +32 -0
  145. data/test/cucumber/step_definitions/idler_steps.rb +37 -0
  146. data/test/cucumber/step_definitions/node_steps.rb +203 -0
  147. data/test/cucumber/step_definitions/runtime_steps.rb +547 -0
  148. data/test/cucumber/step_definitions/runtime_url_steps.rb +46 -0
  149. data/test/cucumber/step_definitions/trap-user-extended_steps.rb +14 -0
  150. data/test/cucumber/step_definitions/trap-user_steps.rb +58 -0
  151. data/test/cucumber/support/00_setup_helper.rb +106 -0
  152. data/test/cucumber/support/app_helper.rb +243 -0
  153. data/test/cucumber/support/assertions.rb +52 -0
  154. data/test/cucumber/support/command_helper.rb +453 -0
  155. data/test/cucumber/support/dns_helper.rb +54 -0
  156. data/test/cucumber/support/env.rb +5 -0
  157. data/test/cucumber/support/process_helper.rb +44 -0
  158. data/test/cucumber/support/runtime_support.rb +440 -0
  159. data/test/cucumber/support/unused.rb +27 -0
  160. data/test/cucumber/support/user_helper.rb +37 -0
  161. data/test/cucumber/trap-user-extended.feature +53 -0
  162. data/test/cucumber/trap-user.feature +34 -0
  163. data/test/ddns/1.168.192-rev.db.init +13 -0
  164. data/test/ddns/HOWTO.txt +207 -0
  165. data/test/ddns/Kexample.com.+157+06142.key +1 -0
  166. data/test/ddns/Kexample.com.+157+06142.private +7 -0
  167. data/test/ddns/authconfig.rb +14 -0
  168. data/test/ddns/example.com.db.init +23 -0
  169. data/test/ddns/example.com.key +4 -0
  170. data/test/ddns/named.ca +52 -0
  171. data/test/ddns/named.conf +48 -0
  172. data/test/ddns/named.empty +10 -0
  173. data/test/ddns/named.localhost +10 -0
  174. data/test/ddns/named.loopback +11 -0
  175. data/test/ddns/named.rfc1912.zones +42 -0
  176. data/test/ddns/named.root.key +5 -0
  177. data/test/ddns/named_service.rb +127 -0
  178. data/test/unit/bind_dns_service_test.rb +167 -0
  179. data/test/unit/broker_auth_test.rb +28 -0
  180. metadata +545 -0
@@ -0,0 +1,27 @@
1
+ # Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved.
2
+ #
3
+ # http://www.natontesting.com
4
+ #
5
+ # Save this in a file called 'unused.rb' in your 'features/support' directory. Then, to list
6
+ # all the unused steps in your project, run the following command:
7
+ #
8
+ # cucumber -d -f Cucumber::Formatter::Unused
9
+ #
10
+ # or...
11
+ #
12
+ # cucumber -d -f Unused
13
+
14
+ require 'cucumber/formatter/stepdefs'
15
+
16
+ class Unused < Cucumber::Formatter::Stepdefs
17
+ def print_summary(features)
18
+ add_unused_stepdefs
19
+ keys = @stepdef_to_match.keys.sort {|a,b| a.regexp_source <=> b.regexp_source}
20
+ puts "The following steps are unused...\n---------"
21
+ keys.each do |stepdef_key|
22
+ if @stepdef_to_match[stepdef_key].none?
23
+ puts "#{stepdef_key.regexp_source}\n#{stepdef_key.file_colon_line}\n---"
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,37 @@
1
+ #require '/var/www/openshift/broker/config/environment'
2
+
3
+ module UserHelper
4
+ #
5
+ # Obtain a unique username from S3.
6
+ #
7
+ # reserved_usernames = A list of reserved names that may
8
+ # not be in the global store
9
+ #
10
+ def get_unique_username(reserved_usernames=[])
11
+ result={}
12
+
13
+ loop do
14
+ # Generate a random username
15
+ chars = ("1".."9").to_a
16
+ namespace = "unit" + Array.new(8, '').collect{chars[rand(chars.size)]}.join
17
+ login = "cucumber-test+#{namespace}@example.com"
18
+ #has_txt = !OpenShift::DnsService.instance.namespace_available?(namespace)
19
+ has_txt = namespace_available?(namespace)
20
+
21
+ unless has_txt or reserved_usernames.index(login)
22
+ result[:login] = login
23
+ result[:namespace] = namespace
24
+ break
25
+ end
26
+ end
27
+
28
+ return result
29
+ end
30
+
31
+ def register_user(login, password)
32
+ command = $user_register_script_format % [login, password]
33
+ run command
34
+ end
35
+
36
+ end
37
+ World(UserHelper)
@@ -0,0 +1,53 @@
1
+ @runtime_extended2
2
+ @runtime_extended3
3
+ Feature: Trap User Shell
4
+ Scenario Outline: Use ctl_all to start and stop a simple application
5
+ Given a new <type> type application
6
+ And the application is made publicly accessible
7
+
8
+ When I stop the application using ctl_all via rhcsh
9
+ Then a <proc_name> process will not be running
10
+
11
+ When I start the application using ctl_all via rhcsh
12
+ Then a <proc_name> process will be running
13
+
14
+ Scenarios:
15
+ | type | proc_name |
16
+ | jbossas-7 | java |
17
+ | jbosseap-6.0 | java |
18
+ | jbossews-1.0 | java |
19
+ | nodejs-0.6 | node |
20
+ | perl-5.10 | httpd |
21
+ | php-5.3 | httpd |
22
+ | python-2.6 | httpd |
23
+ | ruby-1.8 | httpd |
24
+ | ruby-1.9 | httpd |
25
+
26
+ Scenario Outline: Use ctl_all to start and stop an application with an embedded database
27
+ Given a new <type> type application
28
+ And I embed a <db_type> cartridge into the application
29
+ And I embed a <management_app> cartridge into the application
30
+ And the application is made publicly accessible
31
+
32
+ When I stop the application using ctl_all via rhcsh
33
+ Then a <proc_name> process for <type> will not be running
34
+ And a <db_proc_name> process will not be running
35
+ And a httpd process for <management_app> will not be running
36
+
37
+ When I start the application using ctl_all via rhcsh
38
+ Then a <proc_name> process for <type> will be running
39
+ And a <db_proc_name> process will be running
40
+ And a httpd process for <management_app> will be running
41
+
42
+ Scenarios:
43
+ | type | proc_name | db_type | db_proc_name | management_app |
44
+ | perl-5.10 | httpd | mongodb-2.2 | mongod | rockmongo-1.1 |
45
+ | perl-5.10 | httpd | mysql-5.1 | mysqld | phpmyadmin-3.4 |
46
+ | php-5.3 | httpd | mongodb-2.2 | mongod | rockmongo-1.1 |
47
+ | php-5.3 | httpd | mysql-5.1 | mysqld | phpmyadmin-3.4 |
48
+ | ruby-1.8 | httpd | mongodb-2.2 | mongod | rockmongo-1.1 |
49
+ | ruby-1.8 | httpd | mysql-5.1 | mysqld | phpmyadmin-3.4 |
50
+ | ruby-1.9 | httpd | mongodb-2.2 | mongod | rockmongo-1.1 |
51
+ | ruby-1.9 | httpd | mysql-5.1 | mysqld | phpmyadmin-3.4 |
52
+
53
+
@@ -0,0 +1,34 @@
1
+ @runtime
2
+ @runtime3
3
+ Feature: Trap User Shell
4
+
5
+ As a system designer
6
+ I should be able to limit user login to a defined set of commands
7
+ So that I can ensure the security of the system
8
+
9
+ Scenario: Running commands via rhcsh
10
+ Given a new php-5.3 type application
11
+ And the application is made publicly accessible
12
+
13
+ Then I can run "ls / > /dev/null" with exit code: 0
14
+ And I can run "this_should_fail" with exit code: 127
15
+ And I can run "true" with exit code: 0
16
+ And I can run "java -version" with exit code: 0
17
+ And I can run "scp" with exit code: 1
18
+
19
+ Scenario: Tail Logs
20
+ Given a new php-5.3 type application
21
+ And the application is made publicly accessible
22
+ Then a tail process will not be running
23
+
24
+ When I tail the logs via ssh
25
+ Then a tail process will be running
26
+
27
+ When I stop tailing the logs
28
+ Then a tail process will not be running
29
+
30
+ Scenario: Access Quota
31
+ Given a new php-5.3 type application
32
+ And the application is made publicly accessible
33
+ Then I can obtain disk quota information via SSH
34
+
@@ -0,0 +1,13 @@
1
+ $TTL 300 ; short for testing
2
+ $ORIGIN 1.168.192.IN-ADDR.ARPA.
3
+ @ 300 IN SOA ns1.example.com. hostmaster.example.com. (
4
+ 2011112902 ; serial
5
+ 300 ; refresh
6
+ 15 ; retry
7
+ 1800 ; expire
8
+ 10 ; minimum
9
+ )
10
+
11
+ IN NS ns1.example.com.
12
+
13
+ 1 IN PTR master.example.com.
@@ -0,0 +1,207 @@
1
+ This document describes how to create a small self-contained DNS service
2
+ suitable for testing dynamic DNS operations.
3
+
4
+ The idea is to run a local DNS server as a non-root user on a
5
+ non-standard port for testing purposes. This configuration will not
6
+ forward requests and will not interact with regular system DNS
7
+ lookups.
8
+
9
+ With a little modification this service can act as a local DNS service
10
+ for development as well. You would switch the port back to the
11
+ default (53), enable recursion, use the nameserver values in the
12
+ initial resolv.conf to set forwarders, and then replace the
13
+ resolv.conf with one which points to localhost.
14
+
15
+ ## Install required software
16
+ # Install BIND daemon and tools
17
+ sudo yum install bind
18
+
19
+ ## create a workspace for the daemon and control files
20
+ # Create a space to run the local service
21
+ mkdir ~/ddns
22
+
23
+ # Create a space for temporary files and logs
24
+ mkdir ~/ddns/tmp
25
+
26
+ # Copy the stock/default named configuration files
27
+ cd ~/ddns
28
+ sudo cp /etc/named.* .
29
+ sudo cp /var/named/named.{ca,empty,localhost,loopback} .
30
+ sudo chown `id -u`:`id -g` *
31
+
32
+ # comment IPv6 root servers (unless you have IPv6 configured)
33
+ perl -p -i -e '/AAAA/ && s/^/;;/' named.*
34
+
35
+ ## Enable secure updates
36
+ # generate update keys: may need enough randomness. Log in and type stuff
37
+ dnssec-keygen -a HMAC-MD5 -b 512 -n USER example.com
38
+
39
+ # extract the key value
40
+ perl -n -e '/Key: / && s/Key: // && print' Kexample.com.*.private
41
+
42
+ -- example.com.key --
43
+ key example.com {
44
+ algorithm HMAC-MD5;
45
+ secret "H6NDDnTbNpcBrUM5c4BJtohyK2uuZ5Oi6jxg3ME+RJsNl5Wl2B87oL12 YxWUR3Gp7FdZQojTKBSfs5ZjghYxGw==";
46
+ };
47
+ --
48
+
49
+ # Create the test configuration file
50
+ #
51
+ # This file is a limited configuration. It runs on a non-standard
52
+ # high-numbered port. It runs from a single directory and stores
53
+ # run-time files in a temporary directory so they can be cleaned up
54
+ # and repopulated easily
55
+
56
+ -- named.conf --
57
+ // named.conf
58
+
59
+ options {
60
+ // listen-on port 53 { 127.0.0.1; }; // low port requires root
61
+ listen-on port 10053 { 127.0.0.1; }; // avoid possible conflict
62
+ directory "."; // assume start from CWD
63
+ allow-query { localhost; };
64
+ recursion no;
65
+
66
+ pid-file "tmp/named.pid";
67
+ session-keyfile "tmp/named.session.key";
68
+ managed-keys-directory "tmp";
69
+
70
+ // uncomment and replace the marker with a nameserver IP address
71
+ // forward first ; forwarders { __NAMESERVER__ ; } ;
72
+ // then replace nameserver line in /etc/resolv.conf with 127.0.0.1
73
+ };
74
+
75
+ // disable remote controls
76
+ controls {};
77
+
78
+ logging {
79
+ channel default_debug {
80
+ file "tmp/named.log";
81
+ severity dynamic;
82
+ };
83
+ };
84
+
85
+ // define the root zone
86
+ zone "." IN {
87
+ type hint;
88
+ file "named.ca";
89
+ };
90
+
91
+ // define standard loopback zones
92
+ // uses: named.localhost, named.loopback, named.empty
93
+ include "named.rfc1912.zones";
94
+
95
+ //
96
+ // Local customization
97
+ //
98
+
99
+ // load the update key
100
+ include "example.com.key";
101
+
102
+ zone "example.com" IN {
103
+ type master;
104
+ file "tmp/example.com.db";
105
+ allow-update { key example.com ; };
106
+ };
107
+
108
+ zone "1.168.192.in-addr.arpa" {
109
+ type master;
110
+ file "tmp/1.168.192-rev.db";
111
+ allow-update { key example.com ; } ;
112
+ };
113
+ --
114
+
115
+ == Zone files ==
116
+
117
+ Create the template zone files in the main directory. You will copy them to
118
+ the tmp directory for test runs. Changes to the running service will
119
+ cause changes to the zone files.
120
+
121
+ --- example.com.db ---
122
+ ; initial data for testing DDNS using BIND
123
+ $ORIGIN .
124
+ $TTL 1 ; 1 seconds (for testing only)
125
+ example.com IN SOA ns1.example.com. hostmaster.example.com. (
126
+ 2011112904 ; serial
127
+ 60 ; refresh (1 minute)
128
+ 15 ; retry (15 seconds)
129
+ 1800 ; expire (30 minutes)
130
+ 10 ; minimum (10 seconds)
131
+ )
132
+ NS ns1.example.com.
133
+ MX 10 mail.example.com.
134
+ $ORIGIN example.com.
135
+ mail A 127.0.0.1
136
+ master A 192.168.1.1
137
+ ns1 A 127.0.0.1
138
+ node A 192.168.1.10
139
+
140
+ ; test records
141
+ testns1 TXT "reserved namespace testns1"
142
+ ;testns2 TXT "to be added by tests"
143
+ testns3 TXT "reserved to add apps"
144
+ testns4 TXT "reserved to delete apps"
145
+ testapp4-testns4 CNAME node.example.com.
146
+ ---
147
+
148
+ --- 1.168.192-rev.db.init ---
149
+ $TTL 1 ; short for testing
150
+ $ORIGIN 1.168.192.IN-ADDR.ARPA.
151
+ @ 1 IN SOA ns1.example.com. hostmaster.example.com. (
152
+ 2011112902 ; serial
153
+ 300 ; refresh
154
+ 15 ; retry
155
+ 1800 ; expire
156
+ 10 ; minimum
157
+ )
158
+
159
+ IN NS ns1.example.com.
160
+
161
+ 1 IN PTR master.example.com.
162
+ ---
163
+
164
+ == testing ==
165
+
166
+ # Go to the ddns working directory:
167
+
168
+ cd ~/ddns
169
+
170
+ # Clear the tmp directory:
171
+ rm -f tmp/*
172
+
173
+ # copy the initial zone files
174
+ for FILE in *.init ; do cp $FILE tmp/`basename $FILE .init` ; done
175
+
176
+ # start the named: log to stdout, no fork
177
+ /usr/sbin/named -c named.conf -g
178
+
179
+ # add an A record and try to retrieve it
180
+ nsupdate -y HMAC-MD5:example.com:`perl -n -e '/secret "([^"]+)"/ && print $1;' example.com.key` <<EOF
181
+ server localhost 10053
182
+ update add foo.example.com 1 A 192.168.1.2
183
+ send
184
+ EOF
185
+
186
+ # check the logs for the entry record
187
+ grep foo tmp/named.log
188
+
189
+ # check that the named returns the new record
190
+ dig -p 10053 @localhost foo.example.com
191
+
192
+ # stop the named
193
+ kill `cat tmp/named.pid`
194
+
195
+
196
+ == References ==
197
+
198
+ http://linux.yyz.us/dns/ - sample DDNS setup
199
+
200
+ == See Also ==
201
+
202
+ named(8)
203
+ named.conf(5)
204
+ nsupdate(1)
205
+ dig(1)
206
+ host(1)
207
+
@@ -0,0 +1 @@
1
+ example.com. IN KEY 0 3 157 H6NDDnTbNpcBrUM5c4BJtohyK2uuZ5Oi6jxg3ME+RJsNl5Wl2B87oL12 YxWUR3Gp7FdZQojTKBSfs5ZjghYxGw==
@@ -0,0 +1,7 @@
1
+ Private-key-format: v1.3
2
+ Algorithm: 157 (HMAC_MD5)
3
+ Key: H6NDDnTbNpcBrUM5c4BJtohyK2uuZ5Oi6jxg3ME+RJsNl5Wl2B87oL12YxWUR3Gp7FdZQojTKBSfs5ZjghYxGw==
4
+ Bits: AAA=
5
+ Created: 20120208182548
6
+ Publish: 20120208182548
7
+ Activate: 20120208182548
@@ -0,0 +1,14 @@
1
+
2
+ $config = {
3
+ :dns => {
4
+ :server => '127.0.0.1',
5
+ :port => '10053',
6
+ :keyname => 'example.com',
7
+ :keyvalue => 'H6NDDnTbNpcBrUM5c4BJtohyK2uuZ5Oi6jxg3ME+RJsNl5Wl2B87oL12YxWUR3Gp7FdZQojTKBSfs5ZjghYxGw==',
8
+ :zone => "example.com"
9
+ },
10
+
11
+ :ss => {
12
+ :domain_suffix => "example.com"
13
+ }
14
+ }
@@ -0,0 +1,23 @@
1
+ $ORIGIN .
2
+ $TTL 1 ; 1 seconds (for testing only)
3
+ example.com IN SOA ns1.example.com. hostmaster.example.com. (
4
+ 2011112904 ; serial
5
+ 60 ; refresh (1 minute)
6
+ 15 ; retry (15 seconds)
7
+ 1800 ; expire (30 minutes)
8
+ 10 ; minimum (10 seconds)
9
+ )
10
+ NS ns1.example.com.
11
+ MX 10 mail.example.com.
12
+ $ORIGIN example.com.
13
+ mail A 127.0.0.1
14
+ master A 192.168.1.1
15
+ ns1 A 127.0.0.1
16
+ node A 192.168.1.10
17
+
18
+ ; test records
19
+ testns1 TXT "reserved namespace testns1"
20
+ ;testns2 TXT "to be added by tests"
21
+ testns3 TXT "reserved to add apps"
22
+ testns4 TXT "reserved to delete apps"
23
+ testapp4-testns4 CNAME node.example.com.
@@ -0,0 +1,4 @@
1
+ key example.com {
2
+ algorithm HMAC-MD5;
3
+ secret "H6NDDnTbNpcBrUM5c4BJtohyK2uuZ5Oi6jxg3ME+RJsNl5Wl2B87oL12YxWUR3Gp7FdZQojTKBSfs5ZjghYxGw==";
4
+ };
@@ -0,0 +1,52 @@
1
+ ; <<>> DiG 9.5.0b2 <<>> +bufsize=1200 +norec NS . @a.root-servers.net
2
+ ;; global options: printcmd
3
+ ;; Got answer:
4
+ ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34420
5
+ ;; flags: qr aa; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 20
6
+
7
+ ;; OPT PSEUDOSECTION:
8
+ ; EDNS: version: 0, flags:; udp: 4096
9
+ ;; QUESTION SECTION:
10
+ ;. IN NS
11
+
12
+ ;; ANSWER SECTION:
13
+ . 518400 IN NS M.ROOT-SERVERS.NET.
14
+ . 518400 IN NS A.ROOT-SERVERS.NET.
15
+ . 518400 IN NS B.ROOT-SERVERS.NET.
16
+ . 518400 IN NS C.ROOT-SERVERS.NET.
17
+ . 518400 IN NS D.ROOT-SERVERS.NET.
18
+ . 518400 IN NS E.ROOT-SERVERS.NET.
19
+ . 518400 IN NS F.ROOT-SERVERS.NET.
20
+ . 518400 IN NS G.ROOT-SERVERS.NET.
21
+ . 518400 IN NS H.ROOT-SERVERS.NET.
22
+ . 518400 IN NS I.ROOT-SERVERS.NET.
23
+ . 518400 IN NS J.ROOT-SERVERS.NET.
24
+ . 518400 IN NS K.ROOT-SERVERS.NET.
25
+ . 518400 IN NS L.ROOT-SERVERS.NET.
26
+
27
+ ;; ADDITIONAL SECTION:
28
+ A.ROOT-SERVERS.NET. 3600000 IN A 198.41.0.4
29
+ ;;A.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:503:ba3e::2:30
30
+ B.ROOT-SERVERS.NET. 3600000 IN A 192.228.79.201
31
+ C.ROOT-SERVERS.NET. 3600000 IN A 192.33.4.12
32
+ D.ROOT-SERVERS.NET. 3600000 IN A 128.8.10.90
33
+ E.ROOT-SERVERS.NET. 3600000 IN A 192.203.230.10
34
+ F.ROOT-SERVERS.NET. 3600000 IN A 192.5.5.241
35
+ ;;F.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:2f::f
36
+ G.ROOT-SERVERS.NET. 3600000 IN A 192.112.36.4
37
+ H.ROOT-SERVERS.NET. 3600000 IN A 128.63.2.53
38
+ ;;H.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:1::803f:235
39
+ I.ROOT-SERVERS.NET. 3600000 IN A 192.36.148.17
40
+ J.ROOT-SERVERS.NET. 3600000 IN A 192.58.128.30
41
+ ;;J.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:503:c27::2:30
42
+ K.ROOT-SERVERS.NET. 3600000 IN A 193.0.14.129
43
+ ;;K.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:7fd::1
44
+ L.ROOT-SERVERS.NET. 3600000 IN A 199.7.83.42
45
+ M.ROOT-SERVERS.NET. 3600000 IN A 202.12.27.33
46
+ ;;M.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:dc3::35
47
+
48
+ ;; Query time: 147 msec
49
+ ;; SERVER: 198.41.0.4#53(198.41.0.4)
50
+ ;; WHEN: Mon Feb 18 13:29:18 2008
51
+ ;; MSG SIZE rcvd: 615
52
+