diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f087b42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.tar.gz filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1534ba5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.rpm +*.log +*spec-20* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d4450da --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +# Makefile for source rpm: sarg +# $Id: Makefile,v 1.1 2022/08/20 03:20:17 jpp Exp $ +NAME := sarg +SPECFILE = $(firstword $(wildcard *.spec)) + +define find-makefile-common +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +endef + +MAKEFILE_COMMON := $(shell $(find-makefile-common)) + +ifeq ($(MAKEFILE_COMMON),) +# attept a checkout +define checkout-makefile-common +test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 +endef + +MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) +endif + +include $(MAKEFILE_COMMON) diff --git a/README.md b/README.md index 2c34c20..dd618aa 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ # sarg -3rd Party (Maintained by Koozali) git repo for sarg smecontribs \ No newline at end of file +3rd Party (Maintained by Koozali) git repo for sarg smecontribs + +## Description + +
*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.* +*Once it has been checked, then this comment will be deleted* +
diff --git a/contriborbase b/contriborbase new file mode 100644 index 0000000..9b7fd51 --- /dev/null +++ b/contriborbase @@ -0,0 +1 @@ +contribs10 diff --git a/sarg-2.4.0.tar.gz b/sarg-2.4.0.tar.gz new file mode 100644 index 0000000..100ad7f --- /dev/null +++ b/sarg-2.4.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4ca0f41f6467673b4c65c6798b44a8886f08180c055eb11c37a96dfc28cb5c3 +size 1371812 diff --git a/sarg.spec b/sarg.spec new file mode 100644 index 0000000..bb7d31a --- /dev/null +++ b/sarg.spec @@ -0,0 +1,257 @@ +# $Id$ +# Authority: dag +# Upstream: Pedro L. Orso +# Upstream: +# Tag: rft + +Summary: Squid usage report generator per user/ip/name +Name: sarg +Version: 2.4.0 +Release: 1%{?dist} +License: GPL +Group: Applications/Internet +URL: http://sarg.sourceforge.net/sarg.php + +Packager: Dag Wieers +Vendor: Dag Apt Repository, http://dag.wieers.com/apt/ + +Source: http://downloads.sourceforge.net/project/sarg/sarg/sarg-%{version}/sarg-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root + +BuildRequires: gd-devel >= 1.8 +BuildRequires: openldap-devel +BuildRequires: perl +Requires: bash +Requires: gd >= 1.8 +Requires: squid +Obsoletes: sqmgrlog + +%description +Squid Analysis Report Generator is a tool that allows you to view "where" +your users are going to on the Internet. Sarg generate reports in html +showing users, IP addresses, bytes, sites and times. + +%prep +%setup + +%{__chmod} u+wx sarg-php/locale/ + +%{__perl} -pi.orig -e ' + s|^#(access_log) (.+)$|#$1 $2\n$1 %{_localstatedir}/log/squid/access.log|; + s|^#(output_dir) (.+)$|#$1 $2\n$1 %{_localstatedir}/www/sarg/ONE-SHOT|; + s|^#(resolve_ip) (.+)$|#$1 $2\n$1 yes|; + s|^#(show_successful_message) (.+)$|#$1 $2\n$1 no|; + s|^#(mail_utility) (.+)$|#$1 $2\n$1 mail|; + s|^#(external_css_file) (.+)$|#$1 $2\n$1 %{_localstatedir}/www/sarg/sarg.css|; + ' sarg.conf + +%{__cat} <<'EOF' >sarg.daily +#!/bin/bash + +# Get yesterday's date +YESTERDAY=$(date --date "1 day ago" +%d/%m/%Y) + +exec %{_bindir}/sarg \ + -o %{_localstatedir}/www/sarg/daily \ + -d $YESTERDAY &>/dev/null +exit 0 +EOF + +%{__cat} <<'EOF' >sarg.weekly +#!/bin/bash +LOG_FILES= +for FILE in /var/log/squid/access.log*; do + LOG_FILES="$LOG_FILES -l $FILE" +done + +# Get yesterday's date +YESTERDAY=$(date --date "1 day ago" +%d/%m/%Y) + +# Get one week ago date +WEEKAGO=$(date --date "7 days ago" +%d/%m/%Y) + +exec %{_bindir}/sarg \ + $LOG_FILES \ + -o %{_localstatedir}/www/sarg/weekly \ + -d $WEEKAGO-$YESTERDAY &>/dev/null +exit 0 +EOF + +%{__cat} <<'EOF' >sarg.monthly +#!/bin/bash +LOG_FILES= +for FILE in /var/log/squid/access.log*; do + LOG_FILES="$LOG_FILES -l $FILE" +done + +# Get yesterday's date +YESTERDAY=$(date --date "1 day ago" +%d/%m/%Y) + +# Get 1 month ago date +MONTHAGO=$(date --date "1 month ago" +%d/%m/%Y) + +exec %{_bindir}/sarg \ + $LOG_FILES \ + -o %{_localstatedir}/www/sarg/monthly \ + -d $MONTHAGO-$YESTERDAY &>/dev/null +exit 0 +EOF + +%{__cat} <sarg-index.html + + + + + Squid User's Access Report + + + + +
+

Squid User's Access Report

+ + + + + + + + + + + + + + + + + + + + + + + + +
DIRECTORYDESCRIPTION
ONE-SHOTOne shot reports
dailyDaily reports
weeklyWeekly reports
monthlyMonthly reports
+
+ + +EOF + +%{__cat} <sarg-http.conf +Alias /sarg %{_localstatedir}/www/sarg + + + DirectoryIndex index.html + Order deny,allow + Deny from all + Allow from 127.0.0.1 + Allow from ::1 + # Allow from your-workstation.com + +EOF + +%build +%configure \ + --bindir="%{_bindir}" \ + --sysconfdir="%{_sysconfdir}/sarg" \ + --mandir="%{_mandir}/man1" \ + --disable-rpath \ + --disable-sargphp \ + --enable-extraprotection \ + --enable-imagedir="%{_sysconfdir}/sarg/images" +%{__make} %{?_smp_mflags} CFLAGS="%{optflags}" + +%install +%{__rm} -rf %{buildroot} +%{__install} -Dp -m0755 sarg %{buildroot}%{_bindir}/sarg +%{__install} -Dp -m0644 sarg.conf %{buildroot}%{_sysconfdir}/sarg/sarg.conf +%{__install} -Dp -m0644 exclude_codes %{buildroot}%{_sysconfdir}/sarg/exclude_codes +%{__install} -Dp -m0644 sarg.1 %{buildroot}%{_mandir}/man1/sarg.1 + +%{__install} -Dp -m0644 sarg-http.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/sarg.conf +%{__install} -Dp -m0755 sarg.daily %{buildroot}%{_sysconfdir}/cron.daily/sarg +%{__install} -Dp -m0755 sarg.weekly %{buildroot}%{_sysconfdir}/cron.weekly/sarg +%{__install} -Dp -m0755 sarg.monthly %{buildroot}%{_sysconfdir}/cron.monthly/sarg +%{__install} -Dp -m0644 sarg-index.html %{buildroot}%{_localstatedir}/www/sarg/index.html +%{__install} -Dp -m0644 css.tpl %{buildroot}%{_localstatedir}/www/sarg/sarg.css + +%{__install} -d -m0755 %{buildroot}%{_localstatedir}/www/sarg/{ONE-SHOT,daily,weekly,monthly}/ +%{__cp} -av fonts/ images/ po/ %{buildroot}%{_sysconfdir}/sarg/ + +### Clean up buildroot +%{__rm} -rf %{buildroot}%{_sysconfdir}/sarg/po/.new + +%clean +%{__rm} -rf %{buildroot} + +%files +%defattr(-, root, root, 0755) +%doc ChangeLog CONTRIBUTORS COPYING DONATIONS README +%doc %{_mandir}/man1/sarg.1* +%dir %{_sysconfdir}/sarg/ +%config %{_sysconfdir}/sarg/exclude_codes +%config(noreplace) %{_sysconfdir}/sarg/sarg.conf +%config(noreplace) %{_sysconfdir}/httpd/conf.d/sarg.conf +%config %{_sysconfdir}/cron.daily/sarg +%config %{_sysconfdir}/cron.weekly/sarg +%config %{_sysconfdir}/cron.monthly/sarg +%{_bindir}/sarg +%{_localstatedir}/www/sarg/ +%{_sysconfdir}/sarg/fonts/ +%{_sysconfdir}/sarg/images/ +%{_sysconfdir}/sarg/po/ + +%changelog +* Thu Oct 09 2025 BogusDateBot +- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday, + by assuming the date is correct and changing the weekday. + +* Fri Aug 19 2022 Jean-Philippe Pialasse - 2.4.0-1 +- Updated to version 2.4.0. + +* Thu Oct 13 2011 Thiago Coutinho - 2.3.1-1 +- Updated to version 2.3.1. +- Fixed cron scripts to support RHEL/CentOS 6. + +* Tue Jun 22 2010 Christoph Maser - 2.3-2 +- Build with ldap support. + +* Tue Jun 22 2010 Christoph Maser - 2.3-1 +- Updated to version 2.3. + +* Thu Jun 19 2008 Dries Verachtert - 2.2.5-1 +- Updated to release 2.2.5. + +* Sat Aug 25 2007 Dag Wieers - 2.2.3.1-1 +- Updated to release 2.2.3.1. + +* Sat Aug 25 2007 Dag Wieers - 2.2.3-1 +- Updated to release 2.2.3. +- Fixed typo in monthly script. (Rabie Van der Merwe) + +* Mon May 29 2006 Dag Wieers - 2.2.1-1 +- Updated to release 2.2.1. +- Many changes to reflect release 2.2. (Bernard Lheureux) + +* Wed Aug 04 2004 Dag Wieers - 1.4.1-5 +- Fixed ugly bug in weekly and monthly cron entries. (Viktor Zoubkov) + +* Wed Jun 30 2004 Dag Wieers - 1.4.1-4 +- Fixed default mail_utility. (John Florian) + +* Sat Apr 10 2004 Dag Wieers - 1.4.1-3 +- Fixed problem with inline cron-scripts. (Luigi Iotti) + +* Tue Apr 06 2004 Dag Wieers - 1.4.1-2 +- Fixed missing directories in sarg. (William Hooper) + +* Wed Mar 17 2004 Dag Wieers - 1.4.1-1 +- Initial package. (using DAR)