🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
11 messages
11 total messages Started by Aioe Mon, 28 Feb 2011 08:48
Maybe a bug in X-Trace nnrpd generation (INN 2.5.2)
#83899
Author: Aioe
Date: Mon, 28 Feb 2011 08:48
11 lines
1470 bytes
When nnrpd is executed through a command line and an article is posted, 
these articles are generated by nnrpd in a strange syntax 

NNTP-Posting-Host: stdin
X-Trace: localhost6.localdomain6 1298882426 2753  (28 Feb 2011 08:40:26 GMT)

stdin is neither an ip address nor a domain name (filter may try to resolve 
it without success)
X-Trace seems malformed (fourth field - client's ip addess - is missing)

Re: Maybe a bug in X-Trace nnrpd generation (INN 2.5.2)
#83902
Author: Julien ÉLIE
Date: Mon, 28 Feb 2011 09:19
43 lines
2843 bytes
Hi Paolo,

> When nnrpd is executed through a command line and an article is
> posted, these articles are generated by nnrpd in a strange syntax
>
> NNTP-Posting-Host: stdin
>
> X-Trace: localhost6.localdomain6 1298882426 2753  (28 Feb 2011
> 08:40:26 GMT)
>
> stdin is neither an ip address nor a domain name (filter may try to
> resolve it without success) X-Trace seems malformed (fourth field -
> client's ip addess - is missing)

These two header fields are deprecated and no longer in INN 2.6.0. 
Anyway, the problem also affects the Injection-Info: header field.  I 
remember having done something when there is no available IP (we
otherwise logged "stdin:" instead of "stdin"):
     http://inn.eyrie.org/trac/changeset/9124/trunk/nnrpd/post.c


The fact is that you are using a Unix domain socket here.
There is no IP associated to the connection to nnrpd.  And of course no
FQDN.

What would you want to see in these headers?
One cannot guess an IP or a domain name when unused…



Injection-Info: news.trigofacile.com; posting-host="stdin";
	logging-data="9351"

I think keeping "stdin" is better than totally dropping the posting-host
parameter from the header field value.
Well, I might be wrong.
Do not hesitate to tell what the best behaviour should be.

-- 
Julien ÉLIE

« Ne crains pas d'avancer lentement, crains seulement de
   t'arrêter. » (proverbe chinois)
Re: Maybe a bug in X-Trace nnrpd generation (INN 2.5.2)
#83900
Author: Aioe
Date: Mon, 28 Feb 2011 10:06
42 lines
2547 bytes
Julien ÉLIE wrote:

> Hi Paolo,

hi julien :-)

> These two header fields are deprecated and no longer in INN 2.6.0.

when do you plan to release inn 2.6.0?
which is the current development status of INN 2.6.0? Is it a beta, a pre-
beta or an alpha release?

> Anyway, the problem also affects the Injection-Info: header field.  

> What would you want to see in these headers?

localhost or 127.0.0.1 it's much enough

> One cannot guess an IP or a domain name when unused?

yes, it's true.
But, at the same time, it's hard for a script to understand that 'stdin' is 
a magic word and not a domain. In your way, you force to add an exeception 
to all routines that handles X-Trace/Injection-Info

> Injection-Info: news.trigofacile.com; posting-host="stdin";
> logging-data="9351"

this - imho - seems wrong. if 'posting-host' shows the sender's ip address 
or the sender's domain, it should always include an ip address or a domain.

> I think keeping "stdin" is better than totally dropping the posting-host
> parameter from the header field value.

i agree

> Well, I might be wrong.
> Do not hesitate to tell what the best behaviour should be.

imho, headers should include or localhost or 127.0.0.1 (if name resolution 
is disabled). A better option could be to mark in some way all messages that 
don't come from 'network' leaving posting-host empty in this case
Re: Maybe a bug in X-Trace nnrpd generation (INN 2.5.2)
#83901
Author: Julien ÉLIE
Date: Mon, 28 Feb 2011 10:43
65 lines
3494 bytes
Hi Paolo,

>> These two header fields are deprecated and no longer in INN 2.6.0.
>
> when do you plan to release inn 2.6.0?
> which is the current development status of INN 2.6.0? Is it a beta, a pre-
> beta or an alpha release?

INN 2.6.0 doesn't have any status; it is the latest development code of 
the next major release, and is available from daily snapshots.
Its release isn't planned yet.

The same way as you also have a pending INN 2.5.3 available from daily 
snapshots.  It is the latest development code of the current 2.5 stable 
branch.  I hope there will be a release this year.



>> What would you want to see in these headers?
>
> localhost or 127.0.0.1 it's much enough

Why not ipv6-localhost or ::1?
And aren't there cases where stdin is not from localhost but from a 
remote host?



>> One cannot guess an IP or a domain name when unused?
>
> yes, it's true.
> But, at the same time, it's hard for a script to understand that 'stdin' is
> a magic word and not a domain. In your way, you force to add an exception
> to all routines that handles X-Trace/Injection-Info

INN does not force "stdin".  The system gives the "stdin" value for the 
host.
Is "stdin" used by every platform INN runs on?

I am unsure whether adding an exception in INN and making it understand 
this magic word is the right thing to do.



>> Injection-Info: news.trigofacile.com; posting-host="stdin";
>> logging-data="9351"
>
> this - imho - seems wrong. if 'posting-host' shows the sender's ip address
> or the sender's domain, it should always include an ip address or a domain.
[…]
> imho, headers should include or localhost or 127.0.0.1 (if name resolution
> is disabled). A better option could be to mark in some way all messages that
> don't come from 'network' leaving posting-host empty in this case

When no IP is given, we could drop the posting-host parameter, yes.
I do not have any objection to that; it looks clearer.

And for the 2.5 branch, not adding an NNTP-Posting-Host: header field. 
But what for the X-Trace: header field?

-- 
Julien ÉLIE

« Ne crains pas d'avancer lentement, crains seulement de
   t'arrêter. » (proverbe chinois)
Re: Maybe a bug in X-Trace nnrpd generation (INN 2.5.2)
#83903
Author: Aioe
Date: Mon, 28 Feb 2011 11:34
51 lines
3311 bytes
Julien ÉLIE wrote:

> Hi Paolo,
> 
> Why not ipv6-localhost or ::1?

they sound good.

> And aren't there cases where stdin is not from localhost but from a
> remote host?

if nnrpd uses 'stdin' when a message is sent by a remote host it's a serious 
bug that should be corrected as soon as possible.
I'm assuming that 'stdin' marks only those messages sent through some Unix 
domain sockets used by nnrpd and innd that AFAIK are only local.

If you know a way to establish a connection with a remote Unix domain 
socket, i'm happy to learn. If you immagine an ssh connection with the 
remote host, in this case imho localhost is right since message was sent by 
localhost itself.
 
> INN does not force "stdin".  The system gives the "stdin" value for the
> host.

yes, of course.
When one needs to write a script that makes some check about the sender's ip 
address, X-Trace is the easiest way to fetch needed data.
In your current implementation, X-Trace fourth field stores usually the 
client's ip address. It becomes the arrival time when message comes from 
stdin and client's ip is not stored.
This behaviour breaks the X-Trace format and this is the first problem.
Usually, DNS resolution of first X-Trace field gives the same value that is 
stored in the fourth field so it's easy to build a couple of values, client 
IP and Domain from X-Trace. When a message comes from stdin, client domain 
(first field) is set to localhost, fourth X-Trace field is set to arrival 
time, NNTP-Posting-Host to 'stdin'. 
At this point, in order to avoid troubles my script must (a) parse X-Trace, 
(b) if first item inside X-Trace is 'somewhat like localhost' it must read 
NNTP-Posting-Host - which is the only place where 'stdin' is reported - and 
(c) if NNTP-Posting-Host is set to 'stdin' scripts must handle this.
It's complex, probably too complex.

> And for the 2.5 branch, not adding an NNTP-Posting-Host: header field.

good :-)

> But what for the X-Trace: header field?

put somewhat as fourth field that looks like an ip address (that is what 
everybody expects to find here)
Re: Maybe a bug in X-Trace nnrpd generation (INN 2.5.2)
#83904
Author: Aioe
Date: Mon, 28 Feb 2011 11:38
8 lines
1520 bytes
Aioe wrote:

> b) if first item inside X-Trace is 'somewhat like localhost' it must read
> NNTP-Posting-Host - which is the only place where 'stdin' is reported -

btw, if nnrpd is configured to strip nph, rthere's no way to know whether a 
message comes from stdin without searching for a "(" inside the field that 
usually stores an IP address.
Re: Maybe a bug in X-Trace nnrpd generation (INN 2.5.2)
#83905
Author: Russ Allbery
Date: Mon, 28 Feb 2011 18:19
25 lines
2233 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

> INN does not force "stdin".  The system gives the "stdin" value for the
> host.  Is "stdin" used by every platform INN runs on?

I think the stdin comes from nnrpd's StartConnection() here:

    /* Get the peer's name. */
    length = sizeof(ssc);
    if (getpeername(STDIN_FILENO, sac, &length) < 0) {
        if (!isatty(STDIN_FILENO)) {
            sysnotice("? can't getpeername");
            Reply("%d Can't get your name.  Goodbye!\r\n", NNTP_ERR_ACCESS);
            ExitWithStats(1, true);
        }
        strlcpy(Client.host, "stdin", sizeof(Client.host));

so we're the ones who are introducing the word.  I'm not sure what to do
instead, although 127.0.0.1 or ::1 both seem reasonable to me.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Maybe a bug in X-Trace nnrpd generation (INN 2.5.2)
#83907
Author: D. Stussy
Date: Mon, 28 Feb 2011 22:07
57 lines
2942 bytes
"Aioe" <estasi@aioe.org> wrote in message
news:ikfs40$svf$1@speranza.aioe.org...
> Julien ÉLIE wrote:
>
> > Hi Paolo,
>
> hi julien :-)
>
> > These two header fields are deprecated and no longer in INN 2.6.0.
>
> when do you plan to release inn 2.6.0?
> which is the current development status of INN 2.6.0? Is it a beta, a
pre-
> beta or an alpha release?
>
> > Anyway, the problem also affects the Injection-Info: header field.
>
> > What would you want to see in these headers?
>
> localhost or 127.0.0.1 it's much enough

I would prefer "localhost" over an IP address literal.  It's address family
independent.

> > One cannot guess an IP or a domain name when unused?
>
> yes, it's true.
> But, at the same time, it's hard for a script to understand that 'stdin'
is
> a magic word and not a domain. In your way, you force to add an
exeception
> to all routines that handles X-Trace/Injection-Info
>
> > Injection-Info: news.trigofacile.com; posting-host="stdin";
> > logging-data="9351"
>
> this - imho - seems wrong. if 'posting-host' shows the sender's ip
address
> or the sender's domain, it should always include an ip address or a
domain.
>
> > I think keeping "stdin" is better than totally dropping the
posting-host
> > parameter from the header field value.
>
> i agree
>
> > Well, I might be wrong.
> > Do not hesitate to tell what the best behaviour should be.
>
> imho, headers should include or localhost or 127.0.0.1 (if name
resolution
> is disabled). A better option could be to mark in some way all messages
that
> don't come from 'network' leaving posting-host empty in this case

Re: Maybe a bug in X-Trace nnrpd generation (INN 2.5.2)
#83910
Author: Julien ÉLIE
Date: Tue, 01 Mar 2011 11:03
18 lines
2002 bytes
Hi Paolo,

> I'm assuming that 'stdin' marks only those messages sent through some Unix
> domain sockets used by nnrpd and innd that AFAIK are only local.
>
> If you know a way to establish a connection with a remote Unix domain
> socket, i'm happy to learn. If you immagine an ssh connection with the
> remote host, in this case imho localhost is right since message was sent by
> localhost itself.

Yes, it was the kind of connection I was thinking about.  The message is 
sent, in fine, by the local host itself.  So no problem for "stdin" (or 
"localhost").

-- 
Julien ÉLIE

« J'aime le travail, je passerais des heures à le regarder. »
Re: Maybe a bug in X-Trace nnrpd generation (INN 2.5.2)
#83909
Author: Julien ÉLIE
Date: Tue, 01 Mar 2011 11:03
65 lines
4220 bytes
Hi Russ,

> I think the stdin comes from nnrpd's StartConnection() here:
>
>      /* Get the peer's name. */
>      length = sizeof(ssc);
>      if (getpeername(STDIN_FILENO, sac,&length)<  0) {
>          if (!isatty(STDIN_FILENO)) {
>              sysnotice("? can't getpeername");
>              Reply("%d Can't get your name.  Goodbye!\r\n", NNTP_ERR_ACCESS);
>              ExitWithStats(1, true);
>          }
>          strlcpy(Client.host, "stdin", sizeof(Client.host));

Oh, yes, you're totally right.
I had not had a look at the source code when answering Paolo.  So it now 
explains a few things and gives answers to the questions raised in this 
thread.

1/ nnrpd cannot use "stdin" when a message is sent by a remote host 
because the connection is dropped (502 Can't get your name.  Goodbye!) 
unless it comes from stdin (0).

2/ to solve issues with the X-Trace: header field, we need to set an IP 
so I believe adding
     strlcpy(Client.ip, "127.0.0.1", sizeof(Client.ip));
after setting Client.host in this special case (to "localhost" now) is 
what we should do *for INN 2.5*.
No change for INN 2.6 which does not generate X-Trace information.  We 
will end up with "localhost" in the Injection-Info: header body, which 
is fine.  No further IP.

It is amusing to see that we are fixing an historic bug in X-Trace 
information now it has been deprecated and no longer used in CURRENT 
versions of INN.



> so we're the ones who are introducing the word.  I'm not sure what to do
> instead, although 127.0.0.1 or ::1 both seem reasonable to me.

Maybe, as Dieter suggests, "localhost" is better for Client.host (a 
numerical address would be for Client.ip).


A remaining issue is when "nnrpd -n" is used, with no DNS resolution. 
The host is "?" and will be used as-is in headers.  It is not good, 
especially in a Path: header field like "me!.POSTED.?!not-for-mail" or 
in "?:1.2.3.4" in the Injection-Info: header field.

A straightforward fix would be to make "?" a variable, named 
UNRESOLVED_HOST, and set/check the value of Client.host with this 
variable.  We would then put the IP in the Path: header field, and only 
the IP (with no host) in the Injection-Info: header field.

This is a genuine bug in both NNTP-Posting-Host: and Injection-Info: 
header fields when DNS resolution is off.  I suggest the same fix for 
them (INN 2.5 and INN 2.6 respectively).
When the Sender: header field is automatically added, we also have to 
check that we do not add "user@?" but only "user".

-- 
Julien ÉLIE

« J'aime le travail, je passerais des heures à le regarder. »
Re: Maybe a bug in X-Trace nnrpd generation (INN 2.5.2)
#84110
Author: Julien ÉLIE
Date: Sat, 11 Jun 2011 07:32
56 lines
3339 bytes
Hi all,

> 2/ to solve issues with the X-Trace: header field, we need to set an IP 
> so I believe adding
> strlcpy(Client.ip, "127.0.0.1", sizeof(Client.ip));
> after setting Client.host in this special case (to "localhost" now) is 
> what we should do *for INN 2.5*.
> No change for INN 2.6 which does not generate X-Trace information. We 
> will end up with "localhost" in the Injection-Info: header body, which 
> is fine. No further IP.

Just fixed in INN 2.5.3 (and 2.6.0 with "posting-host") the following way:

The X-Trace: header field was not properly generated when an article
was locally posted.  The field mentioning the IP address was skipped,
resulting in a wrong syntax for this header.  The local "127.0.0.1" IP
address is now used.  Besides, "localhost" is now mentioned instead of
an obscure "stdin" in injection header fields.



Result with INN 2.6.0:
Path: news.trigofacile.com!.POSTED.localhost!not-for-mail
Injection-Info: news.trigofacile.com; posting-host="localhost"


Result with INN 2.5.3:
NNTP-Posting-Host: localhost
X-Trace: news.trigofacile.com 1307777002 7512 127.0.0.1 (11 Jun 2011 09:23:22 GMT)



> A remaining issue is when "nnrpd -n" is used, with no DNS resolution. 
> The host is "?" and will be used as-is in headers.  It is not good, 
> especially in a Path: header field like "me!.POSTED.?!not-for-mail" or 
> in "?:1.2.3.4" in the Injection-Info: header field.

There is in fact no bug.  Also just tested.
The IP is used :)

(When the "-n" flag is used, "Client.Ip" is copied into "Client.Host".)


Result with INN 2.6.0:
Path: news.trigofacile.com!.POSTED.92.141.84.61!not-for-mail
Injection-Info: news.trigofacile.com; posting-host="92.141.84.61"


I think all the issues mentioned in this thread are now fixed.
Do not hesitate to tell me in case something is still wrong.

-- 
Julien ÉLIE

« Un voyage de mille lieues commence toujours par un premier pas. »
  (Lao Zi)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads