IOWA 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTORS +14 -0
- data/README.md +23 -0
- data/RELEASE_NOTES +77 -0
- data/ToDo +21 -0
- data/components/CRUDList/CRUDList.html +13 -0
- data/components/CRUDList/CRUDList.iwa +136 -0
- data/components/Content/Content.html +0 -0
- data/components/Content/Content.iwa +143 -0
- data/components/Content/example/README +9 -0
- data/components/Content/example/cgi/iowa.cgi +10 -0
- data/components/Content/example/demo.rb +30 -0
- data/components/Content/example/doc/index.html +7 -0
- data/components/Content/example/iowa/Content.html +1 -0
- data/components/Content/example/iowa/Content.iwa +1 -0
- data/components/Content/example/iowa/Main.html +6 -0
- data/components/Content/example/iowa/Main.iwa +3 -0
- data/components/Content/example/iowa/_content/body +7 -0
- data/components/Content/example/iowa/_content/body2 +3 -0
- data/components/Content/example/iowa/_content/title +2 -0
- data/components/Content/example/iowa/app.cnf +8 -0
- data/components/Content/example/iowa/app.rb +8 -0
- data/components/Content/example/webrick.rb +38 -0
- data/components/Include/Include.html +1 -0
- data/components/Include/Include.iwa +30 -0
- data/components/Include/readme +5 -0
- data/components/JumpTo/JumpTo.html +8 -0
- data/components/JumpTo/JumpTo.iwa +8 -0
- data/components/JumpTo/readme +6 -0
- data/doc/Architecture.txt +6 -0
- data/doc/History.txt +33 -0
- data/doc/StandardDispatcher.txt +19 -0
- data/examples/blog/README +1 -0
- data/examples/hello_world/README +17 -0
- data/examples/hello_world/htdocs/hello_world_html.html +24 -0
- data/examples/hello_world/htdocs/hello_world_ruby.html +41 -0
- data/examples/hello_world/iowa/HelloWorld.html +14 -0
- data/examples/hello_world/iowa/HelloWorld.iwa +31 -0
- data/examples/hello_world/iowa/Index.html +16 -0
- data/examples/hello_world/iowa/Index.iwa +5 -0
- data/examples/hello_world/iowa/iowa_hello_world.cnf +19 -0
- data/examples/hello_world/iowa/iowa_hello_world.rb +5 -0
- data/examples/hello_world/iowa/mapfile.cnf +6 -0
- data/examples/hw1/iowa/Main.html +1 -0
- data/examples/hw1/iowa/README +9 -0
- data/examples/hw1/iowa/hw.rb +4 -0
- data/examples/hw2/iowa/Main.html +10 -0
- data/examples/hw2/iowa/Main.iwa +7 -0
- data/examples/hw2/iowa/README +16 -0
- data/examples/hw2/iowa/hw.rb +4 -0
- data/examples/hw3/iowa/Main.html +11 -0
- data/examples/hw3/iowa/Main.iwa +7 -0
- data/examples/hw3/iowa/README +22 -0
- data/examples/hw3/iowa/hw.rb +4 -0
- data/examples/hw4/iowa/Greetings.html +10 -0
- data/examples/hw4/iowa/Greetings.iwa +9 -0
- data/examples/hw4/iowa/Main.html +12 -0
- data/examples/hw4/iowa/Main.iwa +10 -0
- data/examples/hw4/iowa/README +28 -0
- data/examples/hw4/iowa/hw.rb +4 -0
- data/examples/hw5/iowa/Footer.html +2 -0
- data/examples/hw5/iowa/Greetings.html +4 -0
- data/examples/hw5/iowa/Greetings.iwa +12 -0
- data/examples/hw5/iowa/Header.html +6 -0
- data/examples/hw5/iowa/Main.html +12 -0
- data/examples/hw5/iowa/Main.iwa +13 -0
- data/examples/hw5/iowa/README +16 -0
- data/examples/hw5/iowa/hw.rb +4 -0
- data/examples/template_server/iowa/Content.iwa +121 -0
- data/examples/template_server/iowa/Content.view +0 -0
- data/examples/template_server/iowa/DBContentDispatcher.rb +112 -0
- data/examples/template_server/iowa/DBContentPage.html +3 -0
- data/examples/template_server/iowa/DBContentPage.iwa +85 -0
- data/examples/template_server/iowa/app.cnf +13 -0
- data/examples/template_server/iowa/app.rb +5 -0
- data/ext/Classifier/classifier.c +256 -0
- data/ext/Classifier/ext_help.h +14 -0
- data/ext/Classifier/extconf.rb +5 -0
- data/ext/Classifier/tst.h +40 -0
- data/ext/Classifier/tst_cleanup.c +24 -0
- data/ext/Classifier/tst_delete.c +146 -0
- data/ext/Classifier/tst_grow_node_free_list.c +38 -0
- data/ext/Classifier/tst_init.c +41 -0
- data/ext/Classifier/tst_insert.c +192 -0
- data/ext/Classifier/tst_search.c +68 -0
- data/ext/http11/README +11 -0
- data/ext/http11/ext_help.h +15 -0
- data/ext/http11/extconf.rb +5 -0
- data/ext/http11/http11.c +534 -0
- data/ext/http11/http11.c.dif +422 -0
- data/ext/http11/http11_parser.c +1243 -0
- data/ext/http11/http11_parser.c.dif +193 -0
- data/ext/http11/http11_parser.h +49 -0
- data/ext/http11/http11_parser.h.dif +20 -0
- data/ext/http11/http11_parser.rl +192 -0
- data/ext/httpmachine/Makefile +149 -0
- data/ext/httpmachine/extconf.rb +33 -0
- data/ext/httpmachine/http.cpp +430 -0
- data/ext/httpmachine/http.h +156 -0
- data/ext/httpmachine/rubyhttp.cpp +165 -0
- data/external/mime-types/LICENCE +18 -0
- data/external/mime-types/README +46 -0
- data/external/mime-types/doc/classes/MIME.html +120 -0
- data/external/mime-types/doc/classes/MIME/InvalidContentType.html +119 -0
- data/external/mime-types/doc/classes/MIME/Type.html +866 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000010.html +22 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000011.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000012.html +19 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000013.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000014.html +26 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000015.html +33 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000016.html +27 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000017.html +35 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000018.html +34 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000019.html +24 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000020.html +38 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000021.html +22 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000022.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000023.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000024.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000025.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000026.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000027.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000028.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000029.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000030.html +19 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000031.html +26 -0
- data/external/mime-types/doc/classes/MIME/Types.html +459 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000001.html +19 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000002.html +32 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000003.html +21 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000004.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000005.html +26 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000006.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000007.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000008.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000009.html +18 -0
- data/external/mime-types/doc/created.rid +1 -0
- data/external/mime-types/doc/files/ChangeLog.html +320 -0
- data/external/mime-types/doc/files/README.html +145 -0
- data/external/mime-types/doc/files/lib/mime/types_rb.html +101 -0
- data/external/mime-types/doc/fr_class_index.html +30 -0
- data/external/mime-types/doc/fr_file_index.html +29 -0
- data/external/mime-types/doc/fr_method_index.html +57 -0
- data/external/mime-types/doc/index.html +24 -0
- data/external/mime-types/doc/rdoc-style.css +208 -0
- data/external/mime-types/lib/mime/types.rb +1558 -0
- data/external/package.rb +672 -0
- data/external/test_support.rb +95 -0
- data/external/tmail/README +7 -0
- data/external/tmail/tmail.rb +4 -0
- data/external/tmail/tmail/address.rb +222 -0
- data/external/tmail/tmail/base64.rb +52 -0
- data/external/tmail/tmail/compat.rb +39 -0
- data/external/tmail/tmail/config.rb +50 -0
- data/external/tmail/tmail/encode.rb +447 -0
- data/external/tmail/tmail/header.rb +895 -0
- data/external/tmail/tmail/info.rb +14 -0
- data/external/tmail/tmail/loader.rb +1 -0
- data/external/tmail/tmail/mail.rb +869 -0
- data/external/tmail/tmail/mailbox.rb +386 -0
- data/external/tmail/tmail/mbox.rb +1 -0
- data/external/tmail/tmail/net.rb +260 -0
- data/external/tmail/tmail/obsolete.rb +123 -0
- data/external/tmail/tmail/parser.rb +1475 -0
- data/external/tmail/tmail/parser.y +372 -0
- data/external/tmail/tmail/port.rb +356 -0
- data/external/tmail/tmail/scanner.rb +17 -0
- data/external/tmail/tmail/scanner_r.rb +243 -0
- data/external/tmail/tmail/stringio.rb +256 -0
- data/external/tmail/tmail/textutils.rb +197 -0
- data/external/tmail/tmail/tmail.rb +1 -0
- data/external/tmail/tmail/utils.rb +23 -0
- data/external/win32-process/README +133 -0
- data/external/win32-process/lib/win32/process.rb +561 -0
- data/external/windows-pr/README +145 -0
- data/external/windows-pr/doc/conversion_guide.txt +25 -0
- data/external/windows-pr/lib/windows/clipboard.rb +72 -0
- data/external/windows-pr/lib/windows/console.rb +323 -0
- data/external/windows-pr/lib/windows/device_io.rb +88 -0
- data/external/windows-pr/lib/windows/directory.rb +80 -0
- data/external/windows-pr/lib/windows/error.rb +313 -0
- data/external/windows-pr/lib/windows/eventlog.rb +120 -0
- data/external/windows-pr/lib/windows/file.rb +349 -0
- data/external/windows-pr/lib/windows/filesystem.rb +16 -0
- data/external/windows-pr/lib/windows/handle.rb +31 -0
- data/external/windows-pr/lib/windows/library.rb +76 -0
- data/external/windows-pr/lib/windows/limits.rb +13 -0
- data/external/windows-pr/lib/windows/memory.rb +117 -0
- data/external/windows-pr/lib/windows/msvcrt/buffer.rb +48 -0
- data/external/windows-pr/lib/windows/msvcrt/file.rb +18 -0
- data/external/windows-pr/lib/windows/msvcrt/string.rb +46 -0
- data/external/windows-pr/lib/windows/national.rb +557 -0
- data/external/windows-pr/lib/windows/path.rb +296 -0
- data/external/windows-pr/lib/windows/pipe.rb +77 -0
- data/external/windows-pr/lib/windows/process.rb +171 -0
- data/external/windows-pr/lib/windows/registry.rb +238 -0
- data/external/windows-pr/lib/windows/security.rb +89 -0
- data/external/windows-pr/lib/windows/service.rb +183 -0
- data/external/windows-pr/lib/windows/shell.rb +88 -0
- data/external/windows-pr/lib/windows/sound.rb +52 -0
- data/external/windows-pr/lib/windows/synchronize.rb +161 -0
- data/external/windows-pr/lib/windows/system_info.rb +70 -0
- data/external/windows-pr/lib/windows/unicode.rb +138 -0
- data/external/windows-pr/lib/windows/window.rb +22 -0
- data/iowa.gemspec +45 -0
- data/microprojects/DiskCache/LICENSE +28 -0
- data/microprojects/DiskCache/README +17 -0
- data/microprojects/DiskCache/external/package.rb +608 -0
- data/microprojects/DiskCache/external/test_support.rb +8 -0
- data/microprojects/DiskCache/setup.rb +22 -0
- data/microprojects/DiskCache/src/iowa/Association.rb +67 -0
- data/microprojects/DiskCache/src/iowa/Constants.rb +159 -0
- data/microprojects/DiskCache/src/iowa/DiskStore.rb +377 -0
- data/microprojects/DiskCache/src/iowa/Hash.rb +63 -0
- data/microprojects/DiskCache/src/iowa/Lockfile.rb +575 -0
- data/microprojects/DiskCache/src/iowa/Mutex.rb +142 -0
- data/microprojects/DiskCache/src/iowa/caches/DiskCache.rb +605 -0
- data/microprojects/DiskCache/src/iowa/caches/LRUCache.rb +287 -0
- data/microprojects/DiskCache/test/TC_DiskCache.rb +218 -0
- data/microprojects/LRUCache/LICENSE +28 -0
- data/microprojects/LRUCache/README +13 -0
- data/microprojects/LRUCache/external/package.rb +608 -0
- data/microprojects/LRUCache/external/test_support.rb +8 -0
- data/microprojects/LRUCache/setup.rb +22 -0
- data/microprojects/LRUCache/src/iowa/Association.rb +57 -0
- data/microprojects/LRUCache/src/iowa/Constants.rb +159 -0
- data/microprojects/LRUCache/src/iowa/Hash.rb +63 -0
- data/microprojects/LRUCache/src/iowa/Mutex.rb +129 -0
- data/microprojects/LRUCache/src/iowa/caches/LRUCache.rb +287 -0
- data/microprojects/LRUCache/test/TC_LRUCache.rb +65 -0
- data/microprojects/LinkedList/LICENSE +28 -0
- data/microprojects/LinkedList/README +13 -0
- data/microprojects/LinkedList/external/package.rb +608 -0
- data/microprojects/LinkedList/external/test_support.rb +8 -0
- data/microprojects/LinkedList/setup.rb +22 -0
- data/microprojects/LinkedList/src/iowa/LinkedList.rb +165 -0
- data/microprojects/LinkedList/test/TC_LinkedList.rb +42 -0
- data/microprojects/README +8 -0
- data/setup.rb +116 -0
- data/share/iowa/app_skeleton/Main.html +8 -0
- data/share/iowa/app_skeleton/Main.iwa +15 -0
- data/share/iowa/app_skeleton/app.cnf +48 -0
- data/share/iowa/app_skeleton/app.rb +58 -0
- data/share/iowa/app_skeleton/models/model.rb +49 -0
- data/src/ihc.rb +223 -0
- data/src/iowa.cgi +29 -0
- data/src/iowa.rb +637 -0
- data/src/iowa/AbstractCache.rb +96 -0
- data/src/iowa/AcceptLanguage.rb +76 -0
- data/src/iowa/Application.rb +928 -0
- data/src/iowa/ApplicationStats.rb +72 -0
- data/src/iowa/Association.rb +67 -0
- data/src/iowa/BindingsParser.rb +62 -0
- data/src/iowa/Breakpoint.rb +273 -0
- data/src/iowa/CSS.rb +564 -0
- data/src/iowa/Client.rb +192 -0
- data/src/iowa/Component.rb +405 -0
- data/src/iowa/ComponentProxy.rb +26 -0
- data/src/iowa/Config.rb +21 -0
- data/src/iowa/Constants.rb +226 -0
- data/src/iowa/Context.rb +218 -0
- data/src/iowa/ContextLogger.rb +16 -0
- data/src/iowa/DbPool.rb +222 -0
- data/src/iowa/DetachedComponent.rb +18 -0
- data/src/iowa/Dispatcher.rb +27 -0
- data/src/iowa/DynamicElements.rb +471 -0
- data/src/iowa/Element.rb +100 -0
- data/src/iowa/Email.rb +287 -0
- data/src/iowa/Extensions/AllExtensions.rb +4 -0
- data/src/iowa/Extensions/Class.rb +94 -0
- data/src/iowa/Extensions/Date.rb +88 -0
- data/src/iowa/Extensions/DateTime.rb +88 -0
- data/src/iowa/Extensions/Hash.rb +22 -0
- data/src/iowa/Extensions/Kernel.rb +6 -0
- data/src/iowa/Extensions/Numeric.rb +47 -0
- data/src/iowa/Extensions/Object.rb +11 -0
- data/src/iowa/Extensions/String.rb +60 -0
- data/src/iowa/Extensions/Time.rb +89 -0
- data/src/iowa/Extensions/TimeExtensions.rb +6 -0
- data/src/iowa/Form.rb +368 -0
- data/src/iowa/Hash.rb +85 -0
- data/src/iowa/ISAAC.rb +175 -0
- data/src/iowa/ImageSize.rb +279 -0
- data/src/iowa/IowaComponentMixins.rb +7 -0
- data/src/iowa/JSON-lexer.rb +296 -0
- data/src/iowa/JSON-objects.rb +201 -0
- data/src/iowa/KeyValueCoding.rb +91 -0
- data/src/iowa/LinkedList.rb +175 -0
- data/src/iowa/Loader.rb +22 -0
- data/src/iowa/Lockfile.rb +575 -0
- data/src/iowa/Logger.rb +74 -0
- data/src/iowa/Monkey.rb +20 -0
- data/src/iowa/Mutex.rb +142 -0
- data/src/iowa/Policy.rb +70 -0
- data/src/iowa/Pool.rb +243 -0
- data/src/iowa/PrettyException.rb +1091 -0
- data/src/iowa/Request.rb +244 -0
- data/src/iowa/Response.rb +133 -0
- data/src/iowa/Session.rb +354 -0
- data/src/iowa/SessionStats.rb +78 -0
- data/src/iowa/String.rb +65 -0
- data/src/iowa/Tag.rb +101 -0
- data/src/iowa/TemplateParser.rb +236 -0
- data/src/iowa/Util.rb +314 -0
- data/src/iowa/Webcache.rb +122 -0
- data/src/iowa/caches/BiLevelCache.rb +65 -0
- data/src/iowa/caches/ClassLimitedCache.rb +67 -0
- data/src/iowa/caches/DiskCache.rb +609 -0
- data/src/iowa/caches/DiskStore.rb +380 -0
- data/src/iowa/caches/LRUCache-alternative.rb +155 -0
- data/src/iowa/caches/LRUCache.rb +290 -0
- data/src/iowa/caches/SimpleLRUCache.rb +112 -0
- data/src/iowa/dispatchers/StandardDispatcher.rb +396 -0
- data/src/iowa/dispatchers/StandardDispatcherWithClassifier.rb +93 -0
- data/src/iowa/js/iowa_jsonrpc.js +381 -0
- data/src/iowa/js/jsonrpc.js +187 -0
- data/src/iowa/js/jsonrpc_async.js +261 -0
- data/src/iowa/loaders/DiskLoader.rb +50 -0
- data/src/iowa/loggers/Analogger.rb +54 -0
- data/src/iowa/loggers/AsyncLogger.rb +54 -0
- data/src/iowa/loggers/BitBucket.rb +38 -0
- data/src/iowa/loggers/Log4R.rb +13 -0
- data/src/iowa/loggers/Log4rLogger.rb +48 -0
- data/src/iowa/loggers/Logger.rb +29 -0
- data/src/iowa/loggers/RubyLogger.rb +9 -0
- data/src/iowa/pools/DBConnectionPool.rb +53 -0
- data/src/iowa/request/Apache.rb +90 -0
- data/src/iowa/request/EMHybrid.rb +59 -0
- data/src/iowa/request/ENV.rb +80 -0
- data/src/iowa/request/FCGI.rb +68 -0
- data/src/iowa/request/HTTPMachine.rb +75 -0
- data/src/iowa/request/Mongrel.rb +68 -0
- data/src/iowa/request/WEBrick.rb +48 -0
- data/src/iowa/version.rb +3 -0
- data/src/iowa/webrick/HTTPServer.rb +43 -0
- data/src/iowa/webrick/WEBrickServlet.rb +28 -0
- data/src/iowa_fcgi_handler.rb +101 -0
- data/src/iowa_httpmachine.rb +141 -0
- data/src/iowa_hybrid.rb +193 -0
- data/src/iowa_hybrid_cluster.rb +231 -0
- data/src/iowa_mongrel.rb +136 -0
- data/src/iowa_webrick.rb +194 -0
- data/src/iowa_webrick_legacy.rb +104 -0
- data/src/mod_iowa.rb +104 -0
- data/tcss.rb +61 -0
- data/test/README.windows +12 -0
- data/test/TC_AcceptLanguage.rb +61 -0
- data/test/TC_AppConfig.rb +43 -0
- data/test/TC_AppConfig/cgi/iowa.cgi +7 -0
- data/test/TC_AppConfig/doc/index.html +1 -0
- data/test/TC_AppConfig/iowa/Main.html +4 -0
- data/test/TC_AppConfig/iowa/Main.iwa +17 -0
- data/test/TC_AppConfig/iowa/README +1 -0
- data/test/TC_AppConfig/iowa/app.cnf +19 -0
- data/test/TC_AppConfig/iowa/app.rb +8 -0
- data/test/TC_AppConfig/webrick.rb +38 -0
- data/test/TC_Association.rb +29 -0
- data/test/TC_BiLevelCache.rb +71 -0
- data/test/TC_CGI_Adaptor.rb +55 -0
- data/test/TC_CGI_Adaptor/cgi/iowa.cgi +7 -0
- data/test/TC_CGI_Adaptor/doc/index.html +1 -0
- data/test/TC_CGI_Adaptor/iowa/Main.html +8 -0
- data/test/TC_CGI_Adaptor/iowa/Main.iwa +14 -0
- data/test/TC_CGI_Adaptor/iowa/README +1 -0
- data/test/TC_CGI_Adaptor/iowa/app.cnf +8 -0
- data/test/TC_CGI_Adaptor/iowa/app.rb +8 -0
- data/test/TC_CGI_Adaptor/webrick.rb +38 -0
- data/test/TC_CSS.rb +660 -0
- data/test/TC_ClassLimitedCache.rb +89 -0
- data/test/TC_Classifier.rb +80 -0
- data/test/TC_DbPool.rb +127 -0
- data/test/TC_DiskCache.rb +218 -0
- data/test/TC_Hybrid.rb +58 -0
- data/test/TC_Hybrid/doc/thing.txt +1 -0
- data/test/TC_Hybrid/iowa/Main.html +3 -0
- data/test/TC_Hybrid/iowa/Main.iwa +7 -0
- data/test/TC_Hybrid/iowa/NewPage.html +1 -0
- data/test/TC_Hybrid/iowa/NewPage.iwa +5 -0
- data/test/TC_Hybrid/iowa/app.cnf +10 -0
- data/test/TC_Hybrid/iowa/app.rb +5 -0
- data/test/TC_IOWAFunctions/doc/Ajax1.html +1 -0
- data/test/TC_IOWAFunctions/doc/Ajax1.iwa +1 -0
- data/test/TC_IOWAFunctions/doc/index.html +1 -0
- data/test/TC_IOWAFunctions/doc/js/dojo.js +9686 -0
- data/test/TC_IOWAFunctions/iowa/Ajax1.html +40 -0
- data/test/TC_IOWAFunctions/iowa/Ajax1.iwa +23 -0
- data/test/TC_IOWAFunctions/iowa/AjaxWidget.iwa +19 -0
- data/test/TC_IOWAFunctions/iowa/AjaxWidget.view +22 -0
- data/test/TC_IOWAFunctions/iowa/DanielTest.html +9 -0
- data/test/TC_IOWAFunctions/iowa/DanielTest.iwa +10 -0
- data/test/TC_IOWAFunctions/iowa/IntervalWidget.html +1 -0
- data/test/TC_IOWAFunctions/iowa/IntervalWidget.iwa +14 -0
- data/test/TC_IOWAFunctions/iowa/Main.html +1 -0
- data/test/TC_IOWAFunctions/iowa/NestedRepeat1.html +12 -0
- data/test/TC_IOWAFunctions/iowa/NestedRepeat1.iwa +24 -0
- data/test/TC_IOWAFunctions/iowa/RPCResponse.iwa +7 -0
- data/test/TC_IOWAFunctions/iowa/RPCResponse.view +1 -0
- data/test/TC_IOWAFunctions/iowa/Repeat1.iwa +31 -0
- data/test/TC_IOWAFunctions/iowa/Repeat1.view +9 -0
- data/test/TC_IOWAFunctions/iowa/Repeat2.iwa +32 -0
- data/test/TC_IOWAFunctions/iowa/Repeat2.view +11 -0
- data/test/TC_IOWAFunctions/iowa/Repeat3.iwa +44 -0
- data/test/TC_IOWAFunctions/iowa/Repeat3.view +18 -0
- data/test/TC_IOWAFunctions/iowa/TesCon.html +1 -0
- data/test/TC_IOWAFunctions/iowa/TesCon.iwa +5 -0
- data/test/TC_IOWAFunctions/iowa/app.cnf +19 -0
- data/test/TC_IOWAFunctions/iowa/app.rb +9 -0
- data/test/TC_IOWAFunctions/iowa/mapfile.cnf +8 -0
- data/test/TC_ISAAC.rb +52 -0
- data/test/TC_ImageSize.rb +84 -0
- data/test/TC_ImageSize/img.bmp +0 -0
- data/test/TC_ImageSize/img.gif +0 -0
- data/test/TC_ImageSize/img.jpg +0 -0
- data/test/TC_ImageSize/img.pcx +0 -0
- data/test/TC_ImageSize/img.pgm +7144 -0
- data/test/TC_ImageSize/img.png +0 -0
- data/test/TC_ImageSize/img.ppm +0 -0
- data/test/TC_ImageSize/img.psd +0 -0
- data/test/TC_ImageSize/img.tiff +0 -0
- data/test/TC_ImageSize/img.xbm +22 -0
- data/test/TC_KeyValueCoding.rb +35 -0
- data/test/TC_LRUCache.rb +296 -0
- data/test/TC_LinkedList.rb +46 -0
- data/test/TC_Lockfile.rb +106 -0
- data/test/TC_Minimal.rb +45 -0
- data/test/TC_Minimal/app.cnf +8 -0
- data/test/TC_Minimal/cgi-bin/iowa.cgi +11 -0
- data/test/TC_Minimal/doc/index.html +1 -0
- data/test/TC_Minimal/iowa/Main.html +1 -0
- data/test/TC_Minimal/iowa/README +1 -0
- data/test/TC_Minimal/iowa/app.rb +3 -0
- data/test/TC_Minimal/webrick.rb +38 -0
- data/test/TC_Mongrel.rb +58 -0
- data/test/TC_Mongrel/doc/thing.txt +1 -0
- data/test/TC_Mongrel/iowa/Main.html +3 -0
- data/test/TC_Mongrel/iowa/Main.iwa +7 -0
- data/test/TC_Mongrel/iowa/NewPage.html +1 -0
- data/test/TC_Mongrel/iowa/NewPage.iwa +5 -0
- data/test/TC_Mongrel/iowa/app.cnf +10 -0
- data/test/TC_Mongrel/iowa/app.rb +5 -0
- data/test/TC_NoSubclass.rb +56 -0
- data/test/TC_NoSubclass/cgi/iowa.cgi +7 -0
- data/test/TC_NoSubclass/doc/index.html +1 -0
- data/test/TC_NoSubclass/iowa/Main.html +8 -0
- data/test/TC_NoSubclass/iowa/Main.iwa +14 -0
- data/test/TC_NoSubclass/iowa/README +1 -0
- data/test/TC_NoSubclass/iowa/app.cnf +8 -0
- data/test/TC_NoSubclass/iowa/app.rb +5 -0
- data/test/TC_NoSubclass/webrick.rb +38 -0
- data/test/TC_Pool.rb +139 -0
- data/test/TC_RenderedCache/doc/thing.txt +1 -0
- data/test/TC_RenderedCache/iowa/BigPage.html +1 -0
- data/test/TC_RenderedCache/iowa/BigPage.iwa +12 -0
- data/test/TC_RenderedCache/iowa/Main.html +3 -0
- data/test/TC_RenderedCache/iowa/Main.iwa +7 -0
- data/test/TC_RenderedCache/iowa/NewPage.html +1 -0
- data/test/TC_RenderedCache/iowa/NewPage.iwa +11 -0
- data/test/TC_RenderedCache/iowa/app.cnf +13 -0
- data/test/TC_RenderedCache/iowa/app.rb +5 -0
- data/test/TC_RenderedCache/iowa/mapfile.map +4 -0
- data/test/TC_ResourceURL.rb +73 -0
- data/test/TC_ResourceURL/iowa/Main.html +2 -0
- data/test/TC_ResourceURL/iowa/Main.iwa +10 -0
- data/test/TC_ResourceURL/iowa/app.cnf +10 -0
- data/test/TC_ResourceURL/iowa/app.rb +5 -0
- data/test/TC_SimpleDetached.rb +41 -0
- data/test/TC_StandardDispatcher.rb +362 -0
- data/test/TC_StandardDispatcherWithClassifier.rb +358 -0
- data/test/TC_String.rb +24 -0
- data/test/TC_Tag.rb +41 -0
- data/test/TC_Webrick.rb +56 -0
- data/test/TC_Webrick/doc/thing.txt +1 -0
- data/test/TC_Webrick/iowa/Main.html +3 -0
- data/test/TC_Webrick/iowa/Main.iwa +7 -0
- data/test/TC_Webrick/iowa/NewPage.html +1 -0
- data/test/TC_Webrick/iowa/NewPage.iwa +5 -0
- data/test/TC_Webrick/iowa/app.cnf +10 -0
- data/test/TC_Webrick/iowa/app.rb +5 -0
- data/test/tc_template.rb +15 -0
- data/test/tests.conf +19 -0
- data/utils/CVS/Entries +3 -0
- data/utils/CVS/Repository +1 -0
- data/utils/CVS/Root +1 -0
- data/utils/QuickCert-1.0.2.tar.gz +0 -0
- data/utils/QuickCert-1.0.2/InstalledFiles +7 -0
- data/utils/QuickCert-1.0.2/MANIFEST +10 -0
- data/utils/QuickCert-1.0.2/Makefile +15 -0
- data/utils/QuickCert-1.0.2/README +56 -0
- data/utils/QuickCert-1.0.2/bin/QuickCert +355 -0
- data/utils/QuickCert-1.0.2/config.save +12 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/README +60 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/drbssl_c.rb +26 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/drbssl_s.rb +35 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/qc_config +21 -0
- data/utils/QuickCert-1.0.2/lib/QuickCert/defaults.rb +28 -0
- data/utils/QuickCert-1.0.2/setup.rb +1312 -0
- data/utils/iowa_apps +422 -0
- data/utils/smtp_sink.rb +9 -0
- data/utils/startup_template.cnf +27 -0
- data/utils/startup_template.rb +73 -0
- metadata +551 -0
@@ -0,0 +1 @@
|
|
1
|
+
This is a static thing.
|
@@ -0,0 +1 @@
|
|
1
|
+
The time is now: @now
|
data/test/tc_template.rb
ADDED
data/test/tests.conf
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# TC_DbPool variables
|
2
|
+
|
3
|
+
# The DB vendor. This should correspond to the database type used
|
4
|
+
# in a DBI connect string. i.e. 'Mysql' for DBI:Mysql;
|
5
|
+
# 'Oracle' for DBI:Oracle, etc.... This is mandatory.
|
6
|
+
|
7
|
+
vendor=Mysql
|
8
|
+
|
9
|
+
# The host where the database is located. This is mandatory.
|
10
|
+
host=127.0.0.1
|
11
|
+
|
12
|
+
# The name of the database to connect to. This is mandatory.
|
13
|
+
|
14
|
+
name=test
|
15
|
+
|
16
|
+
# The username and password to use when connection. These are optional.
|
17
|
+
|
18
|
+
user=
|
19
|
+
password=
|
data/utils/CVS/Entries
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
iowa/utils
|
data/utils/CVS/Root
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
:extssh:khaines@enigo.com:/usr/local/cvsrepository
|
Binary file
|
@@ -0,0 +1,15 @@
|
|
1
|
+
RUBY?=ruby
|
2
|
+
|
3
|
+
syntax:
|
4
|
+
${RUBY} -dcw ./bin/QuickCert ./lib/QuickCert/qc_defaults.rb
|
5
|
+
|
6
|
+
test: syntax
|
7
|
+
|
8
|
+
install: test
|
9
|
+
${RUBY} setup.rb config
|
10
|
+
${RUBY} setup.rb setup
|
11
|
+
${RUBY} setup.rb install
|
12
|
+
|
13
|
+
clean:
|
14
|
+
rm -f config.save InstalledFiles
|
15
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
README
|
2
|
+
|
3
|
+
QuickCert allows you to quickly and easily create SSL
|
4
|
+
certificates. It uses a simple configuration file to generate
|
5
|
+
self-signed client and server certificates.
|
6
|
+
|
7
|
+
QuickCert is a compilation of NAKAMURA Hiroshi's post to
|
8
|
+
ruby-talk number 89917:
|
9
|
+
|
10
|
+
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/89917
|
11
|
+
|
12
|
+
the example scripts referenced in the above post, and
|
13
|
+
gen_csr.rb from Ruby's OpenSSL examples.
|
14
|
+
|
15
|
+
QuickCert's homepage is:
|
16
|
+
|
17
|
+
http://segment7.net/projects/ruby/QuickCert.html
|
18
|
+
|
19
|
+
USAGE
|
20
|
+
|
21
|
+
A simple QuickCert configuration file looks like:
|
22
|
+
|
23
|
+
full_hostname = `hostname`.strip
|
24
|
+
domainname = full_hostname.split('.')[1..-1].join('.')
|
25
|
+
hostname = full_hostname.split('.')[0]
|
26
|
+
|
27
|
+
CA[:hostname] = hostname
|
28
|
+
CA[:domainname] = domainname
|
29
|
+
CA[:CA_dir] = File.join Dir.pwd, "CA"
|
30
|
+
CA[:password] = '1234'
|
31
|
+
|
32
|
+
CERTS << {
|
33
|
+
:type => 'server',
|
34
|
+
:hostname => 'uriel',
|
35
|
+
:password => '5678',
|
36
|
+
}
|
37
|
+
|
38
|
+
CERTS << {
|
39
|
+
:type => 'client',
|
40
|
+
:user => 'drbrain',
|
41
|
+
:email => 'drbrain@segment7.net',
|
42
|
+
}
|
43
|
+
|
44
|
+
This configuration will create a Certificate Authority in a
|
45
|
+
'CA' directory in the current directory, a server certificate
|
46
|
+
with password '5678' for the server 'uriel' in a directory
|
47
|
+
named 'uriel', and a client certificate for drbrain in the
|
48
|
+
directory 'drbrain' with no password.
|
49
|
+
|
50
|
+
There are additional SSL knobs you can tweak in the
|
51
|
+
qc_defaults.rb file.
|
52
|
+
|
53
|
+
To generate the certificates, simply create a qc_config file
|
54
|
+
where you want the certificate directories to be created, then
|
55
|
+
run QuickCert.
|
56
|
+
|
@@ -0,0 +1,355 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'openssl'
|
4
|
+
|
5
|
+
##
|
6
|
+
# QuickCert allows you to quickly and easily create SSL
|
7
|
+
# certificates. It uses a simple configuration file to generate
|
8
|
+
# self-signed client and server certificates.
|
9
|
+
#
|
10
|
+
# QuickCert is a compilation of NAKAMURA Hiroshi's post to
|
11
|
+
# ruby-talk number 89917:
|
12
|
+
#
|
13
|
+
# http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/89917
|
14
|
+
#
|
15
|
+
# the example scripts referenced in the above post, and
|
16
|
+
# gen_csr.rb from Ruby's OpenSSL examples.
|
17
|
+
#
|
18
|
+
# A simple QuickCert configuration file looks like:
|
19
|
+
#
|
20
|
+
# full_hostname = `hostname`.strip
|
21
|
+
# domainname = full_hostname.split('.')[1..-1].join('.')
|
22
|
+
# hostname = full_hostname.split('.')[0]
|
23
|
+
#
|
24
|
+
# CA[:hostname] = hostname
|
25
|
+
# CA[:domainname] = domainname
|
26
|
+
# CA[:CA_dir] = File.join Dir.pwd, "CA"
|
27
|
+
# CA[:password] = '1234'
|
28
|
+
#
|
29
|
+
# CERTS << {
|
30
|
+
# :type => 'server',
|
31
|
+
# :hostname => 'uriel',
|
32
|
+
# :password => '5678',
|
33
|
+
# }
|
34
|
+
#
|
35
|
+
# CERTS << {
|
36
|
+
# :type => 'client',
|
37
|
+
# :user => 'drbrain',
|
38
|
+
# :email => 'drbrain@segment7.net',
|
39
|
+
# }
|
40
|
+
#
|
41
|
+
# This configuration will create a Certificate Authority in a
|
42
|
+
# 'CA' directory in the current directory, a server certificate
|
43
|
+
# with password '5678' for the server 'uriel' in a directory
|
44
|
+
# named 'uriel', and a client certificate for drbrain in the
|
45
|
+
# directory 'drbrain' with no password.
|
46
|
+
#
|
47
|
+
# There are additional SSL knobs you can tweak in the
|
48
|
+
# qc_defaults.rb file.
|
49
|
+
#
|
50
|
+
# To generate the certificates, simply create a qc_config file
|
51
|
+
# where you want the certificate directories to be created, then
|
52
|
+
# run QuickCert.
|
53
|
+
#
|
54
|
+
# QuickCert's homepage is:
|
55
|
+
# http://segment7.net/projects/ruby/QuickCert/
|
56
|
+
|
57
|
+
class QuickCert
|
58
|
+
|
59
|
+
##
|
60
|
+
# QuickCert Version
|
61
|
+
|
62
|
+
VERSION = "1.0.2"
|
63
|
+
|
64
|
+
##
|
65
|
+
# Creates a new QuickCert instance using the Certificate
|
66
|
+
# Authority described in +ca_config+. If there is no CA at
|
67
|
+
# ca_config[:CA_dir], then QuickCert will initialize a new one.
|
68
|
+
|
69
|
+
def initialize(ca_config)
|
70
|
+
@ca_config = ca_config
|
71
|
+
|
72
|
+
create_ca
|
73
|
+
end
|
74
|
+
|
75
|
+
##
|
76
|
+
# Creates a new certificate from +cert_config+ that is signed
|
77
|
+
# by the CA.
|
78
|
+
|
79
|
+
def create_cert(cert_config)
|
80
|
+
cert_keypair = create_key cert_config
|
81
|
+
cert_csr = create_csr cert_config, cert_keypair
|
82
|
+
sign_cert cert_config, cert_keypair, cert_csr
|
83
|
+
end
|
84
|
+
|
85
|
+
##
|
86
|
+
# Creates a new Certificate Authority from @ca_config if it
|
87
|
+
# does not already exist at ca_config[:CA_dir].
|
88
|
+
|
89
|
+
def create_ca
|
90
|
+
return if File.exists? @ca_config[:CA_dir]
|
91
|
+
|
92
|
+
Dir.mkdir @ca_config[:CA_dir]
|
93
|
+
|
94
|
+
Dir.mkdir File.join(@ca_config[:CA_dir], 'private'), 0700
|
95
|
+
Dir.mkdir File.join(@ca_config[:CA_dir], 'newcerts')
|
96
|
+
Dir.mkdir File.join(@ca_config[:CA_dir], 'crl')
|
97
|
+
|
98
|
+
File.open @ca_config[:serial_file], 'w' do |f| f << '1' end
|
99
|
+
|
100
|
+
puts "Generating CA keypair" if $DEBUG
|
101
|
+
keypair = OpenSSL::PKey::RSA.new @ca_config[:ca_rsa_key_length]
|
102
|
+
|
103
|
+
cert = OpenSSL::X509::Certificate.new
|
104
|
+
name = @ca_config[:name].dup << ['CN', 'CA']
|
105
|
+
cert.subject = cert.issuer = OpenSSL::X509::Name.new(name)
|
106
|
+
cert.not_before = Time.now
|
107
|
+
cert.not_after = Time.now + @ca_config[:ca_cert_days] * 24 * 60 * 60
|
108
|
+
cert.public_key = keypair.public_key
|
109
|
+
cert.serial = 0x0
|
110
|
+
cert.version = 2 # X509v3
|
111
|
+
|
112
|
+
ef = OpenSSL::X509::ExtensionFactory.new
|
113
|
+
ef.subject_certificate = cert
|
114
|
+
ef.issuer_certificate = cert
|
115
|
+
cert.extensions = [
|
116
|
+
ef.create_extension("basicConstraints","CA:TRUE", true),
|
117
|
+
ef.create_extension("nsComment","Ruby/OpenSSL Generated Certificate"),
|
118
|
+
ef.create_extension("subjectKeyIdentifier", "hash"),
|
119
|
+
ef.create_extension("keyUsage", "cRLSign,keyCertSign", true),
|
120
|
+
]
|
121
|
+
cert.add_extension ef.create_extension("authorityKeyIdentifier",
|
122
|
+
"keyid:always,issuer:always")
|
123
|
+
cert.sign keypair, OpenSSL::Digest::SHA1.new
|
124
|
+
|
125
|
+
cb = proc do @ca_config[:password] end
|
126
|
+
keypair_export = keypair.export OpenSSL::Cipher::DES.new(:EDE3, :CBC),
|
127
|
+
&cb
|
128
|
+
|
129
|
+
puts "Writing keypair to #{@ca_config[:keypair_file]}" if $DEBUG
|
130
|
+
File.open @ca_config[:keypair_file], "w", 0400 do |fp|
|
131
|
+
fp << keypair_export
|
132
|
+
end
|
133
|
+
|
134
|
+
puts "Writing cert to #{@ca_config[:cert_file]}" if $DEBUG
|
135
|
+
File.open @ca_config[:cert_file], "w", 0644 do |f|
|
136
|
+
f << cert.to_pem
|
137
|
+
end
|
138
|
+
|
139
|
+
puts "Done generating certificate for #{cert.subject}" if $DEBUG
|
140
|
+
end
|
141
|
+
|
142
|
+
##
|
143
|
+
# Creates a new RSA key from +cert_config+.
|
144
|
+
|
145
|
+
def create_key(cert_config)
|
146
|
+
passwd_cb = nil
|
147
|
+
dest = cert_config[:hostname] || cert_config[:user]
|
148
|
+
keypair_file = File.join dest, (dest + "_keypair.pem")
|
149
|
+
Dir.mkdir dest, 0700
|
150
|
+
|
151
|
+
puts "Generating RSA keypair" if $DEBUG
|
152
|
+
keypair = OpenSSL::PKey::RSA.new 1024
|
153
|
+
|
154
|
+
if cert_config[:password].nil? then
|
155
|
+
File.open keypair_file, "w", 0400 do |f|
|
156
|
+
f << keypair.to_pem
|
157
|
+
end
|
158
|
+
else
|
159
|
+
passwd_cb = proc do cert_config[:password] end
|
160
|
+
keypair_export = keypair.export OpenSSL::Cipher::DES.new(:EDE3, :CBC),
|
161
|
+
cert_config[:password]
|
162
|
+
|
163
|
+
puts "Writing keypair to #{keypair_file}" if $DEBUG
|
164
|
+
File.open keypair_file, "w", 0400 do |f|
|
165
|
+
f << keypair_export
|
166
|
+
end
|
167
|
+
|
168
|
+
end
|
169
|
+
|
170
|
+
return keypair_file
|
171
|
+
end
|
172
|
+
|
173
|
+
##
|
174
|
+
# Creates a new Certificate Signing Request for the keypair in
|
175
|
+
# +keypair_file+, generating and saving new keypair if nil.
|
176
|
+
|
177
|
+
def create_csr(cert_config, keypair_file = nil)
|
178
|
+
keypair = nil
|
179
|
+
dest = cert_config[:hostname] || cert_config[:user]
|
180
|
+
csr_file = File.join dest, "csr_#{dest}.pem"
|
181
|
+
|
182
|
+
name = @ca_config[:name].dup
|
183
|
+
case cert_config[:type]
|
184
|
+
when 'server' then
|
185
|
+
name << ['OU', 'CA']
|
186
|
+
name << ['CN', cert_config[:hostname]]
|
187
|
+
when 'client' then
|
188
|
+
name << ['CN', cert_config[:user]]
|
189
|
+
name << ['emailAddress', cert_config[:email]]
|
190
|
+
end
|
191
|
+
name = OpenSSL::X509::Name.new name
|
192
|
+
|
193
|
+
if File.exists? keypair_file then
|
194
|
+
keypair = OpenSSL::PKey::RSA.new File.read(keypair_file),
|
195
|
+
cert_config[:password]
|
196
|
+
else
|
197
|
+
keypair = create_key cert_config
|
198
|
+
end
|
199
|
+
|
200
|
+
puts "Generating CSR for #{name}" if $DEBUG
|
201
|
+
|
202
|
+
req = OpenSSL::X509::Request.new
|
203
|
+
req.version = 0
|
204
|
+
req.subject = name
|
205
|
+
req.public_key = keypair.public_key
|
206
|
+
req.sign keypair, OpenSSL::Digest::MD5.new
|
207
|
+
|
208
|
+
puts "Writing CSR to #{csr_file}" if $DEBUG
|
209
|
+
File.open csr_file, "w" do |f|
|
210
|
+
f << req.to_pem
|
211
|
+
end
|
212
|
+
|
213
|
+
return csr_file
|
214
|
+
end
|
215
|
+
|
216
|
+
##
|
217
|
+
# Signs the certificate described in +cert_config+ and
|
218
|
+
# +csr_file+, saving it to +cert_file+.
|
219
|
+
|
220
|
+
def sign_cert(cert_config, cert_file, csr_file)
|
221
|
+
csr = OpenSSL::X509::Request.new File.read(csr_file)
|
222
|
+
|
223
|
+
raise "CSR sign verification failed." unless csr.verify csr.public_key
|
224
|
+
|
225
|
+
if csr.public_key.n.num_bits < @ca_config[:cert_key_length_min] then
|
226
|
+
raise "Key length too short"
|
227
|
+
end
|
228
|
+
|
229
|
+
if csr.public_key.n.num_bits > @ca_config[:cert_key_length_max] then
|
230
|
+
raise "Key length too long"
|
231
|
+
end
|
232
|
+
|
233
|
+
if csr.subject.to_a[0, @ca_config[:name].size] != @ca_config[:name] then
|
234
|
+
raise "DN does not match"
|
235
|
+
end
|
236
|
+
|
237
|
+
# Only checks signature here. You must verify CSR according to your
|
238
|
+
# CP/CPS.
|
239
|
+
|
240
|
+
# CA setup
|
241
|
+
|
242
|
+
puts "Reading CA cert from #{@ca_config[:cert_file]}" if $DEBUG
|
243
|
+
ca = OpenSSL::X509::Certificate.new File.read(@ca_config[:cert_file])
|
244
|
+
|
245
|
+
puts "Reading CA keypair from #{@ca_config[:keypair_file]}" if $DEBUG
|
246
|
+
ca_keypair = OpenSSL::PKey::RSA.new File.read(@ca_config[:keypair_file]),
|
247
|
+
@ca_config[:password]
|
248
|
+
|
249
|
+
serial = File.read(@ca_config[:serial_file]).chomp.hex
|
250
|
+
File.open @ca_config[:serial_file], "w" do |f|
|
251
|
+
f << "%04X" % (serial + 1)
|
252
|
+
end
|
253
|
+
|
254
|
+
puts "Generating cert" if $DEBUG
|
255
|
+
|
256
|
+
cert = OpenSSL::X509::Certificate.new
|
257
|
+
from = Time.now
|
258
|
+
cert.subject = csr.subject
|
259
|
+
cert.issuer = ca.subject
|
260
|
+
cert.not_before = from
|
261
|
+
cert.not_after = from + @ca_config[:cert_days] * 24 * 60 * 60
|
262
|
+
cert.public_key = csr.public_key
|
263
|
+
cert.serial = serial
|
264
|
+
cert.version = 2 # X509v3
|
265
|
+
|
266
|
+
basic_constraint = nil
|
267
|
+
key_usage = []
|
268
|
+
ext_key_usage = []
|
269
|
+
|
270
|
+
case cert_config[:type]
|
271
|
+
when "ca" then
|
272
|
+
basic_constraint = "CA:TRUE"
|
273
|
+
key_usage << "cRLSign" << "keyCertSign"
|
274
|
+
when "terminalsubca" then
|
275
|
+
basic_constraint = "CA:TRUE,pathlen:0"
|
276
|
+
key_usage << "cRLSign" << "keyCertSign"
|
277
|
+
when "server" then
|
278
|
+
basic_constraint = "CA:FALSE"
|
279
|
+
key_usage << "digitalSignature" << "keyEncipherment"
|
280
|
+
ext_key_usage << "serverAuth"
|
281
|
+
when "ocsp" then
|
282
|
+
basic_constraint = "CA:FALSE"
|
283
|
+
key_usage << "nonRepudiation" << "digitalSignature"
|
284
|
+
ext_key_usage << "serverAuth" << "OCSPSigning"
|
285
|
+
when "client" then
|
286
|
+
basic_constraint = "CA:FALSE"
|
287
|
+
key_usage << "nonRepudiation" << "digitalSignature" << "keyEncipherment"
|
288
|
+
ext_key_usage << "clientAuth" << "emailProtection"
|
289
|
+
else
|
290
|
+
raise "unknonw cert type \"#{cert_config[:type]}\""
|
291
|
+
end
|
292
|
+
|
293
|
+
ef = OpenSSL::X509::ExtensionFactory.new
|
294
|
+
ef.subject_certificate = cert
|
295
|
+
ef.issuer_certificate = ca
|
296
|
+
ex = []
|
297
|
+
ex << ef.create_extension("basicConstraints", basic_constraint, true)
|
298
|
+
ex << ef.create_extension("nsComment",
|
299
|
+
"Ruby/OpenSSL Generated Certificate")
|
300
|
+
ex << ef.create_extension("subjectKeyIdentifier", "hash")
|
301
|
+
#ex << ef.create_extension("nsCertType", "client,email")
|
302
|
+
unless key_usage.empty? then
|
303
|
+
ex << ef.create_extension("keyUsage", key_usage.join(","))
|
304
|
+
end
|
305
|
+
#ex << ef.create_extension("authorityKeyIdentifier",
|
306
|
+
# "keyid:always,issuer:always")
|
307
|
+
#ex << ef.create_extension("authorityKeyIdentifier", "keyid:always")
|
308
|
+
unless ext_key_usage.empty? then
|
309
|
+
ex << ef.create_extension("extendedKeyUsage", ext_key_usage.join(","))
|
310
|
+
end
|
311
|
+
|
312
|
+
if @ca_config[:cdp_location] then
|
313
|
+
ex << ef.create_extension("crlDistributionPoints",
|
314
|
+
@ca_config[:cdp_location])
|
315
|
+
end
|
316
|
+
|
317
|
+
if @ca_config[:ocsp_location] then
|
318
|
+
ex << ef.create_extension("authorityInfoAccess",
|
319
|
+
"OCSP;" << @ca_config[:ocsp_location])
|
320
|
+
end
|
321
|
+
cert.extensions = ex
|
322
|
+
cert.sign ca_keypair, OpenSSL::Digest::SHA1.new
|
323
|
+
|
324
|
+
backup_cert_file = @ca_config[:new_certs_dir] + "/cert_#{cert.serial}.pem"
|
325
|
+
puts "Writing backup cert to #{backup_cert_file}" if $DEBUG
|
326
|
+
File.open backup_cert_file, "w", 0644 do |f|
|
327
|
+
f << cert.to_pem
|
328
|
+
end
|
329
|
+
|
330
|
+
# Write cert
|
331
|
+
dest = cert_config[:hostname] || cert_config[:user]
|
332
|
+
cert_file = File.join dest, "cert_#{dest}.pem"
|
333
|
+
puts "Writing cert to #{cert_file}" if $DEBUG
|
334
|
+
File.open cert_file, "w", 0644 do |f|
|
335
|
+
f << cert.to_pem
|
336
|
+
end
|
337
|
+
|
338
|
+
return cert_file
|
339
|
+
end
|
340
|
+
|
341
|
+
end # class QuickCert
|
342
|
+
|
343
|
+
if __FILE__ == $0 then
|
344
|
+
# get configuration
|
345
|
+
CA = {}
|
346
|
+
CERTS = []
|
347
|
+
load ARGV.shift || 'qc_config'
|
348
|
+
require 'QuickCert/defaults'
|
349
|
+
|
350
|
+
qc = QuickCert.new CA
|
351
|
+
CERTS.each do |cert_config|
|
352
|
+
qc.create_cert cert_config
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|