[PATCH] Use domain names with hkp_address and recon_address

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Use domain names with hkp_address and recon_address

Kim Minh Kaplan
I propose the following patch (c77aab222f08 on
http://www.kim-minh.com/hg/sks/).  With it I can put the following in my
sksconf:

    recon_address: keyserver.kim-minh.com
    hkp_address: keyserver.kim-minh.com

and SKS will serve *all* the available addresses for keyserver.kim-minh.com.

Kim Minh.


# HG changeset patch
# User Kim Minh Kaplan <[hidden email]>
# Date 1251646824 -7200
# Node ID c77aab222f08dc7469d43eb1b5cc171ca1e997f4
# Parent  d351d05877dca577dce3463675dc9e4e44f973ea
Call Unix.getaddrinfo on both hkp_address and recon_address.

diff -r d351d05877dc -r c77aab222f08 common.ml
--- a/common.ml Sun Aug 30 09:42:49 2009 +0200
+++ b/common.ml Sun Aug 30 17:40:24 2009 +0200
@@ -201,8 +201,10 @@
 let whitespace = Str.regexp "[ \t\n]+"
 let make_addr_list address_string port =
   let addrlist = Str.split whitespace address_string in
-  let f s = Unix.ADDR_INET (Unix.inet_addr_of_string s, port) in
-  List.map ~f addrlist
+  let servname = if port = 0 then "" else (string_of_int port) in
+  let resolver host = List.map ~f:(fun ai -> ai.Unix.ai_addr)
+      (Unix.getaddrinfo host servname [Unix.AI_SOCKTYPE Unix.SOCK_STREAM]) in
+  List.flatten (List.map ~f:resolver addrlist)
 
 let recon_port = !Settings.recon_port
 let recon_address = !Settings.recon_address
diff -r d351d05877dc -r c77aab222f08 sks.pod
--- a/sks.pod Sun Aug 30 09:42:49 2009 +0200
+++ b/sks.pod Sun Aug 30 17:40:24 2009 +0200
@@ -152,7 +152,7 @@
 
 =item -recon_address
 
-Set recon binding address.  Can be a list of whitespace separated IP addresses.
+Set recon binding addresses.  Can be a list of whitespace separated domain names.
 
 =item -hkp_port
 
@@ -160,7 +160,7 @@
 
 =item -hkp_address
 
-Set hkp binding address.  Can be a list of whitespace separated IP addresses.
+Set hkp binding addresses.  Can be a list of whitespace separated domain names.
 
 =item -use_port_80
 

_______________________________________________
Sks-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/sks-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use domain names with hkp_address and recon_address

John Marshall-2
On Sun, 30 Aug 2009, 16:00 +0000, Kim Minh Kaplan wrote:
> I propose the following patch (c77aab222f08 on
> http://www.kim-minh.com/hg/sks/).  With it I can put the following in my
> sksconf:
>
>     recon_address: keyserver.kim-minh.com
>     hkp_address: keyserver.kim-minh.com
>
> and SKS will serve *all* the available addresses for keyserver.kim-minh.com.

I have no objection to this as an _alternative_ configuration option but
I am not in favour of it replacing the existing IP address
configuration.

My preference for administering servers and services is to configure
server IP addresses for services on the server; and then use DNS to
direct clients to the server I want them to use.  I think domain names
are appropriate for client configuration but not (usually) for server
configuration.

Perhaps your proposal could be implemented with something like
recon_name and hkp_name; and have those, if present, supersede the
*_address configuration options?  Alternatively, check whether the
*_address lists are IP addresses or domain names and handle
configuration accordingly.

--
John Marshall

_______________________________________________
Sks-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/sks-devel

attachment0 (203 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use domain names with hkp_address and recon_address

John Marshall-2
On Mon, 31 Aug 2009, 07:38 +1000, John Marshall wrote:
> My preference for administering servers and services is to configure
> server IP addresses for services on the server; and then use DNS to
> direct clients to the server I want them to use.  I think domain names
> are appropriate for client configuration but not (usually) for server
> configuration.

Think of the scenario where you have sks.example.com pointing at a
secondary server for some reason.  If you use the domain name for
configuration on the primary server at that time; the primary server
won't start because the IP addresses to which the name resolves are not
available on the primary server.

--
John Marshall

_______________________________________________
Sks-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/sks-devel

attachment0 (203 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use domain names with hkp_address and recon_address

Kim Minh Kaplan
In reply to this post by John Marshall-2
John Marshall writes:

> check whether the
> *_address lists are IP addresses or domain names and handle
> configuration accordingly.

If my understanding of getaddrinfo(3) is correct this is exactly what
the patch I sent should do.  It does not work for you?  Or may be the
documentation change I did is not right and should read "Can be a list
of whitespace separated IP addresses or domain names."

Kim Minh.


_______________________________________________
Sks-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/sks-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use domain names with hkp_address and recon_address

John Marshall-2
On Sun, 30 Aug 2009, 23:02 +0000, Kim Minh Kaplan wrote:

> John Marshall writes:
>
> >check whether the
> >*_address lists are IP addresses or domain names and handle
> >configuration accordingly.
>
> If my understanding of getaddrinfo(3) is correct this is exactly what
> the patch I sent should do.  It does not work for you?  Or may be the
> documentation change I did is not right and should read "Can be a list
> of whitespace separated IP addresses or domain names."
Thank you for clarifying the functionality of getaddrinfo (I'm not a
programmer and didn't know).  My comments were prompted by your
documentation patch which implied that the IP address lists were
replaced by domain name lists.  Yes, changing the documentation patch as
you suggest above would be good.

--
John Marshall

_______________________________________________
Sks-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/sks-devel

attachment0 (203 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use domain names with hkp_address and recon_address

Kim Minh Kaplan
John Marshall writes:

> On Sun, 30 Aug 2009, 23:02 +0000, Kim Minh Kaplan wrote:
>
>> may be the
>> documentation change I did is not right and should read "Can be a list
>> of whitespace separated IP addresses or domain names."
>
> Yes, changing the documentation patch as
> you suggest above would be good.

OK I committed it as 95926d02fe80 in http://www.kim-minh.com/hg/sks/ 
please consider for inclusion in SKS.

Kim Minh.


_______________________________________________
Sks-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/sks-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use domain names with hkp_address and recon_address

Yaron Minsky
The patches look good.  They've been pushed to the main repo.

y

On Mon, Aug 31, 2009 at 5:41 PM, Kim Minh Kaplan <[hidden email]> wrote:
John Marshall writes:

On Sun, 30 Aug 2009, 23:02 +0000, Kim Minh Kaplan wrote:

may be the documentation change I did is not right and should read "Can be a list of whitespace separated IP addresses or domain names."

Yes, changing the documentation patch as you suggest above would be good.

OK I committed it as 95926d02fe80 in http://www.kim-minh.com/hg/sks/ please consider for inclusion in SKS.


Kim Minh.


_______________________________________________
Sks-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/sks-devel


_______________________________________________
Sks-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/sks-devel