Tolaris / mikrotik-dns-dhcp

Tool to syncronise DHCP lease names with DNS hostnames on Mikrotik routers.
GNU General Public License v2.0
52 stars 19 forks source link

Issues with DHCP entries containing hostnames with invalid characters #1

Open jpluimers opened 8 years ago

jpluimers commented 8 years ago

Hostnames should only include a limited set of characters: https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names

I've two types of devices that fail here:

They are added with invalid hostnames into the DNS.

In due time you will get a pull request that solves this and will also remove those added invalid hostnames.

It is going to take a while as the Mikrotik RouterOS Scripting language has very limited documentation, has some issues with associative arrays and the :pick function, and in general has a steep learning curve.

--jeroen

Tolaris commented 8 years ago

Awesome, I look forward to your pull request! I'm familiar with the problem of devices violating the DNS spec, and with how much Mikrotik scripting sucks. I don't use this script personally anymore, but if you've tested it I'm happy to take a fix.

On 12 May 2016 at 18:46, Jeroen Wiert Pluimers notifications@github.com wrote:

Hostnames should only include a limited set of characters: https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names

I've two types of devices that fail here:

  • Harman Kardon devices (BDS580_AP 02e466)
  • Buffalo networking (AP4CE6760F5042) - seems legit, but has a terminating null character

They are added with invalid hostnames into the DNS.

In due time you will get a pull request that solves this and also remove those added invalid hostnames.

It is going to take a while as the Mikrotik RouterOS Scripting language has very limited documentation, has some issues with associative arrays and the :pick function, and in general has a steep learning curve.

--jeroen

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/Tolaris/mikrotik-dns-dhcp/issues/1

jpluimers commented 8 years ago

Hi Tyler,

Thanks.

So you still use Mikrotik devices?

I ask because I want to put up a collection of RouterOS scripts online (probably github or bitbucket) and looking for people that have reasonable input to start with.

I've recently asked a few script related questions on the mikrotik forums and the state-of-the-art isn't really what I was hoping for (:

Regards,

--jeroen

Tolaris commented 8 years ago

That's a kind offer, thanks! Email me at tyler@tolaris.com (tyler tolaris com, does github try to obfuscate emails? About to find out.) to contact me directly any time. Ping me if you come to London!

I do use two Mikrotik routers for some colocated servers I own, which means I don't need dynamic DNS/DHCP integration anymore and rarely script anything. But I'm happy to share what I have.

On 15 May 2016 at 16:04, Jeroen Wiert Pluimers notifications@github.com wrote:

Hi Tyler,

Thanks.

So you still use Mikrotik devices?

I ask because I want to put up a collection of RouterOS scripts online (probably github or bitbucket) and looking for people that have reasonable input to start with.

I've recently asked a few script related questions on the mikrotik forums and the state-of-the-art isn't really what I was hoping for (:

BTW: If you ever are back in Amsterdam, let me know. We can probably accommodate you for a few nights here.

Regards,

--jeroen

Groet,

Jeroen W. Pluimers - specialist in .NET, Win32, SQL, Visual Studio & Delphi tel: +31 20 610 8322 fax: +31 20 610 8323 GSM: +31 654 385 135 mailto:jeroen@pluimers.com Pluimers Software Ontwikkeling BV, Amsterdam, Trade-register 34152606 http://wiert.me ; http://jwpluimers.myplaxo.com/

On Fri, May 13, 2016 at 8:44 AM, Tyler J. Wagner <notifications@github.com

wrote:

Awesome, I look forward to your pull request! I'm familiar with the problem of devices violating the DNS spec, and with how much Mikrotik scripting sucks. I don't use this script personally anymore, but if you've tested it I'm happy to take a fix.

On 12 May 2016 at 18:46, Jeroen Wiert Pluimers <notifications@github.com

wrote:

Hostnames should only include a limited set of characters:

https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names

I've two types of devices that fail here:

  • Harman Kardon devices (BDS580_AP 02e466)
  • Buffalo networking (AP4CE6760F5042) - seems legit, but has a terminating null character

They are added with invalid hostnames into the DNS.

In due time you will get a pull request that solves this and also remove those added invalid hostnames.

It is going to take a while as the Mikrotik RouterOS Scripting language has very limited documentation, has some issues with associative arrays and the :pick function, and in general has a steep learning curve.

--jeroen

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/Tolaris/mikrotik-dns-dhcp/issues/1

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub < https://github.com/Tolaris/mikrotik-dns-dhcp/issues/1#issuecomment-218964448

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/Tolaris/mikrotik-dns-dhcp/issues/1#issuecomment-219290944

mmv-ru commented 8 years ago

What is best to do with unacceptable symbols? Remove or replace by hex code? Or some smart behavior, like remove NULL (and other control chars?) replace underscore to minus and others to hex.

jpluimers commented 8 years ago

I'm working on the latter. See https://github.com/jpluimers/mikrotik-routeros/blob/master/scripts/Function.stripInvalidHostNameCharactersFromString.rsc for my work so far.

jpluimers commented 8 years ago

@mmv-ru in the link a LOG output by the code I have so far.

I need to add a decision column to the log and then cleanup the code.

https://gist.github.com/jpluimers/5555abaf0d46357203638b674930abfe