Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logrotate certbot logs: reduce retention #1924

Open
juju4 opened this issue Nov 6, 2021 · 5 comments
Open

logrotate certbot logs: reduce retention #1924

juju4 opened this issue Nov 6, 2021 · 5 comments
Labels
feature New feature or request

Comments

@juju4
Copy link

juju4 commented Nov 6, 2021

Describe the bug

Certbot/letsencrypt have by default a very high level of log retention which results in hundreds of logs file in /var/snap/nextcloud/current/certs/certbot/logs/.
Especially more for a snap, it is unlikely it is used.
A better default IMHO would be something like 30 days if rotating daily.

see also
https://community.letsencrypt.org/t/log-rotation-configuration/108596
certbot/certbot#4907

To Reproduce

Steps to reproduce the behavior:

  1. Install nextcloud snap
  2. Let it run for more than 30 days
  3. See number of accumulated log files.

Expected behavior

A configurable option would be nice but at least a lesser number as I would expect most install don't need to keep a thousand log history

OS/snapd/snap version

# snap list nextcloud
Name       Version      Rev    Tracking       Publisher   Notes
nextcloud  22.2.0snap2  28586  latest/stable  nextcloud✓  -
# snap version
snap    2.52.1
snapd   2.52.1
series  16
ubuntu  18.04
kernel  4.15.0-161-generic

@kyrofa
Copy link
Member

kyrofa commented Nov 6, 2021

Thank you for this. We have a logrotate config in the snap that covers pretty much every log except certbot's! Shouldn't be hard to include it.

@r4co0n
Copy link
Contributor

r4co0n commented Nov 10, 2021

Please note that --max-log-backups as referred to in OPs' links seems to not work as expected: certbot/certbot#5575 . Also, GitHub refused to dig up any mention of this string when searching the certbot repo. So, as @kyrofa said, we should use logrotate to manage certbot logs, compressing and finally deleting the files.

What would be a good retention policy for certbot logs - When should they be compressed and when should they be discarded?

Answering this from my point of view: Let's-Encrypt-certificates live for 90 days and you might want to inspect the logs of the previous certificate, so 90*2+10=190 days would be a sane buffer, adding 10 days because 180 days and 6 months might be a different thing, and then add some extra days. (I reckon people will remember that their certificate is renewed every quarter of the year here,)

@kyrofa
Copy link
Member

kyrofa commented Nov 10, 2021

Yeah we just need to disable certbot's rotation. @r4co0n what do you think, is this worth doing if we're trying to replace certbot? Or is that a ways off, yet?

@r4co0n
Copy link
Contributor

r4co0n commented Nov 10, 2021

@kyrofa, the biggest concern with migration is keeping everything working for all the folks that currently use certbot, and for those that have provided their own certificates. As far as I could discern, we never log what people last chose when setting up encryption, or am I mistaken? It's prudent to know if the current certificate is self-signed (generated by us), provided by letsencrypt or provided by the admin.

--max-log-backups is still available, I was mistaken, Searching for max_log_backups instead of the apparently present string --max-log-backups helped, GitHub search decided to returning nothing, I found the flag here. This should be set to 0 before creating a logrotate config.

@kyrofa
Copy link
Member

kyrofa commented Nov 10, 2021

we never log what people last chose when setting up encryption, or am I mistaken? It's prudent to know if the current certificate is self-signed (generated by us), provided by letsencrypt or provided by the admin.

@r4co0n I have thoughts on that, but in the interest of not pulling this issue off-topic, do you mind making a comment on #1902 so we can discuss?

This should be set to 0 before creating a logrotate config.

Agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants