Bug 208953 - ftp/proftpd: dhparams file is stale
Summary: ftp/proftpd: dhparams file is stale
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Martin Matuska
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-21 11:46 UTC by florian.heigl
Modified: 2024-02-10 01:31 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (mm)


Attachments
dhparams_gen.sh (1.50 KB, text/plain)
2024-01-08 08:13 UTC, Miroslav Lachman
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description florian.heigl 2016-04-21 11:46:10 UTC
Hi,


this port brings along a dhparams file that was last re-generated in 2013;
it should be re-generated and not include any <3072 params.
per size it also only has a single param which, as far as I remember, isn't ideal either.

It's also doubtful why it has it's own in general, /etc/ssh/moduli *might* be compatible (but probably not accessible if running non-root)
At least maybe using the same source file for that could help.
Comment 1 florian.heigl 2016-04-21 11:48:50 UTC
Another thing that worries me here but totally doesn't relate to this port:
Did noone ever audit the ports tree as a whole for high-entropy things like this after all the NSA shit came down?

No idea who to ask about that, but I see a corpse right here and its rotten.
Comment 2 Walter Schwarzenfeld 2018-01-13 03:48:27 UTC
Maintainer feedback?
Comment 3 florian.heigl 2018-01-13 11:51:06 UTC
I didn't hear anything, and had long forgotten about the issue.
If you know how to get a security person to look into it, please go ahead.
Somehow it seems I just can't "find" the proper channel in cases like this.





I just checked and I really did replace it everywhere in the env I helped run back then:

(ansible snippet that should work everywhere follows)
- name: do not use upstream dhparams file
  shell: rsync -ci /etc/ssh/moduli /usr/local/etc/proftpd/dhparams.pem
  register: rsync_result
  changed_when: 'rsync_result.stdout != ""'
)
Comment 4 Miroslav Lachman 2024-01-08 08:08:06 UTC
(In reply to florian.heigl from comment #3)
File in /etc/ssh/moduli has content in a very different format than /usr/local/etc/proftpd/dhparams.pem

etc/proftpd/dhparams.pem is provided from ProFTPD sources https://github.com/proftpd/proftpd/blob/master/contrib/mod_sftp/dhparams.pem last updated 2020-09-06

If this file should be updated then it should be updated by upstream (ProFTPD authors)

If we would like to provide a way for FreeBSD users to easily re-generate dhparams.pem I can provide a simple shell script for this task.

I am not a security expert but there are some discussions on the net that DH under 2048 should not be used and larger than 4096 is too expensive to generate without much added security so we can talk about what sizes we should generate and how many of each size?

Also there is a thing - many other network services can use dhparams in PEM format even if they use some built-in default (Apache, Postfix, Dovecot, Nginx, Lighttps etc.) so is the ProFTPD the right place for a script to generate dhparams.pem? Or should it be added to base system, generate dhparams.pem to /etc/ssl and let other services to use this file? 
(and should we advice users to re-generate this file from crontab?)
Comment 5 Miroslav Lachman 2024-01-08 08:13:14 UTC
Created attachment 247526 [details]
dhparams_gen.sh

Simple shell script to use "openssl dhparam" to re-generate dhparams.pem of similar structure as upstream file from ProFPTD sources.
It can be easily added to crontab and generate new file every month, year, or week...

Maybe we should not generate DH of sizes 1024 and 1536 at all.
Comment 6 dewayne 2024-02-10 01:31:51 UTC
(In reply to Miroslav Lachman from comment #5)
Thank-you.  Slightly modified for 2-6kb primes, changed weekly. And yes, they should be in the one place.  Aside how are elliptic curves accomodated? Also within the same file?