🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
6 messages
6 total messages Started by cira Mon, 07 Jul 2003 22:26
SSL and inn
#65978
Author: cira
Date: Mon, 07 Jul 2003 22:26
68 lines
4215 bytes
Are there instructions somewhere on how to set up INN to 
use SSL?  I haven't been able to get it to work.  I'm using
the SSL stuff because both the usernames/passwords & the
data in the messages are semi-sensitive.

The system is Debian Woody.
The packages are: 
    inn2 (2.4.0-3)  
    inn2-inews (2.4.0-3) 
    inn2-ssl (2.4.0-3)

I generated a key like this:

openssl req -new -x509 -nodes -days 1825 \
    -keyout /etc/news/nnrpd-key.pem -out /etc/news/nnrpd-cert.pem
chown root.news /etc/news/nnrpd-key.pem
chmod 640 /etc/news/nnrpd-key.pem

I enable debugging in /etc/syslog.conf
    news.debug    /var/log/news/news.debug

The inn2-ssl package contains only one binary:
    /usr/lib/news/nnrpd-ssl

If I start nnrpd-ssl separately after inn2 is running like 
this:  `/usr/lib/news/nnrpd-ssl -D -f -S -p 563`  netstat 
reports that port 563 has indeed been opened.  But 
/var/log/news/news.debug reports:

Jul  7 12:44:35 chaljin nnrpd-ssl[20261]: unable to get certificate from '/etc/news/nnrpd-cert.pem'
Jul  7 12:44:35 chaljin nnrpd-ssl[20261]: error initializing TLS: [CA_file: ] [CA_path: /etc/news] [cert_file: /etc/news/nnrpd-cert.pem] [key_file: /etc/news/nnrpd-key.pem]

Humm 
ll /etc/news/nnrpd-cert.pem
-rw----r--    1 root     news         1289 Jul  2 09:15 nnrpd-cert.pem

chmod g+r /etc/news/nnrpd-cert.pem

Jul  7 12:51:12 chaljin nnrpd-ssl[20427]: bad ownership or permissions on private key '/etc/news/nnrpd-cert.pem'
Jul  7 12:51:12 chaljin nnrpd-ssl[20427]: error initializing TLS: [CA_file: ] [CA_path: /etc/news] [cert_file: /etc/news/nnrpd-cert.pem] [key_file: /etc/news/nnrpd-key.pem]

But nnrpd-cert.pem isn't the private key, nnrpd-key.pem is, isn't it?
I've tried numerous other permissions but either nnrpd-ssl complains
that it can't read the certificate or that the permissions are bad.

Everything seems to work without SSL, I can log in, be 
authenticated, read, post, etc.

Just as an aside; I had another inn installation, 2.3.2 and
the system had a 300+ day uptime during which inn had clicked
along perfectly.  I brought the system down to change out
some of the hardware, brought it back up, then a few hours 
later when the inn cron jobs ran I was mortified to receive 
an email notice informing me that all my messages had been
expired, despite having "*:A:never:never:never" in expire.ctl .
It had been an openlinux 3.1.1 and now seemed a good time
to migrate to debian.  I had backups though, so all was not
lost.  But it bothers me that I don't see why it did that.
I guess the reboot triggered an expire -- but of everything?
I have inn 2.4 now, so it's only a question of curiosity and
placating fears about messages vanishing from under my nose.

-- 
   .''`.          /\/'`\    sam_george@comcast.net
  : :' :        .::/:::::..    .  irc://fslc.usu.edu/#cira
  `. `'    ) .//::(:###( )::.._/^  gps:41°45'N 111°49'W
    `- ..:@://"  ,|)   _/.        uin:4577509  gpg:1024D/A7AAF777
Re: SSL and inn
#65990
Author: Jeffrey M. Vinocur
Date: Tue, 08 Jul 2003 04:48
53 lines
2618 bytes
In article <Wpidnf0j9pAgnJeiXTWJgQ@comcast.com>,
cira  <sam_george@comcast.net> wrote:
>Are there instructions somewhere on how to set up INN to 
>use SSL?

Not that I know of; few people have trouble.  (Perhaps few people
try it.)


>openssl req -new -x509 -nodes -days 1825 \
>    -keyout /etc/news/nnrpd-key.pem -out /etc/news/nnrpd-cert.pem

Glancing at the 'cert' target in the makefile, I notice that the
same file is passed to both -keyout and -out by default.  I don't
know if this is important.


>The inn2-ssl package contains only one binary:
>    /usr/lib/news/nnrpd-ssl

Ok, I don't know anything about the Debian packages, but we'll
ignore that for now.


>-rw----r--    1 root     news         1289 Jul  2 09:15 nnrpd-cert.pem
>
>chmod g+r /etc/news/nnrpd-cert.pem
>
>Jul  7 12:51:12 chaljin nnrpd-ssl[20427]: bad ownership or permissions
>on private key '/etc/news/nnrpd-cert.pem'

What about making it o-r as well?  The expected mode seems to be
640.


>Just as an aside; I had another inn installation, 2.3.2 and
>the system had a 300+ day uptime during which inn had clicked
>along perfectly.  I brought the system down to change out
>some of the hardware, brought it back up, then a few hours 
>later when the inn cron jobs ran I was mortified to receive 
>an email notice informing me that all my messages had been
>expired, despite having "*:A:never:never:never" in expire.ctl .

Huh.  That should certainly not have happened.

There have been several reports of this behavior recently, but no
one's ever been able to reproduce it.


-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: SSL and inn
#66012
Author: Erik Klavon
Date: Tue, 08 Jul 2003 17:46
40 lines
2641 bytes
cira wrote:
> Are there instructions somewhere on how to set up INN to 
> use SSL?  I haven't been able to get it to work.  I'm using
> the SSL stuff because both the usernames/passwords & the
> data in the messages are semi-sensitive.
> 
> The system is Debian Woody.
> The packages are: 
>     inn2 (2.4.0-3)  
>     inn2-inews (2.4.0-3) 
>     inn2-ssl (2.4.0-3)

I've compiled from source, so YMMV WRT my experience.

> 
> I generated a key like this:
> 
> openssl req -new -x509 -nodes -days 1825 \
>     -keyout /etc/news/nnrpd-key.pem -out /etc/news/nnrpd-cert.pem
> chown root.news /etc/news/nnrpd-key.pem
> chmod 640 /etc/news/nnrpd-key.pem

Hmmm, what does your sasl.conf say?

> Jul  7 12:44:35 chaljin nnrpd-ssl[20261]: unable to get certificate from '/etc/news/nnrpd-cert.pem'
> Jul  7 12:44:35 chaljin nnrpd-ssl[20261]: error initializing TLS: [CA_file: ] [CA_path: /etc/news] [cert_file: /etc/news/nnrpd-cert.pem] [key_file: /etc/news/nnrpd-key.pem]

Yeah, so I had errors like these in 2.4 which I fixed by putting the 
cert and private key in a single file and pointing sasl.conf to that 
file only:

tls_ca_path:            /news/lib
tls_cert_file:          /news/lib/cert.pem  # cert.pem contains both the 
cert AND private key
tls_key_file:           /news/lib/cert.pem

Hope that helps,

Erik
Re: SSL and inn
#66024
Author: cira
Date: Tue, 08 Jul 2003 22:59
109 lines
5569 bytes
Jeffrey M. Vinocur wrote:

> In article <Wpidnf0j9pAgnJeiXTWJgQ@comcast.com>,
> cira  <sam_george@comcast.net> wrote:
>>Are there instructions somewhere on how to set up INN to 
>>use SSL?

*Creates instructions for setting up INN to use SSL*

http://spishack.com/~cira/comp/doc/innpresentation/

> Not that I know of; few people have trouble.  (Perhaps few people
> try it.)

I suspect you are correct.

>>openssl req -new -x509 -nodes -days 1825 \
>>    -keyout /etc/news/nnrpd-key.pem -out /etc/news/nnrpd-cert.pem
> 
> Glancing at the 'cert' target in the makefile, I notice that the
> same file is passed to both -keyout and -out by default.  I don't
> know if this is important.

*examines Makefile*

openssl req -new -x509 -nodes -out /etc/news/cert.pem -days 1825 \
    -keyout /etc/news/cert.pem
chown news. /etc/news/cert.pem
chmod 640 /etc/news/cert.pem

*edit /etc/sasl.conf appropriately*

Jul  8 10:11:15 chaljin nnrpd-ssl[7793]: bad ownership or permissions on private key '/etc/news/cert.pem'
Jul  8 10:11:15 chaljin nnrpd-ssl[7793]: error initializing TLS: [CA_file: ] [CA_path: /etc/news] [cert_file: /etc/news/cert.pem] [key_file: /etc/news/cert.pem]

chown root. /etc/news/cert.pem

Jul  8 10:17:14 chaljin nnrpd-ssl[7972]: unable to get certificate from '/etc/news/cert.pem'

chown news.root /etc/news/cert.pem
chmod 600 /etc/news/cert.pem

Jul  8 11:06:20 chaljin nnrpd-ssl[8759]: starttls: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits) no authentication

Oh!  That worked!

*fiddles*

Ok.  couple of problems.  It looks like when you use seperate
files for the private and public keys that nnrpd-ssl gets
confused when logging problems about which key is which.
It says "private key" but then it lists the file which holds
the public key.  Changing permissions on the real private 
key heals the situation.  Permissions of 640 on the private
key is not acceptable to nnrpd-ssl

Wishlist item: nnrpd-ssl reports that the private key should
have permissions 600 (or 400).  And that it should report the
correct file.

notice:  it didn't matter wheather the public and the private
keys where stored in the same file or in seperate files.  Only
that the keys had the correct permissions.

>>The inn2-ssl package contains only one binary:
>>    /usr/lib/news/nnrpd-ssl
> 
> Ok, I don't know anything about the Debian packages, but we'll
> ignore that for now.
> 
> 
>>-rw----r--    1 root     news         1289 Jul  2 09:15 nnrpd-cert.pem
>>
>>chmod g+r /etc/news/nnrpd-cert.pem
>>
>>Jul  7 12:51:12 chaljin nnrpd-ssl[20427]: bad ownership or permissions
>>on private key '/etc/news/nnrpd-cert.pem'
> 
> What about making it o-r as well?  The expected mode seems to be
> 640.

0 root@chaljin:/etc/news 156# chown root.news nnrpd-cert.pem 
0 root@chaljin:/etc/news 157# chmod 640 nnrpd-cert.pem
0 root@chaljin:/etc/news 158# ll nnrpd-cert.pem 
-rw-r-----    1 root     news         1289 Jul  2 09:15 nnrpd-cert.pem

Jul  8 09:43:02 chaljin nnrpd-ssl[7293]: bad ownership or permissions on private key '/etc/news/nnrpd-cert.pem'
Jul  8 09:43:02 chaljin nnrpd-ssl[7293]: error initializing TLS: [CA_file: ] [CA_path: /etc/news] [cert_file: /etc/news/nnrpd-cert.pem] [key_file: /etc/news/nnrpd-key.pem]

>>Just as an aside; I had another inn installation, 2.3.2 and
>>the system had a 300+ day uptime during which inn had clicked
>>along perfectly.  I brought the system down to change out
>>some of the hardware, brought it back up, then a few hours 
>>later when the inn cron jobs ran I was mortified to receive 
>>an email notice informing me that all my messages had been
>>expired, despite having "*:A:never:never:never" in expire.ctl .
> 
> Huh.  That should certainly not have happened.
> 
> There have been several reports of this behavior recently, but no
> one's ever been able to reproduce it.

Well, if any one would like to pick apart a decomissioned 
machine that had this happen, I have one.
-- 
   .''`.          /\/'`\    sam_george@comcast.net
  : :' :        .::/:::::..    .  irc://fslc.usu.edu/#cira
  `. `'    ) .//::(:###( )::.._/^  gps:41°45'N 111°49'W
    `- ..:@://"  ,|)   _/.        uin:4577509  gpg:1024D/A7AAF777
Re: SSL and inn -- patch included *ATTN Russ*
#66091
Author: cira
Date: Fri, 11 Jul 2003 16:03
53 lines
3477 bytes
cira wrote:

> *fiddles*
> 
> Ok.  couple of problems.  It looks like when you use seperate
> files for the private and public keys that nnrpd-ssl gets
> confused when logging problems about which key is which.
> It says "private key" but then it lists the file which holds
> the public key.  Changing permissions on the real private 
> key heals the situation.  Permissions of 640 on the private
> key is not acceptable to nnrpd-ssl
> 
> Wishlist item: nnrpd-ssl reports that the private key should
> have permissions 600 (or 400).  And that it should report the
> correct file.
> 
> notice:  it didn't matter wheather the public and the private
> keys where stored in the same file or in seperate files.  Only
> that the keys had the correct permissions.

Here is a patch that does what I proposed.

--- nnrpd/tls.c       2003-05-08 22:25:27.000000000 -0600
+++ nnrpd/tls.c.new     2003-07-11 09:51:26.000000000 -0600
@@ -415,13 +415,13 @@
 
        /* check ownership and permissions of key file */
        if (lstat(key_file, &buf) == -1) {
-           syslog(L_ERROR, "unable to stat private key '%s'", cert_file);
+           syslog(L_ERROR, "unable to stat private key '%s'", key_file);
            return (0);
        }
        if (!S_ISREG(buf.st_mode) || (buf.st_mode & 0077) != 0 ||
            buf.st_uid != getuid()) {
-           syslog(L_ERROR, "bad ownership or permissions on private key '%s'", 
-                 cert_file);
+           syslog(L_ERROR, "bad ownership or permissions on private key '%s'.  The private key must be mode 700 or less, and owned by user news.", 
+                 key_file);
            return (0);
        }

Oh, and I'd like to say thanks to Russ & Vincent for working
on inn so much, you guys are the best!

ps. I've never submitted a patch for anything before...
did i do it right?

cira
-- 
   .''`.          /\/'`\    sam_george@comcast.net
  : :' :        .::/:::::..    .  irc://fslc.usu.edu/#cira
  `. `'    ) .//::(:###( )::.._/^  gps:41°45'N 111°49'W
    `- ..:@://"  ,|)   _/.        gpg:1024D/A7AAF777
Re: SSL and inn -- patch included *ATTN Russ*
#66635
Author: Russ Allbery
Date: Mon, 08 Sep 2003 02:49
38 lines
2676 bytes
cira <sam_george@comcast.net> writes:

> Here is a patch that does what I proposed.

> --- nnrpd/tls.c       2003-05-08 22:25:27.000000000 -0600
> +++ nnrpd/tls.c.new     2003-07-11 09:51:26.000000000 -0600
> @@ -415,13 +415,13 @@
 
>         /* check ownership and permissions of key file */
>         if (lstat(key_file, &buf) == -1) {
> -           syslog(L_ERROR, "unable to stat private key '%s'", cert_file);
> +           syslog(L_ERROR, "unable to stat private key '%s'", key_file);
>             return (0);
>         }
>         if (!S_ISREG(buf.st_mode) || (buf.st_mode & 0077) != 0 ||
>             buf.st_uid != getuid()) {
> -           syslog(L_ERROR, "bad ownership or permissions on private key '%s'", 
> -                 cert_file);
> +           syslog(L_ERROR, "bad ownership or permissions on private key '%s'.  The private key must be mode 700 or less, and owned by user news.", 
> +                 key_file);
>             return (0);
>         }

Thanks, this patch has been applied.

> Oh, and I'd like to say thanks to Russ & Vincent for working
> on inn so much, you guys are the best!

> ps. I've never submitted a patch for anything before...
> did i do it right?

Yup, looked good 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.
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