New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: split dns with single domain name #141

Closed
hart323 opened this Issue Jul 23, 2014 · 17 comments

Comments

Projects
None yet
2 participants
@hart323
Contributor

hart323 commented Jul 23, 2014

how hard to implement this feature? As of now fmdns server does not allow to create 2 different zones with the same name?

for example:
domain.com for view view1
a IN A 10.10.10.10
domain.com for view view2
a IN A 20.20.20.20

@WillyXJ

This comment has been minimized.

Owner

WillyXJ commented Jul 23, 2014

Actually, you can already create multiple zones with the same name as long as they are in different views. So, you would create domain.com and select view1 when you create the zone, and then you create domain.com and select view2.

@hart323

This comment has been minimized.

Contributor

hart323 commented Jul 23, 2014

WillyXJ,

Hmm.. ok, will try that one. Thanks!

23.07.2014 20:14, WillyXJ пишет:

Actually, you can already create multiple zones with the same name as
long as they are in different views. So, you would create domain.com
and select view1 when you create the zone, and then you create
domain.com and select view2.


Reply to this email directly or view it on GitHub
#141 (comment).

@hart323

This comment has been minimized.

Contributor

hart323 commented Jul 24, 2014

Indeed I can create same domain with different views. But I found a bug. I created 'example.com' in 'all views', then I move it to 'internal' view and created another 'example.com' in 'external' view.
And now if I do zone reload on the server fmdns client writes zone file for old 'example.com' in 'all views' and not 'example.com' in 'internal' view. But if i do rebuild server config, fmclient builds all files just fine.

gets configuration it creates 'external' 'example.com' just fine, but 'internal' 'example.com' file is created for old 'example.com' in 'all views'.

@WillyXJ

This comment has been minimized.

Owner

WillyXJ commented Jul 24, 2014

There's logic that's supposed to prevent that from happening. When zone configs get edited, it's supposed to not allow zone reloads, but instead force a server config build.

Before you changed the view from "All Views" was your example.com zone ready for a "reload?" If not, what are the reproducible steps?

@WillyXJ WillyXJ added bug labels Jul 24, 2014

@WillyXJ WillyXJ added this to the 1.3 release milestone Jul 25, 2014

@hart323

This comment has been minimized.

Contributor

hart323 commented Jul 25, 2014

I use master version.
Reproduce steps:

  1. Create 'example.com' (all views, all servers)
  2. Add to 'example.com' A RR test1 1.1.1.1
  3. Change view for 'example.com' from 'all' to 'external'
  4. Add to 'example.com' A RR test2 1.1.1.2
  5. Server config rebuild => zone file = example.com with correct data => good
  6. Add to 'example.com' A RR test3 1.1.1.3
  7. Create 'example.com' (internal view, all servers)
  8. Add to 'example.com'(internal) A RR test1 2.2.2.1
  9. Server config rebuild => zone files are example.com.69 (external) and example.com.70 (internal) with correct data
    Now if I do server config rebuild after any changes => all is ok but
  10. Add to 'example.com'(external) A RR test4 1.1.1.4
  11. Add to 'example.com'(internal) A RR test2 2.2.2.2
    And as usual do zone reloads now when dnsclient get run we have the following:

example.com.69 (external) does not get updated => no test4 info
example.com.70 (internal) does not get updated => no test2 info
example.com (old one) get updated with data of example.com(internal), so it now contains test2 2.2.2.2

@hart323

This comment has been minimized.

Contributor

hart323 commented Jul 25, 2014

Ohh, even when I create zones with different views from the beginning I get the same result after zone reloading. DNSclient update with new data incorrect file.

WillyXJ added a commit that referenced this issue Jul 25, 2014

fmDNS - #141 - Fix zone edits allowing reloads
Reloads should not be available if the zone configuration gets edited.
@WillyXJ

This comment has been minimized.

Owner

WillyXJ commented Jul 25, 2014

A fix has been submitted for the next release.

@WillyXJ WillyXJ closed this Jul 25, 2014

@hart323

This comment has been minimized.

Contributor

hart323 commented Jul 28, 2014

Tried that commit with master branch. Bug stays the same. Bug is not about allowing zone reload or not.
The problem is that when you do zone reload dnsclient updates incorrect zone file (in my case this is example.com, and not example.com.69 and example.com.70), but if you (for example change server name so build config button will appear) build config -> client create good files with new data for both zones.

@WillyXJ

This comment has been minimized.

Owner

WillyXJ commented Jul 28, 2014

When editing zone configs (not RRs), zone reloads will never work correctly as zone reloads only update the db file, but the zone config changes require changes to named.conf so the zone reload button should not appear, but rather the server config build button. That's what this fix accomplishes in the 1.3-release branch.

@hart323

This comment has been minimized.

Contributor

hart323 commented Jul 29, 2014

I edit zone config.
I add/remove/change A RR from the zone example.com (internal view),
click reload button.
After cron timer hit dnsclient downloads new zone config with the new
data but with wrong filename:

./master/_db.example.com.h_osts:

; This file was built using fmDNS 1.2.5 on 29 July, 2014 17:30
Europe/Moscow
<<< new&correct data that I entered >>>

So now zones.conf.external contains:

zone "example.com" {
type master;
file "./master/db.example.com.67.hosts";
};
and zones.conf.internal contains:
zone "example.com" {
type master;
file "./master/db.example.com.68.hosts";
};
but As one may see the_filename that dnsclient create does not contain
zone index_.
And this behavior persists even if i do 'server build config' and then
do 'reload' again.
Maybe there is some missing 'index' in the code for reloaded zones?

29.07.2014 0:06, WillyXJ пишет:

When editing zone configs (not RRs), zone reloads will never work
correctly as zone reloads only update the db file, but the zone config
changes require changes to named.conf so the zone reload button should
not appear, but rather the server config build button. That's what
this fix accomplishes in the 1.3-release branch.


Reply to this email directly or view it on GitHub
#141 (comment).

@WillyXJ

This comment has been minimized.

Owner

WillyXJ commented Jul 29, 2014

Ah! You're managing RR within the zone after changing the zone configuration without building the config first. I now see the other bug related to this and why it's not resolved.

@WillyXJ

This comment has been minimized.

Owner

WillyXJ commented Jul 30, 2014

This should be fixed with both commits in this issue now.

@hart323

This comment has been minimized.

Contributor

hart323 commented Jul 30, 2014

:D WillyXJ,
i don't know what you are fixing, but this bug still exists. I use your commits but they did not help.
Still after doing 'zone reload' the client uses wrong filename. Maybe I did not explain that bug well.
Try to reproduce it by yourself.

@hart323

This comment has been minimized.

Contributor

hart323 commented Jul 30, 2014

Could you point me to the line of code where server generates text like

below in response to client cron job:

./master/db.example.com.hosts:

; This file was built using fmDNS 1.2.5 on 29 July, 2014 17:30
Europe/Moscow
<<< new&correct data that I entered >>>

30.07.2014 23:22, WillyXJ пишет:

This should be fixed with both commits in this issue now.


Reply to this email directly or view it on GitHub
#141 (comment).

@hart323

This comment has been minimized.

Contributor

hart323 commented Jul 30, 2014

It seems to me that "buildCronConfigs" function (class_buildconf.php)
missing part of the code that check if there are multiple domains with
the same name and if yes add domain_id index to filename.
For example like in the function "buildZoneConfig" there is code like this:

          /** Are there multiple zones with the same name? */
    basicGet('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', 

$zone_result[$i]->domain_name, 'domain_', 'domain_
name', 'AND domain_clone_domain_id=0 AND domain_id!=' .
$zone_result[$i]->domain_id);
if ($fmdb->num_rows) $file_ext = $zone_result[$i]->domain_id .
".$file_ext";
without this check cronjob will always "forget" about indexes.

Oh, it was hard to think at 2 a.m. Need to go sleeping :)

30.07.2014 23:22, WillyXJ пишет:

This should be fixed with both commits in this issue now.


Reply to this email directly or view it on GitHub
#141 (comment).

@WillyXJ

This comment has been minimized.

Owner

WillyXJ commented Jul 30, 2014

Oh, I kept seeing the problems with the UI and didn't test config pulls via cron. Sorry! Thanks for spotting it and I think this latest commit will fix that issue. Please test it and let me know as I currently don't have a working test environment for cron updates.

@hart323

This comment has been minimized.

Contributor

hart323 commented Jul 31, 2014

Confirm. Bug fixed.

@WillyXJ WillyXJ closed this Aug 4, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment