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
Created attachment 469434 [details, diff] net-misc-rsync-logrotate.diff
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
Created attachment 469574 [details, diff] rsync-3.1.1.ebuild.patch
Created attachment 469586 [details, diff] rsyncd.logrotate.patch Applies to files/rsyncd.logrotate