Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 549852 - net-misc/rsync-3.1.1 logrotate script overrides user-set values
Summary: net-misc/rsync-3.1.1 logrotate script overrides user-set values
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-18 20:33 UTC by Dimitrios Semitsoglou-Tsiapos
Modified: 2017-04-10 13:52 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
net-misc-rsync-logrotate.diff (net-misc-rsync-logrotate.diff,945 bytes, patch)
2017-04-07 21:17 UTC, christos kotsis
Details | Diff
net-misc-rsync-logrotate.diff (rsyncd.logrotate.diff,245 bytes, patch)
2017-04-08 22:18 UTC, christos kotsis
Details | Diff
rsync-3.1.1.ebuild.patch (rsync-3.1.1.ebuild.patch,335 bytes, patch)
2017-04-10 13:18 UTC, christos kotsis
Details | Diff
rsyncd.logrotate.patch (rsyncd.logrotate.patch,335 bytes, patch)
2017-04-10 13:52 UTC, christos kotsis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitrios Semitsoglou-Tsiapos 2015-05-18 20:33:59 UTC
The logrotate script that ships with rsync overrides the following variables which a user may want to set globally in /etc/logrotate.conf:

compress    -- Annoying. `zgrep`, for example, does not support `-r`.
maxage 365  -- Dangerous. This dictates when logs are deleted.
rotate 7    -- Same as above.
size=+1024k -- Same as above.

A few more points:

* Global configuration is important for predictability and scripting.

* If size on the filesystem is a concern, the user can:
  * set e-mail warnings
  * set filesize-based rotation limits
  * enable compression only for logs which he or she expects to grow

* Logs are a security measure.

Reproducible: Always
Comment 1 christos kotsis 2017-04-07 21:17:18 UTC
Created attachment 469434 [details, diff]
net-misc-rsync-logrotate.diff
Comment 2 christos kotsis 2017-04-08 22:18:49 UTC
Created attachment 469516 [details, diff]
net-misc-rsync-logrotate.diff

Removed the following variables from the file, for the case where rsyncd.logrotate overrides those from logrotate.conf.

- compress    
- maxage 365  
- rotate 7    
- size=+1024k 


A more general, however unneeded solution, is to use conditions on the ebuild. I post it here, in case someone finds other variables being overridden from the above file, now or in a future version.

--- net-misc-rsync-logrotate	2017-04-08 02:31:45.255640339 +0300
+++ net-misc-rsync-logrotate-new	2017-04-08 17:25:04.781719466 +0300
@@ -50,9 +50,32 @@
 	dodoc NEWS OLDNEWS README TODO tech_report.tex
 	insinto /etc
 	newins "${FILESDIR}"/rsyncd.conf-3.0.9-r1 rsyncd.conf
-
-	insinto /etc/logrotate.d
-	newins "${FILESDIR}"/rsyncd.logrotate rsyncd
+	
+	# Adding conditions for rsyncd protection
+	if [ ! -e "/etc/logrotate.conf" ]	# Checking for longrotate.conf if it exists
+	then
+			insinto /etc/logrotate.d
+			newins "${FILESDIR}"/rsyncd.logrotate rsyncd
+	else	# deleting overriding lines, then proceed
+		sed -i '/compress/d' "${FILESDIR}"/rsyncd.logrotate
+		sed -i '/maxage 365/d' "${FILESDIR}"/rsyncd.logrotate      
+		sed -i '/rotate 7/d' "${FILESDIR}"/rsyncd.logrotate      
+		sed -i '/size=+1024k/d' "${FILESDIR}"/rsyncd.logrotate
+		insinto /etc/logrotate.d
+		newins "${FILESDIR}"/rsyncd.logrotate rsyncd
+		
+		# Alternativly
+		
+		# insinto /etc/logrotate.d
+		# newins "${FILESDIR}"/rsyncd.logrotate rsyncd 
+
+		# local rsy
+		# rsy="/etc/logrotate.d/rsyncd"
+		# sed -i '/compress/d' "$rsy"
+		# sed -i '/maxage 365/d' $rsy"     
+		# sed -i '/rotate 7/d' "$rsy"     
+		# sed -i '/size=+1024k/d' "$rsy"  
+	fi
 
 	insinto /etc/xinetd.d
 	newins "${FILESDIR}"/rsyncd.xinetd-3.0.9-r1 rsyncd
@@ -86,4 +109,4 @@
 		einfo "You maybe have to update the certificates configured in"
 		einfo "${EROOT}/etc/stunnel/rsync.conf"
 	fi
-}
+}
\ No newline at end of file
Comment 3 christos kotsis 2017-04-10 13:18:00 UTC
Created attachment 469574 [details, diff]
rsync-3.1.1.ebuild.patch
Comment 4 christos kotsis 2017-04-10 13:52:45 UTC
Created attachment 469586 [details, diff]
rsyncd.logrotate.patch

Applies to files/rsyncd.logrotate