LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 09-06-2019, 06:29 AM   #1
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: Debian
Posts: 900

Rep: Reputation: 290Reputation: 290Reputation: 290
Question Email notification customization for Debian unattended-upgrades package


Hi,

Is there a way to customize email notifications for Debian unattended-upgrades package, especially the subject part? I haven't found how so far...

Thanks in advance

Last edited by l0f4r0; 09-06-2019 at 08:11 AM. Reason: More specific
 
Old 09-06-2019, 07:33 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by l0f4r0 View Post
Hi,

Is there a way to customize unattended-upgrades email notifications, especially the subject part? I haven't found how so far...

Thanks in advance
Nobody can tell you, because you've included no useful information. unattended-upgrades email notifications tells us nothing. Are you talking about the OS? A package manager? A specific package? Self-hosted Wordpress? Try providing information and you might get an answer.

It's especially laughable that the first line of your signature asks people to Please be specific in your thread title & your question Try actually doing that in your posts.
 
Old 09-06-2019, 08:08 AM   #3
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: Debian
Posts: 900

Original Poster
Rep: Reputation: 290Reputation: 290Reputation: 290
^ You're right in substance but I'm not very sure there could be a possible confusion here as I can't see any reference to "OS, package manager, self-hosted Wordpress" named unattended-upgrades in the first results of any search engine...
Anyway, yes, let's be more specific: I'm talking in this thread about Debian/Ubuntu/... unattended-upgrades package

NB: I've edited my OP to be crystal-clear.

Last edited by l0f4r0; 09-06-2019 at 08:14 AM.
 
Old 09-06-2019, 08:28 AM   #4
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
unattended-upgrades uses apt-listchanges for the mail side if things

https://wiki.debian.org/UnattendedUp...pt-listchanges

skimming through manpage and peaking at some of its installed files Nothing is jumping out at me that would change the subject line.
but I have only skimmed,

you could try
Code:
apt -s source apt-listchanges
#----^ simulate you we only after the git repo
clone the git, and see if you can see where it picks up the subject from.

might be overkill
but sometimes that is the quickest way
 
1 members found this post helpful.
Old 09-10-2019, 09:04 PM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hello,
Quote:
Originally Posted by TenTenths View Post
Nobody can tell you, because you've included no useful information. unattended-upgrades email notifications tells us nothing. Are you talking about the OS? A package manager? A specific package? Self-hosted Wordpress? Try providing information and you might get an answer.
Really?! The other replys in this thread indicate otherwise. This is the Debian forum and the OP clearly stated that this was for Debian. unattended-upgrades is a well established Debian package that works with APT.

Quote:
Originally Posted by TenTenths View Post
It's especially laughable that the first line of your signature asks people to Please be specific in your thread title & your question Try actually doing that in your posts.
The OP was very specific.

Evo2.
 
Old 09-12-2019, 01:50 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Strangely, unattended-upgrades email notifications seems to yield plenty of relevant-looking results...
 
Old 09-12-2019, 02:02 AM   #7
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by ondoho View Post
Strangely, unattended-upgrades email notifications seems to yield plenty of relevant-looking results...
do any detail changes to the subject?
 
Old 11-11-2019, 04:42 PM   #8
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: Debian
Posts: 900

Original Poster
Rep: Reputation: 290Reputation: 290Reputation: 290
Quote:
Originally Posted by Firerat View Post
unattended-upgrades uses apt-listchanges for the mail side if things
https://wiki.debian.org/UnattendedUp...pt-listchanges
Not exactly. My perception is that apt-listchanges can be used in addition to unattended-upgrades so the user benefits from receiving last changelog/NEWS while upgrading his/her packages.
Both packages have their config files which specify the email configuration part.

Quote:
Originally Posted by Firerat View Post
you could try
Code:
apt -s source apt-listchanges
#----^ simulate you we only after the git repo
clone the git, and see if you can see where it picks up the subject from.
might be overkill
but sometimes that is the quickest way
Clever but the downside is that any modification in source code won't survive after an apt-listchanges binary update.
A config file would be soo much handy!

Quote:
Originally Posted by ondoho View Post
Strangely, unattended-upgrades email notifications seems to yield plenty of relevant-looking results...
I've seen nothing about email subject modification though...
 
Old 11-11-2019, 06:01 PM   #9
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by l0f4r0 View Post
Clever but the downside is that any modification in source code won't survive after an apt-listchanges binary update.
A config file would be soo much handy!
if there is a configuration option then yes, it would be handy

if not, create a new branch, make modifications.
when you get an update, rebase your modified branch against "upstream"

and if your modification adds this "new feature" cleanly you could submit a patch for upstream to adopt.

this is the way of FOSS
 
1 members found this post helpful.
Old 11-12-2019, 01:03 AM   #10
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
I had a look at the source - unattended-upgrade is a python script, and the subject seems hardcoded, with no option of overriding the format afaics.
Fairly trivial to change the script but yeah, it wouldn't survive updates.
Then again you could create a diff from the changes you made and apply it after every upgrade, I believe apt has hooks that allow that.
I wonder if it's worth the effort though.
 
1 members found this post helpful.
Old 11-12-2019, 01:46 AM   #11
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
indeed

in /etc/apt/apt.conf.d/

here is one I use to remove compress from logrotate ( I have transparent compression on zfs )
Code:
DPkg::Post-Invoke {"echo checking logrotate;for i in /etc/logrotate.d/*;do if grep -q compress ${i};then echo removing compress option from ${i};sed -i '/compress/d' ${i};fi;done";}
the bit that defines the subject

Code:
apt -s source unattended-upgrades 
Reading package lists... Done
NOTICE: 'unattended-upgrades' packaging is maintained in the 'Git' version control system at:
https://github.com/mvo5/unattended-upgrades.git
Please use:
git clone https://github.com/mvo5/unattended-upgrades.git
to retrieve the latest (possibly unreleased) updates to the package.
Code:
git clone https://github.com/mvo5/unattended-upgrades.git
cd unattended-upgrades
git grep -ni subject
outputs
Code:
COPYING:191:original licensor to copy, distribute or modify the Program subject to
debian/changelog:412:  * Use fully qualified domain name in email subject.
debian/changelog:985:  * Add [package on hold] to mail subject
debian/changelog:1417:    - add the result of the upgrade to email subject, thanks to Yann 'Ze'
debian/changelog:1509:  * use "mail -s" again to ensure there is a proper subject line when
test/test_mail.py:279:echo "Subject: $4" >> %(tmp)s/mail.txt
unattended-upgrade:1222:def _send_mail_using_mailx(from_address, to_address, subject, body):
unattended-upgrade:1232:        [MAIL_BINARY, "-r", from_address, "-s", subject, to_address],
unattended-upgrade:1240:def _send_mail_using_sendmail(from_address, to_address, subject, body):
unattended-upgrade:1244:    msg['Subject'] = subject
unattended-upgrade:1315:    subject = _(
unattended-upgrade:1358:        ret = _send_mail_using_sendmail(from_email, to_email, subject, body)
unattended-upgrade:1360:        ret = _send_mail_using_mailx(from_email, to_email, subject, body)
line 1315 looks promising

Code:
1315     subject = _(
1316         "{hold_flag}{reboot_flag} unattended-upgrades result for "
1317         "{machine}: {result}").format(
1318             hold_flag=hold_flag_str, reboot_flag=reboot_flag_str,
1319             machine=host(), result="SUCCESS" if res else "FAILURE").strip()
that is the bit that needs to be modified
what do you want the subject to be?
 
1 members found this post helpful.
Old 11-18-2019, 03:38 PM   #12
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: Debian
Posts: 900

Original Poster
Rep: Reputation: 290Reputation: 290Reputation: 290
Thank you very much Firerat and ondoho for your valuable answers. Nice thorough help
I will keep in mind your tip about apt source -s to identify the latest source code location!
 
  


Reply

Tags
email, unattended-upgrades



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] unattended-upgrades? circus78 CentOS 5 03-07-2016 03:30 PM
[SOLVED] Unattended upgrades run times cmccullo Linux - Server 2 05-29-2014 09:59 AM
How to configure unattended-upgrades to upgrade updates? catkin Debian 3 02-25-2014 04:08 AM
[SOLVED] Unattended upgrades: how to automate a few each day? catkin Debian 10 01-19-2014 04:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 03:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration