Coder Social home page Coder Social logo

internetee / registry Goto Github PK

View Code? Open in Web Editor NEW
46.0 11.0 19.0 92.33 MB

TLD Management Software

License: Other

Ruby 81.20% HTML 8.06% CoffeeScript 0.26% JavaScript 0.10% Dockerfile 0.02% Sass 0.43% SCSS 0.01% Haml 4.65% PLpgSQL 5.28%
epp registry tld domain ruby

registry's Introduction

Domain Registry

Maintainability Test Coverage Documentation Status

Full stack top-level domain (TLD) management.

Documentation

Installation

Registry app

Registry based on Rails 4 installation (rbenv install is under Debian build doc)

Manual demo install and database setup:

cd /home/registry
git clone [email protected]:internetee/registry.git demo-registry
cd demo-registry
rbenv local 2.2.2
bundle
cp config/application.yml.sample config/application.yml # and edit it
cp config/database.yml.sample config/database.yml # and edit it
bundle exec rake db:setup:all # for production, please follow deployment howto
bundle exec rake bootstrap
bundle exec rake assets:precompile

Apache (Debian 7/Ubuntu 14.04 LTS)

sudo apt-get install apache2

Enable ssl:

sudo a2enmod proxy_http
sudo mkdir /etc/apache2/ssl
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt
sudo a2enmod ssl
sudo nano /etc/apache2/sites-enabled/epp_ssl.conf

For Apache, registry admin goes to port 443 in production, /etc/apache2/sites-enabled/registry.conf short example:

<VirtualHost *:443>
  ServerName your-domain
  ServerAdmin [email protected]

  PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
  PassengerRuby /home/registry/.rbenv/shims/ruby
  PassengerEnabled on
  PassengerMinInstances 10
  PassengerMaxPoolSize 10
  PassengerPoolIdleTime 0
  PassengerMaxRequests 1000

  RailsEnv production # or staging
  DocumentRoot /home/registry/registry/current/public

  # Possible values include: debug, info, notice, warn, error, crit,
  LogLevel info
  ErrorLog /var/log/apache2/registry.error.log
  CustomLog /var/log/apache2/registry.access.log combined

  SSLEngine On
  SSLCertificateFile    /etc/ssl/certs/your.crt
  SSLCertificateKeyFile /etc/ssl/private/your.key
  SSLCertificateChainFile /etc/ssl/certs/your-chain-fail.pem
  SSLCACertificateFile /etc/ssl/certs/ca.pem

  SSLProtocol -all +TLSv1.2
  SSLHonorCipherOrder On
  SSLCompression off
  SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH

  RewriteEnginriteEngine on
  RedirectMatch ^/$ /admin
  RedirectMatch ^/login$ /admin/login

  <Directory /app/registry/registry/current/public>
      # for Apache older than version 2.4
      Allow from all

      # for Apache verison 2.4 or newer
      # Require all granted
      Options -MultiViews
  </Directory>

  <Location />
      Allow from none
      Deny from all
  </Location>

  <Location /admin>
      Allow from all
  </Location>

  <Location /assets>
      Allow from all
  </Location>
</VirtualHost>

Registrar configuration (/etc/apache2/sites-enabled/registrar.conf) is as follows:

<VirtualHost *:443>
  ServerName your-registrar-domain
  ServerAdmin [email protected]

  PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
  PassengerRuby /home/registry/.rbenv/shims/ruby
  PassengerEnabled on
  PassengerMinInstances 10
  PassengerMaxPoolSize 10
  PassengerPoolIdleTime 0
  PassengerMaxRequests 1000

  RailsEnv production # or staging
  DocumentRoot /home/registry/registrar/current/public

  # Possible values include: debug, info, notice, warn, error, crit,
  LogLevel info
  ErrorLog /var/log/apache2/registrar.error.log
  CustomLog /var/log/apache2/registrar.access.log combined

  SSLEngine On
  SSLCertificateFile    /etc/ssl/certs/your.crt
  SSLCertificateKeyFile /etc/ssl/private/your.key
  SSLCertificateChainFile /etc/ssl/certs/your-chain-fail.pem
  SSLCACertificateFile /etc/ssl/certs/ca.pem

  SSLProtocol -all +TLSv1.2
  SSLHonorCipherOrder On
  SSLCompression off
  SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH

  RewriteEngine on
  RedirectMatch ^/$ /registrar
  RedirectMatch ^/login$ /registrar/login

  <Directory /app/registry/registrar/current/public>
      # for Apache older than version 2.4
      Allow from all

      # for Apache verison 2.4 or newer
      # Require all granted

      Options -MultiViews
  </Directory>

  <Location />
      Allow from none
      Deny from all
  </Location>

  <Location /registrar>
      Allow from all
  </Location>

  <Location /assets>
      Allow from all
  </Location>

  SSLVerifyClient none
  SSLVerifyDepth 1
  SSLCACertificateFile /home/registry/registry/shared/ca/certs/ca.cert.pem
  SSLCARevocationPath /home/registry/registry/shared/ca/crl
  # Uncomment in Apache 2.4
  # SSLCARevocationCheck chain

  RequestHeader set SSL_CLIENT_S_DN_CN ""
  RequestHeader set SSL_CLIENT_CERT ""
  <Location /registrar/sessions>
      SSLVerifyClient require
      RequestHeader set SSL_CLIENT_S_DN_CN "%{SSL_CLIENT_S_DN_CN}s"
      RequestHeader set SSL_CLIENT_CERT "%{SSL_CLIENT_CERT}s"
  </Location>

  <Location /registrar/id>
      SSLVerifyClient require
      Options Indexes FollowSymLinks MultiViews
      SSLVerifyDepth 2
      SSLOptions +StdEnvVars +ExportCertData
  </Location>
</VirtualHost>

Registrant configuration (/etc/apache2/sites-enabled/registrant.conf) is as follows:

<VirtualHost *:443>
    ServerName your-registrant-domain
    ServerAdmin [email protected]

    PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
    PassengerRuby /home/registry/.rbenv/shims/ruby
    PassengerEnabled on
    PassengerMinInstances 10
    PassengerMaxPoolSize 10
    PassengerPoolIdleTime 0
    PassengerMaxRequests 1000

    RailsEnv production # or staging
    DocumentRoot /home/registry/registrant/current/public

    # Possible values include: debug, info, notice, warn, error, crit,
    LogLevel info
    ErrorLog /var/log/apache2/registrant.error.log
    CustomLog /var/log/apache2/registrant.access.log combined

    SSLEngine On
    SSLCertificateFile    /etc/ssl/certs/your.crt
    SSLCertificateKeyFile /etc/ssl/private/your.key
    SSLCertificateChainFile /etc/ssl/certs/your-chain-fail.pem
    SSLCACertificateFile /etc/ssl/certs/ca.pem

    SSLProtocol -all +TLSv1.2
    SSLHonorCipherOrder On
    SSLCompression off
    SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH

    RewriteEngine on
    RedirectMatch ^/$ /registrant
    RedirectMatch ^/login$ /registrant/login

    <Directory /app/registry/registrant/current/public>
        # for Apache older than version 2.4
        Allow from all

        # for Apache verison 2.4 or newer
        # Require all granted

        Options -MultiViews
    </Directory>

    <Location />
        Allow from none
        Deny from all
    </Location>

    <Location /registrant>
        Allow from all
    </Location>

    <Location /assets>
        Allow from all
    </Location>

    SSLVerifyClient none
    SSLVerifyDepth 1
    SSLCACertificateFile /home/registry/registry/shared/ca/certs/ca.cert.pem
    SSLCARevocationPath /home/registry/registry/shared/ca/crl
    # Uncomment in Apache 2.4
    # SSLCARevocationCheck chain

    RequestHeader set SSL_CLIENT_S_DN_CN ""
    RequestHeader set SSL_CLIENT_CERT ""
    <Location /registrant/sessions>
        SSLVerifyClient require
        RequestHeader set SSL_CLIENT_S_DN_CN "%{SSL_CLIENT_S_DN_CN}s"
        RequestHeader set SSL_CLIENT_CERT "%{SSL_CLIENT_CERT}s"
    </Location>

    <Location /registrant/id>
        SSLVerifyClient require
        Options Indexes FollowSymLinks MultiViews
        SSLVerifyDepth 2
        SSLOptions +StdEnvVars +ExportCertData
    </Location>
</VirtualHost>

For Apache, REPP goes to port 443 in production, /etc/apache2/sites-enabled/repp.conf short example:

<VirtualHost *:443>
    ServerName your-repp-domain
    SSLEngine on
    #SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile /etc/apache2/ssl/apache.crt
    SSLCertificateKeyFile /etc/apache2/ssl/apache.key

    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
    ProxyPreserveHost on
    RequestHeader set X_FORWARDED_PROTO 'https'

    SSLVerifyClient none
    SSLVerifyDepth 1
    SSLCACertificateFile /home/registry/registry/shared/ca/certs/ca.crt.pem
    SSLCARevocationPath /home/registry/registry/shared/ca/crl
    # Uncomment this when upgrading to apache 2.4:
    # SSLCARevocationCheck chain

    RequestHeader set SSL_CLIENT_S_DN_CN ""
    RequestHeader set SSL_CLIENT_CERT ""

    <Location />
        Allow from none
        Deny from all
    </Location>

    <Location /repp>
        Allow from all
        SSLVerifyClient require
        RequestHeader set SSL_CLIENT_S_DN_CN "%{SSL_CLIENT_S_DN_CN}s"
        RequestHeader set SSL_CLIENT_CERT "%{SSL_CLIENT_CERT}s"
    </Location>
</VirtualHost>

For Apache, epp goes to port 700. Be sure to update paths to match your system configuration. /etc/apache2/sites-enabled/epp.conf short example:

<IfModule mod_ssl.c>
    Listen 127.0.0.1:8080
    <VirtualHost 127.0.0.1:8080>
        ServerName your-epp-backend-domain
        ServerAdmin [email protected]

        PassengerEnabled on
        PassengerMinInstances 10
        PassengerMaxPoolSize 10
        PassengerPoolIdleTime 0
        PassengerMaxRequests 1000
        PassengerRoot "/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini"
        PassengerRuby "/home/registry/.rbenv/shims/ruby"

        RailsEnv production # or staging
        DocumentRoot "/home/registry/registry/public"

        # Possible values include: debug, info, notice, warn, error, crit,
        LogLevel info
        ErrorLog "/var/log/apache2/eppback.error.log"
        CustomLog "/var/log/apache2/eppback.access.log" combined

        <Directory />
            Options +FollowSymLinks -Indexes
            AllowOverride None
        </Directory>

        <Directory /home/registry/registry/public>
            Order allow,deny
            Allow from all
            Options -MultiViews -Indexes
            AllowOverride all
        </Directory>
    </VirtualHost>
</IfModule>

Enable epp_ssl and restart apache

sudo a2ensite epp_ssl
sudo service apache2 restart

Now you should see registry admin at https://your-domain

All registry demo data can be found at:

db/seeds.rb

Initially you can use two type of users: admin users and EPP users.

For using EPP we are strongly recommend to install epp_proxy instead of mod_epp. You can get epp_proxy from https://github.com/internetee/epp_proxy

Wkhtmltopdf setup

sudo apt-get install libxext-dev libxrender1 fontconfig

Certificates setup

Deployment

Autotesting

Github Actions CI

  • Github Actions CI is configured to build all the PRs.

EPP web client

Please follow EPP web client readme:

https://github.com/internetee/EPP-web-client

WHOIS server

Please follow WHOIS server readme:

https://github.com/internetee/whois

registry's People

Contributors

artur-intech avatar dependabot[bot] avatar dinsmol avatar karlerikounapuu avatar keijoraamat avatar kritik avatar maciej-szlosarczyk avatar maricavor avatar mlensment avatar olegphenomenon avatar priidikvaikla avatar renovate-bot avatar renovate[bot] avatar teadur avatar thiagoyoussef avatar vahtel avatar vohmar avatar yulgolem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

registry's Issues

timezone issues on domain expiry: expire, outzone and delete not saved in utc

domain expiration process has bugs on saving timestamps in db in correct timezone, using these values correctly according to timezone of the server/application and calculating the values of valid to, outzone and delete dates.

valid to calculated and saved in local timezone instead of utc

valid_from: "2016-10-21 11:08:18.872509"
valid_to: "2017-10-22 00:00:00"

outzone_at and delete_at dates are saved in db in local timezone instead of utc:

valid_to: "2016-11-03 22:00:00"
outzone_at: "2016-11-18 00:00:00"
delete_at: "2016-12-18 00:00:00"

due to this registrant looses 22hrs of expire warning period

logic:

  • all timestamps in db must be in UTC timezone
  • application must convert this to the timezone of the application/server (incl cron and Que jobs)
  • expire date (valid to) of a domain is set to the beginning of next day of registration according local time (ie. reg date 2016-11-04 13:15:00.000+02.00 = exp date 2016-11-05 00:00:00.00+02.00 (in db 2016-11-04 22:00:00.00+00.00)
  • outzone_at and delete_at are calculated on domain expiry
    • outzone at = valid to + expire warning period
    • delete at = valid to + expire warning period + redemption grace period
  • domain is set as expired when timpestamp now > valid to
  • domain is set on hold (removed from zone) when timestamp now > outzone at
  • domain is set as delete candidate and random delete time is calculated when timestamp now > delete at
  • domain is deleted if domain has delete candidate status set

Test case 1:

  • domain registered @ 2016-11-04 13:15 (GMT +2)
  • create/registration date saved in db 2016-11-04 11:15:00+00.00
  • expiration date saved in db 2017-11-04 22:00:00+00.00 - registration for 1 year
  • outzone date saved in db on domain expiry 2017-11-19 22:00:00+00.00
  • delete date save in db on domain expiry 2017-12-19 22.00.00+00.00
  • domain deleted at random time between 2017-12-19 22.00.00+00.00 and 2017-12-20 21:59:59+00.00

Test case 2:

  • domain registere @ 2016-11-05 01:34 (GMT +2)
  • registration date saved in db 2016-11-04 22:34:00+00.00
  • expiration date saved in db 2017-11-05 22:00:00+00.00 - registration for 1 year
  • outzone date saved in db on domain expiry 2017-11-20 22:00:00+00.00
  • delete date save in db on domain expiry 2017-12-20 22.00.00+00.00
  • domain deleted at random time between 2017-12-20 22.00.00+00.00 and 2017-12-21 21:59:59+00.00

Investigate migration error

artur@registry:~/registry$ bundle exec rake db:migrate
== 20161004101419 AdduuidIndexToEppLogs: migrating ============================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::UndefinedColumn: ERROR: column "uuid" does not exist
: CREATE INDEX CONCURRENTLY epp_logs_uuid ON epp_logs USING btree (uuid);/media/sf_registry/db/migrate/20161004101419_adduuid_index_to_epp_logs.rb:3:in change' /home/artur/.rbenv/versions/2.2.2/bin/bundle:23:inload'
/home/artur/.rbenv/versions/2.2.2/bin/bundle:23:in <main>' ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "uuid" does not exist : CREATE INDEX CONCURRENTLY epp_logs_uuid ON epp_logs USING btree (uuid); /media/sf_registry/db/migrate/20161004101419_adduuid_index_to_epp_logs.rb:3:inchange'
/home/artur/.rbenv/versions/2.2.2/bin/bundle:23:in load' /home/artur/.rbenv/versions/2.2.2/bin/bundle:23:in

'
PG::UndefinedColumn: ERROR: column "uuid" does not exist
/media/sf_registry/db/migrate/20161004101419_adduuid_index_to_epp_logs.rb:3:in change' /home/artur/.rbenv/versions/2.2.2/bin/bundle:23:inload'
/home/artur/.rbenv/versions/2.2.2/bin/bundle:23:in `'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Remove monkey-patching

config/initializers/eis_custom_active_model.rb
config/initializers/eis_custom_active_record.rb
config/initializers/eis_custom_flash.rb

EPP: ForceDelete prohibits domain updates

ForceDelete prevents any updates to a domain object.

ForceDelete is not a status on its own - it's a group label for list of statuses:

  • serverRenewProhibited
  • serverTransferProhibited
  • serverUpdateProhibited
  • pendingDelete
  • serverManualInzone

So by default any updates are prohibited. To enable updates admin has to remove serverUpdateProhibited. Removing this results in new error on domain update

Object status prohibits operation - pendingDelete [code: 2304]

pending delete cannot prevent any other requests except domain:delete. Removing this results

Object status prohibits operation [code: 2304]

To update domain data one has to remove serverForceDelete.

EPP: contact_update "no errors" on contact with missing ident data

Updating contact with missing ident data generates unhandled error condition

<result code="1">
  <msg lang="en">handle_errors was executed when there were actually no errors</msg>
</result>

sample contact_info ident

    <extension>
      <eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
        <eis:ident type="" cc=""/>
      </eis:extdata>
    </extension>

failure on update of such contact is OK, and the only solution for the registrar here is to create a new contact object, but correct error handling is necessary. An expected error message

`2306 "Parameter value policy error. Update of ident data not allowed [ident]"

Review documentation

Mobile-id login leads to exception at registrar/registrant portals

Nov 9 10:51:06 reg-l-rar REGISTRAR[4016]: [registrar] [855b0a24-4bf6-4fa6-b14b-a58327d7165f] [195.43.86.5] #012NoMethodError (undefined method level=' for Syslog::Logger:Class):#012 app/controllers/registrar/sessions_controller.rb:112:in mid'#12 config/initializers/eis_custom_flash.rb:9:in `call'

Check domain expiration logic

domain is set as expired when timpestamp now > valid to
domain is set on hold (removed from zone) when timestamp now > outzone at
domain is set as delete candidate and random delete time is calculated when timestamp now > delete at
domain is deleted if domain has delete candidate status set

extracted from #235

Fix mailers' layout

  1. Make common layout, so that all emails look the same (cur
  2. Consider increasing font size for better accessibility.
  3. Unify subject: some are in English, some are in Estonian, some are in both.

Fix failing specs

 10) Domain with valid attributes should validate uniqueness of tech contacts
      Failure/Error: @domain = Fabricate(:domain)
      NoMethodError:
        undefined method `json=' for #<Whois::Record:0x007f000fc5d8a0>
      # ./app/models/whois_record.rb:115:in `update_whois_server'
      # ./app/jobs/update_whois_record_job.rb:25:in `update_domain'
      # ./app/jobs/update_whois_record_job.rb:15:in `block in run'
      # ./app/jobs/update_whois_record_job.rb:12:in `each'
      # ./app/jobs/update_whois_record_job.rb:12:in `run'
      # ./app/models/domain.rb:716:in `update_whois_record'
      # ./spec/models/domain_spec.rb:78:in `block (3 levels) in <top (required)>'
      # -e:1:in `<main>'

WHOIS: filter bad input before query gets to db

WHOIS server cannot handle invalid input correctly

/home/whois/whois/releases/12/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/postgresql_adapter.rb:602:inexec_prepared': PG::CharacterNotInRepertoire: ERROR: invalid byte sequence for encoding "UTF8": 0xf6 0xf6 0x72 0x69 (ActiveRecord::StatementInvalid)`

server should validate the input so only correclty formated and valid queries reach the db

expire emails arent sent out

When domain goes to expire status, reminder email should be sent out according to the configured
Setting.expiration_reminder_mail parameter (defaults to 2)
So by default configuration expire reminder email should be sent out once to domain owner and all administrative contacts 2 days after domain has expired.
#188

Check expire_time (domain.valid_to = domain.valid_from.utc.beginning_of_day + convert_period_to_time(domain.period, domain.period_unit) + 1.day)

Check mailers

The following mailers seem to be broken:

  • pending_update_rejected_notification_for_new_registrant
  • pending_update_expired_notification_for_new_registrant
  • pending_update_notification_for_new_registrant

DomainMailer.pending_update_rejected_notification_for_new_registrant(Domain.find(86902)).deliver!

ArgumentError: An SMTP To address is required to send a message
#200

EPP: domain:delete does not fill outzone_at

successful domain:delete query leaves outzone_at blank. The delete_at field is filled and onHold status is set.

System has to fill the outzone_At with time and date the onHold status was set.

Investigate logging

STDOUT << "#{Time.zone.now.utc} DomainCron.start_expire_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.