diff --git a/Gemfile b/Gemfile index 828bafe93..9f9e12904 100644 --- a/Gemfile +++ b/Gemfile @@ -28,6 +28,9 @@ gem 'jbuilder', '~> 2.0' # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' +# Replacement for erb +gem 'haml-rails', '~> 0.5.3' + group :assets do # See https://github.com/sstephenson/execjs#readme for more supported runtimes gem 'therubyracer', platforms: :ruby @@ -54,6 +57,7 @@ group :development, :test do # For debugging gem 'pry' + gem 'pry-byebug' # Testing framework gem 'rspec-rails', '~> 3.0.1' diff --git a/Gemfile.lock b/Gemfile.lock index 2fd42a5c0..5b63e8b77 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,6 +29,9 @@ GEM tzinfo (~> 1.1) arel (5.0.1.20140414130214) builder (3.2.2) + byebug (1.1.1) + columnize (~> 0.3.6) + debugger-linecache (~> 1.2.0) coderay (1.1.0) coffee-rails (4.0.1) coffee-script (>= 2.2.0) @@ -37,12 +40,21 @@ GEM coffee-script-source execjs coffee-script-source (1.7.0) + columnize (0.3.6) + debugger-linecache (1.2.0) diff-lcs (1.2.5) erubis (2.7.0) execjs (2.2.0) fabrication (2.11.3) faker (1.3.0) i18n (~> 0.5) + haml (4.0.5) + tilt + haml-rails (0.5.3) + actionpack (>= 4.0.1) + activesupport (>= 4.0.1) + haml (>= 3.1, < 5.0) + railties (>= 4.0.1) hike (1.2.3) i18n (0.6.9) jbuilder (2.1.0) @@ -67,6 +79,9 @@ GEM coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) + pry-byebug (1.0.1) + byebug (~> 1.1.1) + pry (>= 0.9.10) rack (1.5.2) rack-test (0.6.2) rack (>= 1.0) @@ -156,10 +171,12 @@ DEPENDENCIES coffee-rails (~> 4.0.0) fabrication (~> 2.11.3) faker (~> 1.3.0) + haml-rails (~> 0.5.3) jbuilder (~> 2.0) jquery-rails pg pry + pry-byebug rails (= 4.1.1) rspec-rails (~> 3.0.1) sass-rails (~> 4.0.3) diff --git a/README.md b/README.md index dd811cd0d..684253737 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,96 @@ registry ======== + +###To install and configure mod_epp (on Ubuntu 14.04 LTS) + +* `sudo apt-get install apache2` +* `sudo apt-get install apache2-threaded-dev` +* `sudo apt-get install apache2-utils` +* `sudo apt-get install apache2-dbg` (Actually I don't think this is needed, but while debugging I installed this too) +* Download [mod_epp 1.10](http://sourceforge.net/projects/aepps/) +* `tar -xzf mod_epp-1.10.tar.gz` +* `cd mod_epp-1.10` +* `sudo apxs2 -a -c -i mod_epp.c` +* `sudo a2enmod cgi` +* `sudo a2enmod authn_file` +* `sudo a2enmod proxy_http` +* `sudo htpasswd -c /etc/apache2/htpasswd test` +* Type "test" when prompted + +* `cd /usr/lib/cgi-bin` +* `mkdir epp` +* Copy the files from $mod_epp/examples/cgis to /usr/lib/cgi-bin/epp (this is just for now) +* `cd /etc/apache2/sites-available` +* `nano epp.conf` + +Add: +``` + + + Options ExecCGI + SetHandler cgi-script + + + Listen 1701 + + EPPEngine On + EPPCommandRoot /proxy/command + EPPSessionRoot /proxy/session + ProxyPass /proxy/ http://localhost:8080/epp/ + + EPPErrorRoot /cgi-bin/epp/error + + EPPAuthURI implicit + EPPReturncodeHeader X-EPP-Returncode + + +``` + +* `sudo service apache2 restart` + +Try it out: + +* `cd $mod_epp` +* `./epptelnet.pl localhost 1701` + +You should receive the freeting from the registry server. + + +Alternative virtual host config is as follows: +This needs a static greeting file, so you will have to make /var/www writable. + +``` + + + Options ExecCGI + SetHandler cgi-script + + + Listen 1700 + + + EPPEngine On + EPPCommandRoot /cgi-bin/epp/command + EPPSessionRoot /cgi-bin/epp/session + EPPErrorRoot /cgi-bin/epp/error + # we can redirect to static pages. + Alias /cgi-bin/epp/session/hello /var/www/html/epp/session-hello + + + # or to specialized scripts + Alias /cgi-bin/epp/session/login /usr/lib/cgi-bin/epp/session-login + Alias /cgi-bin/epp/session/logout /usr/lib/cgi-bin/epp/session-logout + Alias /cgi-bin/epp/error/schema /usr/lib/cgi-bin/epp/error-schema + Alias /cgi-bin/epp/command/create /usr/lib/cgi-bin/epp/create + Alias /cgi-bin/epp/command/info /usr/lib/cgi-bin/epp/info + + EPPAuthURI /epp/auth/login + + AuthType Basic + AuthName "EPP" + AuthUserFile /etc/apache2/htpasswd + require valid-user + + + +``` diff --git a/app/controllers/epp/sessions_controller.rb b/app/controllers/epp/sessions_controller.rb new file mode 100644 index 000000000..133d8a967 --- /dev/null +++ b/app/controllers/epp/sessions_controller.rb @@ -0,0 +1,5 @@ +class Epp::SessionsController < ApplicationController + def index + render 'hello' + end +end diff --git a/app/views/epp/sessions/hello.xml b/app/views/epp/sessions/hello.xml new file mode 100644 index 000000000..9a7197822 --- /dev/null +++ b/app/views/epp/sessions/hello.xml @@ -0,0 +1,17 @@ + + + + + + + Example mod_epp server + 2002-10-28T22:00:00.0Z + + 1.0 + en + + + diff --git a/config/routes.rb b/config/routes.rb index 3f66539d5..867fcd8dc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,8 @@ Rails.application.routes.draw do + namespace(:epp) do + get 'session/:command', to: 'sessions#index', defaults: { format: :xml } + end + # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes".