mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 02:35:57 +02:00
Add tld zonefile view
This commit is contained in:
parent
6528869db6
commit
27b88dae60
5 changed files with 60 additions and 0 deletions
45
app/controllers/admin/zonefiles_controller.rb
Normal file
45
app/controllers/admin/zonefiles_controller.rb
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
class Admin::ZonefilesController < ApplicationController
|
||||||
|
# TODO: Refactor this
|
||||||
|
# rubocop:disable Metrics/MethodLength
|
||||||
|
def index
|
||||||
|
zf = Zonefile.new
|
||||||
|
|
||||||
|
zf.origin = 'ee.'
|
||||||
|
zf.ttl = '43200'
|
||||||
|
|
||||||
|
zf.soa[:primary_ns] = 'ns.tld.ee.'
|
||||||
|
zf.soa[:email] = 'hostmaster.eestiinternet.ee.'
|
||||||
|
zf.soa[:origin] = 'ee.'
|
||||||
|
zf.soa[:refresh] = '3600'
|
||||||
|
zf.soa[:retry] = '900'
|
||||||
|
zf.soa[:expire] = '1209600'
|
||||||
|
zf.soa[:minimumTTL] = '3600'
|
||||||
|
zf.new_serial
|
||||||
|
|
||||||
|
zf.ns << { name: 'ee.', class: 'IN', host: 'b.tld.ee.' }
|
||||||
|
zf.ns << { name: 'ee.', class: 'IN', host: 'e.tld.ee.' }
|
||||||
|
zf.ns << { name: 'ee.', class: 'IN', host: 'ee.aso.ee.' }
|
||||||
|
zf.ns << { name: 'ee.', class: 'IN', host: 'ns.ut.ee.' }
|
||||||
|
zf.ns << { name: 'ee.', class: 'IN', host: 'ns.tld.ee.' }
|
||||||
|
zf.ns << { name: 'ee.', class: 'IN', host: 'sunic.sunet.se.' }
|
||||||
|
|
||||||
|
zf.a << { name: 'b.tld.ee.', class: 'IN', host: '194.146.106.110' }
|
||||||
|
zf.a4 << { name: 'b.tld.ee.', class: 'IN', host: '2001:67c:1010:28::53' }
|
||||||
|
zf.a << { name: 'e.tld.ee.', class: 'IN', host: '204.61.216.36' }
|
||||||
|
zf.a4 << { name: 'e.tld.ee.', class: 'IN', host: '2001:678:94:53::53' }
|
||||||
|
zf.a << { name: 'ee.aso.ee.', class: 'IN', host: '213.184.51.122' }
|
||||||
|
zf.a4 << { name: 'ee.aso.ee.', class: 'IN', host: '2a02:88:0:21::2' }
|
||||||
|
zf.a << { name: 'ns.ut.ee.', class: 'IN', host: '193.40.5.99' }
|
||||||
|
zf.a << { name: 'ns.tld.ee.', class: 'IN', host: '195.43.87.10' }
|
||||||
|
zf.a << { name: 'sunic.sunet.se.', class: 'IN', host: '192.36.125.2' }
|
||||||
|
zf.a4 << { name: 'sunic.sunet.se.', class: 'IN', host: '2001:6b0:7::2' }
|
||||||
|
|
||||||
|
Nameserver.all.includes(:domain).each do |x|
|
||||||
|
zf.ns << { name: "#{x.domain_name}.", class: 'IN', host: "#{x.hostname}." }
|
||||||
|
zf.a << { name: "#{x.hostname}.", class: 'IN', host: x.ipv4 } if x.ipv4.present?
|
||||||
|
zf.a4 << { name: "#{x.hostname}.", class: 'IN', host: x.ipv6 } if x.ipv6.present?
|
||||||
|
end
|
||||||
|
|
||||||
|
@zonefile = zf.generate
|
||||||
|
end
|
||||||
|
end
|
|
@ -16,6 +16,8 @@ class Nameserver < ActiveRecord::Base
|
||||||
|
|
||||||
before_validation :normalize_attributes
|
before_validation :normalize_attributes
|
||||||
|
|
||||||
|
delegate :name, to: :domain, prefix: true
|
||||||
|
|
||||||
def epp_code_map
|
def epp_code_map
|
||||||
{
|
{
|
||||||
'2302' => [
|
'2302' => [
|
||||||
|
|
9
app/views/admin/zonefiles/index.haml
Normal file
9
app/views/admin/zonefiles/index.haml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
.row
|
||||||
|
.col-sm-12
|
||||||
|
%h2.text-center-xs
|
||||||
|
= "#{t('zonefile')}"
|
||||||
|
%hr
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
= preserve do
|
||||||
|
%pre= @zonefile
|
|
@ -37,6 +37,8 @@
|
||||||
%li.dropdown-header= t('shared.system')
|
%li.dropdown-header= t('shared.system')
|
||||||
%li
|
%li
|
||||||
= link_to t('shared.settings'), admin_settings_path
|
= link_to t('shared.settings'), admin_settings_path
|
||||||
|
%li
|
||||||
|
= link_to t('zonefile'), admin_zonefiles_path
|
||||||
%li.divider
|
%li.divider
|
||||||
%li.dropdown-header= t('shared.users')
|
%li.dropdown-header= t('shared.users')
|
||||||
%li
|
%li
|
||||||
|
|
|
@ -7,6 +7,8 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
## ADMIN ROUTES
|
## ADMIN ROUTES
|
||||||
namespace(:admin) do
|
namespace(:admin) do
|
||||||
|
resources :zonefiles
|
||||||
|
|
||||||
resources :domains do
|
resources :domains do
|
||||||
member do
|
member do
|
||||||
get 'zonefile'
|
get 'zonefile'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue