diff options
author | Deposite Pirate | 2018-09-16 23:29:24 +0200 |
---|---|---|
committer | Deposite Pirate | 2018-09-16 23:29:24 +0200 |
commit | 569e598d38adb1918d127ee31af1cd332b072dcf (patch) | |
tree | 23a7204866591100db57f3acac53cd410ea8d3e4 |
-rw-r--r-- | knock/knock-el6-compilation-error.patch | 12 | ||||
-rw-r--r-- | knock/knock.spec | 98 | ||||
-rw-r--r-- | knock/knockd.logrotate | 5 | ||||
-rw-r--r-- | knock/knockd.service | 9 | ||||
-rw-r--r-- | rspamd/rspamd-fedora.patch | 26 | ||||
-rw-r--r-- | rspamd/rspamd-systemd.patch | 15 | ||||
-rw-r--r-- | rspamd/rspamd.logrotate | 11 | ||||
-rw-r--r-- | rspamd/rspamd.spec | 185 | ||||
-rw-r--r-- | rspamd/rspamd.tmpfiles | 1 | ||||
-rw-r--r-- | sshguard/sshguard-journalctl | 4 | ||||
-rw-r--r-- | sshguard/sshguard.service | 12 | ||||
-rw-r--r-- | sshguard/sshguard.spec | 116 | ||||
-rw-r--r-- | sshguard/sysconfig.sshguard | 9 | ||||
-rw-r--r-- | uhub/0001-Install-man-pages.patch | 206 | ||||
-rw-r--r-- | uhub/0002-Add-a-default-MOTD-file-which-was-missing.patch | 21 | ||||
-rw-r--r-- | uhub/0003-Most-unices-including-most-Linux-distro-have-logrota.patch | 78 | ||||
-rw-r--r-- | uhub/0004-Conditionally-install-systemd-support-files.patch | 65 | ||||
-rw-r--r-- | uhub/0005-Also-install-users.conf.patch | 26 | ||||
-rw-r--r-- | uhub/uhub.spec | 148 |
19 files changed, 1047 insertions, 0 deletions
diff --git a/knock/knock-el6-compilation-error.patch b/knock/knock-el6-compilation-error.patch new file mode 100644 index 0000000..3359ec1 --- /dev/null +++ b/knock/knock-el6-compilation-error.patch @@ -0,0 +1,12 @@ +diff --git a/src/list.h b/src/list.h +index 1453b66..6874454 100644 +--- a/src/list.h ++++ b/src/list.h +@@ -21,6 +21,7 @@ + #ifndef _PAC_LIST_H + #define _PAC_LIST_H + ++#include <limits.h> + #define FREELIST(p) { list_free(p); p = NULL; } + + /* your average linked list */ diff --git a/knock/knock.spec b/knock/knock.spec new file mode 100644 index 0000000..e8f4e33 --- /dev/null +++ b/knock/knock.spec @@ -0,0 +1,98 @@ +# $Id$ +# Authority: dag +# Upstream: Judd Vinet <jvinet$zeroflux,org> + + +%{!?dtag:%define _with_libpcapdevel 1} +%{?el5:%define _with_libpcapdevel 1} +%{?el6:%define _with_libpcapdevel 1} +%{?fc6:%define _with_libpcapdevel 1} + +Summary: Port-knocking server +Name: knock +Version: 0.7 +Release: 3%{?dist} +License: GPL +Group: Applications/Internet +URL: http://www.zeroflux.org/knock/ + +Packager: Dag Wieers <dag@wieers.com> +Vendor: Dag Apt Repository, http://dag.wieers.com/apt/ + +Source0: http://www.zeroflux.org/knock/files/knock-%{version}.tar.gz +Source1: knockd.service +Source2: knockd.logrotate +%{?el6:Patch0: knock-el6-compilation-error.patch} +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root + +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +BuildRequires: libpcap systemd +%{?_with_libpcapdevel:BuildRequires:libpcap-devel} + +%description +knockd is a port-knock server. It listens to all traffic on an ethernet +interface, looking for special "knock" sequences of port-hits. A client +makes these port-hits by sending a TCP (or UDP) packet to a port on the +server. This port need not be open -- since knockd listens at the link- +layer level, it sees all traffic even if it's destined for a closed port. + +When the server detects a specific sequence of port-hits, it runs a +command defined in its configuration file. This can be used to open up +holes in a firewall for quick access. + +%prep +%setup +%{?el6:%patch0 -p1} + +%build +%configure +%{__make} %{?_smp_mflags} + +%install +%{__rm} -rf %{buildroot} +%{__make} install DESTDIR="%{buildroot}" +install -m 0755 -d %{buildroot}/%{_unitdir}/ +install -m 0644 %{_sourcedir}/knockd.service %{buildroot}/%{_unitdir}/ +install -m 0755 -d %{buildroot}/%{_sysconfdir}/logrotate.d +install -m 0644 %{_sourcedir}/knockd.logrotate %{buildroot}/%{_sysconfdir}/logrotate.d/knockd + +%clean +%{__rm} -rf %{buildroot} + +%files +%defattr(-, root, root, 0755) +%doc ChangeLog COPYING TODO +%doc %{_mandir}/man?/* +%config(noreplace) %{_sysconfdir}/knockd.conf +%{_sysconfdir}/logrotate.d/knockd +%{_unitdir}/knockd.service +%{_bindir}/knock +%{_sbindir}/knockd + +%post +%systemd_post knockd.service + +%preun +%systemd_preun knockd.service + +%postun +%systemd_postun_with_restart knockd.service + +%changelog +* Mon Dec 08 2014 Christoph J. Thompson <cjsthompson@gmail.com> +- Updated to release 0.7. +- Add systemd and logrotate support + +* Thu Jan 03 2013 Jan Horacek <jahor@jhr.cz> - 0.5-3 +- patch for building on EL6 + +* Fri Dec 16 2011 Jan Horacek <jahor@jhr.cz> - 0.5-2 +- EL6 has libpcap-devel + +* Tue Sep 26 2006 Dries Verachtert <dries@ulyssis.org> - 0.5-1 +- Updated to release 0.5. + +* Thu Apr 15 2004 Dag Wieers <dag@wieers.com> - 0.1-1 +- Initial package. (using DAR) diff --git a/knock/knockd.logrotate b/knock/knockd.logrotate new file mode 100644 index 0000000..11e7a4e --- /dev/null +++ b/knock/knockd.logrotate @@ -0,0 +1,5 @@ +/var/log/knockd.log { + missingok + notifempty + delaycompress +} diff --git a/knock/knockd.service b/knock/knockd.service new file mode 100644 index 0000000..8efb05d --- /dev/null +++ b/knock/knockd.service @@ -0,0 +1,9 @@ +[Unit] +Description=Port-Knocking Daemon +After=network.target + +[Service] +ExecStart=/usr/sbin/knockd + +[Install] +WantedBy=multi-user.target diff --git a/rspamd/rspamd-fedora.patch b/rspamd/rspamd-fedora.patch new file mode 100644 index 0000000..1e7d023 --- /dev/null +++ b/rspamd/rspamd-fedora.patch @@ -0,0 +1,26 @@ +diff -ru ./src/lua/lua_common.h ../rspamd-0.8.0.p/src/lua/lua_common.h +--- ./src/lua/lua_common.h 2014-12-17 16:51:42.000000000 +0200 ++++ ../rspamd-0.8.0.p/src/lua/lua_common.h 2015-01-09 14:25:09.696650229 +0200 +@@ -25,21 +25,6 @@ + lua_pushnumber (L, val); \ + lua_settable (L, -3); + +-#if LUA_VERSION_NUM > 501 +-static inline void +-luaL_register (lua_State *L, const gchar *name, const struct luaL_reg *methods) +-{ +- if (name != NULL) { +- lua_newtable (L); +- } +- luaL_setfuncs (L, methods, 0); +- if (name != NULL) { +- lua_pushvalue (L, -1); +- lua_setglobal (L, name); +- } +-} +-#endif +- + /* Interface definitions */ + #define LUA_FUNCTION_DEF(class, name) static gint lua_ ## class ## _ ## name ( \ + lua_State * L) + diff --git a/rspamd/rspamd-systemd.patch b/rspamd/rspamd-systemd.patch new file mode 100644 index 0000000..a779603 --- /dev/null +++ b/rspamd/rspamd-systemd.patch @@ -0,0 +1,15 @@ +diff -r -u -N rspamd-0.8.0/rspamd.service rspamd-0.8.0-systemd/rspamd.service +--- rspamd-0.8.0/rspamd.service 2014-04-21 13:31:50.000000000 +0200 ++++ rspamd-0.8.0-systemd/rspamd.service 2015-01-15 05:03:57.519561226 +0100 +@@ -5,10 +5,7 @@ + Type=simple + # Replace Pre/Post with RuntimeDirectory once it is available + PermissionsStartOnly=true +-ExecStartPre=/bin/mkdir -m700 -p /run/rspamd +-ExecStartPre=/bin/chown _rspamd:_rspamd /run/rspamd + ExecStart=/usr/bin/rspamd -f -c /etc/rspamd/rspamd.conf + ExecReload=/bin/kill -HUP $MAINPID +-ExecStopPost=/bin/rm -r /run/rspamd + WorkingDirectory=/var/lib/rspamd +-User=_rspamd ++User=rspamd diff --git a/rspamd/rspamd.logrotate b/rspamd/rspamd.logrotate new file mode 100644 index 0000000..3a155f8 --- /dev/null +++ b/rspamd/rspamd.logrotate @@ -0,0 +1,11 @@ +/var/log/rspamd/*log { + daily + rotate 10 + missingok + notifempty + compress + sharedscripts + postrotate + [ ! -f /run/rspamd.pid ] || kill -USR1 `cat /run/rspamd.pid` + endscript +} diff --git a/rspamd/rspamd.spec b/rspamd/rspamd.spec new file mode 100644 index 0000000..4218914 --- /dev/null +++ b/rspamd/rspamd.spec @@ -0,0 +1,185 @@ +%define rspamd_user rspamd +%define rspamd_group %{rspamd_user} +%define rspamd_homedir %{_localstatedir}/lib/rspamd +%define rspamd_logdir %{_localstatedir}/log/rspamd +%define rspamd_confdir %{_sysconfdir}/rspamd +%define rspamd_pluginsdir %{_datadir}/rspamd +%define rspamd_wwwdir %{_datadir}/rspamd/www + +Name: rspamd +Version: 0.8.0 +Release: 1%{?dist} +Summary: Rapid spam filtering system +Group: System Environment/Daemons +License: BSD +URL: https://rspamd.com +Packager: Christoph J. Thompson <cjsthompson@gmail.com> +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} +BuildRequires: cmake,glib2-devel,gmime-devel,libevent-devel,openssl-devel,lua-devel,pcre-devel +Requires: lua, logrotate +Requires(pre): shadow-utils +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +Source0: https://rspamd.com/downloads/%{name}-%{version}.tar.xz +Source1: %{name}.logrotate +Source2: %{name}.tmpfiles +Patch0: %{name}-fedora.patch +Patch1: %{name}-systemd.patch + +%description +Rspamd is a rapid, modular and lightweight spam filter. It is designed to work +with big amount of mail and can be easily extended with own filters written in +lua. + +%prep +%autosetup -p1 + +%build +%{__cmake} \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DCONFDIR=%{rspamd_confdir} \ + -DDSYSTEMDIR=%{_unitdir} \ + -DMANDIR=%{_mandir} \ + -DDBDIR=%{rspamd_homedir} \ + -DRUNDIR=/run/rspamd \ + -DLOGDIR=%{rspamd_logdir} \ + -DEXAMPLESDIR=%{_datadir}/examples/rspamd \ + -DPLUGINSDIR=%{rspamd_pluginsdir} \ + -DLIBDIR=%{_libdir} \ + -DINCLUDEDIR=%{_includedir} \ + -DNO_SHARED=ON \ + -DDEBIAN_BUILD=1 \ + -DRSPAMD_GROUP=%{rspamd_group} \ + -DRSPAMD_USER=%{rspamd_user} +%{__make} %{?_smp_mflags} + +%install +%{__make} install DESTDIR=%{buildroot} INSTALLDIRS=vendor +%{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} +%{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/%{name}.conf +%{__install} -d -p -m 0755 %{buildroot}%{rspamd_logdir} +%{__install} -d -p -m 0755 %{buildroot}%{rspamd_homedir} +cat >> %{buildroot}%{_tmpfilesdir}/%{name}.conf <<EOF +d %{rspamd_homedir} 0750 rspamd rspamd +d %{rspamd_logdir} 0750 rspamd rspamd +EOF + +%clean +rm -rf %{buildroot} + +%pre +%{_sbindir}/groupadd -r %{rspamd_group} 2>/dev/null || : +%{_sbindir}/useradd -r -g %{rspamd_group} -c "Rspamd user" -s /bin/nologin -d %{rspamd_homedir} %{rspamd_user} 2>/dev/null || : + +%post +%tmpfiles_create %{name}.conf +%systemd_post %{name}.service + +%preun +%systemd_preun %{name}.service + +%postun +%systemd_postun_with_restart %{name}.service + +%files +%defattr(-,root,root,0755) +%{_bindir}/rspamd +%{_bindir}/rspamc +%{_mandir}/man8/%{name}.* +%{_mandir}/man1/rspamc.* +%{_unitdir}/%{name}.service +%{_unitdir}/%{name}.socket +%{_tmpfilesdir}/%{name}.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%dir %{rspamd_confdir} +%dir %{rspamd_confdir}/lua +%dir %{rspamd_confdir}/lua/regexp +%config(noreplace) %{rspamd_confdir}/2tld.inc +%config(noreplace) %{rspamd_confdir}/composites.conf +%config(noreplace) %{rspamd_confdir}/logging.conf +%config(noreplace) %{rspamd_confdir}/metrics.conf +%config(noreplace) %{rspamd_confdir}/modules.conf +%config(noreplace) %{rspamd_confdir}/options.conf +%config(noreplace) %{rspamd_confdir}/%{name}.conf +%config(noreplace) %{rspamd_confdir}/statistic.conf +%config(noreplace) %{rspamd_confdir}/surbl-whitelist.inc +%config(noreplace) %{rspamd_confdir}/workers.conf +%{rspamd_confdir}/lua/rspamd.lua +%{rspamd_confdir}/lua/hfilter.lua +%{rspamd_confdir}/lua/rspamd.classifiers.lua +%{rspamd_confdir}/lua/regexp/drugs.lua +%{rspamd_confdir}/lua/regexp/fraud.lua +%{rspamd_confdir}/lua/regexp/headers.lua +%{rspamd_confdir}/lua/regexp/lotto.lua +%dir %{rspamd_pluginsdir} +%dir %{rspamd_pluginsdir}/lua +%{rspamd_pluginsdir}/lua/emails.lua +%{rspamd_pluginsdir}/lua/forged_recipients.lua +%{rspamd_pluginsdir}/lua/ip_score.lua +%{rspamd_pluginsdir}/lua/maillist.lua +%{rspamd_pluginsdir}/lua/multimap.lua +%{rspamd_pluginsdir}/lua/once_received.lua +%{rspamd_pluginsdir}/lua/phishing.lua +%{rspamd_pluginsdir}/lua/ratelimit.lua +%{rspamd_pluginsdir}/lua/rbl.lua +%{rspamd_pluginsdir}/lua/settings.lua +%{rspamd_pluginsdir}/lua/trie.lua +#%{rspamd_pluginsdir}/lua/whitelist.lua +%dir %{rspamd_wwwdir} +%{rspamd_wwwdir}/* +%dir %{rspamd_logdir} +%dir %{rspamd_homedir} + +%changelog +* Fri Jan 09 2015 Christoph J. Thompson <cjsthompson@gmail.com> 0.8.0-1 +- Update to 0.8.0 +- "Port" to fedora 21 + +* Mon Nov 24 2014 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.7.6-1 +- Update to 0.7.6 + +* Mon Nov 17 2014 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.7.5-1 +- Update to 0.7.5 + +* Sat Nov 08 2014 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.7.4-1 +- Update to 0.7.4 + +* Mon Nov 03 2014 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.7.3-1 +- Update to 0.7.3 + +* Wed Oct 15 2014 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.7.2-1 +- Update to 0.7.2 + +* Tue Sep 30 2014 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.7.1-1 +- Update to 0.7.1 + +* Mon Sep 1 2014 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.7.0-1 +- Update to 0.7.0 + +* Fri Jan 10 2014 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.6.7-1 +- Update to 0.6.7. + +* Fri Dec 27 2013 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.6.6-1 +- Update to 0.6.6. + +* Fri Dec 20 2013 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.6.5-1 +- Update to 0.6.5. + +* Wed Dec 18 2013 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.6.4-1 +- Update to 0.6.4. + +* Tue Dec 10 2013 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.6.3-1 +- Update to 0.6.3. + +* Fri Dec 06 2013 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.6.2-1 +- Update to 0.6.2. + +* Tue Nov 19 2013 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.6.0-1 +- Update to 0.6.0. + +* Mon Jun 10 2013 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.5.6-1 +- Update to 0.5.6. + +* Sat May 25 2013 Vsevolod Stakhov <vsevolod-at-highsecure.ru> 0.5.5-1 +- Initial spec version. diff --git a/rspamd/rspamd.tmpfiles b/rspamd/rspamd.tmpfiles new file mode 100644 index 0000000..ea1d1b1 --- /dev/null +++ b/rspamd/rspamd.tmpfiles @@ -0,0 +1 @@ +d /run/rspamd 0700 rspamd rspamd diff --git a/sshguard/sshguard-journalctl b/sshguard/sshguard-journalctl new file mode 100644 index 0000000..8a800ff --- /dev/null +++ b/sshguard/sshguard-journalctl @@ -0,0 +1,4 @@ +#!/bin/sh +SSHGUARD_OPTS=$1 +shift +LANG=C /usr/bin/journalctl -afb -p info -n1 -o cat "$@" | /usr/bin/sshguard -l- $SSHGUARD_OPTS diff --git a/sshguard/sshguard.service b/sshguard/sshguard.service new file mode 100644 index 0000000..370f085 --- /dev/null +++ b/sshguard/sshguard.service @@ -0,0 +1,12 @@ +[Unit] +Description=Protect hosts from brute force attacks against ssh +After=syslog.target network.target auditd.service +ConditionPathExists=/etc/sysconfig/sshguard + +[Service] +PIDFile=/var/run/sshguard.pid +Exec=/usr/libexec/sshguard.init start @ +StandardOutput=syslog + +[Install] +WantedBy=multi-user.target diff --git a/sshguard/sshguard.spec b/sshguard/sshguard.spec new file mode 100644 index 0000000..bf9b1e2 --- /dev/null +++ b/sshguard/sshguard.spec @@ -0,0 +1,116 @@ +Name: sshguard +Version: 1.5 +Release: 6%{?dist} +# The entire source code is BSD +# except src/parser/* witch is GPLv2+ +# except src/hash_32a.c witch is Public Domain +License: BSD and GPLv2+ and Public Domain +Group: Applications/Internet +Summary: Network daemon log monitor +Url: http://sshguard.sourceforge.net +Packager: Christoph J. Thompson <cjsthompson@gmail.com> +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} +Source0: http://downloads.sourceforge.net/sshguard/%{name}-%{version}.tar.bz2 +Source1: sshguard.service +Source2: sysconfig.sshguard +Requires: iptables +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + +%description +Sshguard monitors network daemon logs. It detects attacks and blocks the +attacker's address with a firewall rule. It supports many services out of +the box, recognizes several log formats, and can operate many firewall +systems. + +%prep +%autosetup + +%build +%configure --with-firewall=iptables +%{__make} %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" + +%install +make install-strip DESTDIR=$RPM_BUILD_ROOT +install -D -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/sshguard +install -D -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{_unitdir}/sshguard.service + +%clean +rm -rf %{buildroot} + +%post +%systemd_post %{name}.service + +%preun +%systemd_preun %{name}.service + +%postun +%systemd_postun_with_restart %{name}.service + +%files +%defattr(-,root,root,0755) +%doc Changes README +%config(noreplace) %{_sysconfdir}/sysconfig/sshguard +%{_sbindir}/%{name} +%{_mandir}/man8/%{name}.8* +%{_unitdir}/sshguard.service + +%changelog +* Sun Dec 21 2014 Christoph J. Thompson <cjsthompson@gmail.com> 1.5-6.fc21 +- Update the spec for fedora 21 + +* Wed Oct 15 2014 Ryan Schlesinger ryan@aceofsales.com 1.5-5.amzn1 +- Removed Log Validation as using it with the Log Sucker is discouraged + +* Tue Aug 16 2012 Sebastien Caps sebastien.caps@guardis.com 1.5-4.fc16 +- Fix multi licensed files + +* Tue Aug 16 2012 Sebastien Caps sebastien.caps@guardis.com 1.5-3.fc16 +- Added systemd script, +- correct license. + +* Tue Aug 14 2012 Sebastien Caps sebastien.caps@guardis.com 1.5-2.fc16 +- Fix some spec issue. + +* Tue Aug 14 2012 Sebastien Caps sebastien.caps@guardis.com 1.5-1.fc16 +- Rebuilt for Red +Hat based distro. + +* Wed Mar 02 2011 Tomasz Pawel Gajc <tpg@mandriva.org> 1.5-1mdv2011.0 ++ Revision: 641382 +- update to new version 1.5 + +* Sat Sep 26 2009 Tomasz Pawel Gajc <tpg@mandriva.org> 1.4-1mdv2010.0 ++ Revision: 449478 +- update to new version 1.4 + +* Sun Sep 20 2009 Thierry Vignaud <tv@mandriva.org> 1.3-2mdv2010.0 ++ Revision: 445231 +- rebuild + +* Sun Oct 12 2008 Tomasz Pawel Gajc <tpg@mandriva.org> 1.3-1mdv2009.1 ++ Revision: 293010 +- update to new version 1.3 +- update to new version 1.3 +- update to new version 1.2 + +* Wed Jan 02 2008 Olivier Blin <oblin@mandriva.com> 1.1-0.beta3.1mdv2009.0 ++ Revision: 140851 +- restore BuildRoot + ++ Thierry Vignaud <tv@mandriva.org> +- kill re-definition of %%buildroot on Pixel's request + +* Fri Oct 26 2007 Tomasz Pawel Gajc <tpg@mandriva.org> 1.1-0.beta3.1mdv2008.1 ++ Revision: 102372 +- new version + +* Tue May 22 2007 Tomasz Pawel Gajc <tpg@mandriva.org> 1.0-0.beta2.2mdv2008.0 ++ Revision: 29621 +- fix group + +* Tue May 22 2007 Tomasz Pawel Gajc <tpg@mandriva.org> 1.0-0.beta2.1mdv2008.0 ++ Revision: 29613 +- Import sshguard + diff --git a/sshguard/sysconfig.sshguard b/sshguard/sysconfig.sshguard new file mode 100644 index 0000000..bab19e2 --- /dev/null +++ b/sshguard/sysconfig.sshguard @@ -0,0 +1,9 @@ +# Block IP after how many attempt +SAFETYTRESH=40 +# +# Define your sshguard options separate by a space +# Sample line to protect dovecot and ssh: +#OPTIONS="-l /var/log/secure -l /var/log/maillog" +# +# Here we listen default ssh log file. +OPTIONS="-l /var/log/secure" diff --git a/uhub/0001-Install-man-pages.patch b/uhub/0001-Install-man-pages.patch new file mode 100644 index 0000000..04bdf66 --- /dev/null +++ b/uhub/0001-Install-man-pages.patch @@ -0,0 +1,206 @@ +From ecefce8b7466e4866a47587df4a1364f4f250c5e Mon Sep 17 00:00:00 2001 +From: "Christoph J. Thompson" <cjsthompson@gmail.com> +Date: Sat, 13 Dec 2014 22:08:00 +0100 +Subject: [PATCH 1/5] * Install man pages * Support multilib distros such as + fedora/slackware + + modified: CMakeLists.txt + renamed: doc/plugins.conf -> doc/plugins.conf.in +--- + CMakeLists.txt | 14 ++++++++--- + doc/plugins.conf | 72 ----------------------------------------------------- + doc/plugins.conf.in | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 82 insertions(+), 76 deletions(-) + delete mode 100644 doc/plugins.conf + create mode 100644 doc/plugins.conf.in + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2f3941d..80a1a85 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,6 +22,12 @@ option(USE_OPENSSL "Use OpenSSL's SSL support" ON ) + option(SYSTEMD_SUPPORT "Enable systemd notify and journal logging" OFF) + option(ADC_STRESS "Enable the stress tester client" OFF) + ++set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") ++set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") ++set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") ++ ++configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/plugins.conf.in plugins.conf @ONLY) ++ + find_package(Git) + find_package(Sqlite3) + +@@ -240,9 +246,9 @@ if (LOWLEVEL_DEBUG) + endif() + + if (UNIX) +- install( TARGETS uhub uhub-passwd RUNTIME DESTINATION bin ) +- install( TARGETS mod_example mod_welcome mod_logging mod_auth_simple mod_auth_sqlite mod_chat_history mod_chat_history_sqlite mod_chat_only mod_topic mod_no_guest_downloads DESTINATION /usr/lib/uhub/ OPTIONAL ) +- install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/doc/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub OPTIONAL ) ++ install( TARGETS uhub uhub-passwd RUNTIME DESTINATION ${INSTALL_BIN_DIR} ) ++ install( TARGETS mod_example mod_welcome mod_logging mod_auth_simple mod_auth_sqlite mod_chat_history mod_chat_history_sqlite mod_chat_only mod_topic mod_no_guest_downloads DESTINATION ${INSTALL_LIB_DIR}/uhub/ OPTIONAL ) ++ install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub/ OPTIONAL ) ++ install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.1 ${CMAKE_SOURCE_DIR}/doc/uhub-passwd.1 DESTINATION ${INSTALL_MAN_DIR}/man1/ OPTIONAL ) + endif() + +- +diff --git a/doc/plugins.conf b/doc/plugins.conf +deleted file mode 100644 +index 6e5a9a0..0000000 +--- a/doc/plugins.conf ++++ /dev/null +@@ -1,72 +0,0 @@ +-# ATTENTION! +-# Plugins are invoked in the order of listing in the plugin config file. +- +- +-# Sqlite based user authentication. +-# +-# This plugin provides a Sqlite based authentication database for +-# registered users. +-# Use the uhub-passwd utility to create the database and add/remove users. +-# +-# Parameters: +-# file: path/filename for database. +-# +-plugin /usr/lib/uhub/mod_auth_sqlite.so "file=/etc/uhub/users.db" +- +-# Topic commands. +-# Note: "topic" == "hub description" (as configured in uhub.conf) +-# +-# !topic - change the topic (op required) +-# !showtopic - show the topic +-# !resettopic - reset the topic to the default (op required) +-# +-# This plugins takes no parameters. +-#plugin /usr/lib/uhub/mod_topic.so +- +-# Log file writer +-# +-# Parameters: +-# file: path/filename for log file. +-# syslog: if true then syslog is used instead of writing to a file (Unix only) +-plugin /usr/lib/uhub/mod_logging.so "file=/var/log/uhub.log" +- +-# A simple example plugin +-#plugin /usr/lib/uhub/mod_example.so +- +-# A plugin sending a welcome message. +-# +-# This plugin provides the following commands: +-# !motd - Message of the day +-# !rules - Show hub rules. +-# +-# Parameters: +-# motd: path/filename for the welcome message (message of the day) +-# rules: path/filenam for the rules file +-# +-# NOTE: The files MUST exist, however if you do not wish to provide one then these parameters can be omitted. +-# +-# The motd/rules files can do the following substitutions: +-# %n - Nickname of the user who entered the hub or issued the command. +-# %a - IP address of the user +-# %c - The credentials of the user (guest, user, op, super, admin). +-# %% - Becomes '%' +-# %H - Hour 24-hour format (00-23) (Hub local time) +-# %I - Hour 12-hour format (01-12) (Hub local time) +-# %P - 'AM' or 'PM' +-# %p - 'am' or 'pm' +-# %M - Minutes (00-59) (Hub local time) +-# %S - Seconds (00-60) (Hub local time) +-plugin /usr/lib/uhub/mod_welcome.so "motd=/etc/uhub/motd.txt rules=/etc/uhub/rules.txt" +- +-# Load the chat history plugin. +-# +-# This plugin provides chat history when users are connecting, or +-# when users invoke the !history command. +-# The history command can optionally take a parameter to indicate how many lines of history is requested. +-# +-# Parameters: +-# history_max: the maximum number of messages to keep in history +-# history_default: when !history is provided without arguments, then this default number of messages are returned. +-# history_connect: the number of chat history messages to send when users connect (0 = do not send any history) +-plugin /usr/lib/uhub/mod_chat_history.so "history_max=200 history_default=10 history_connect=5" +- +diff --git a/doc/plugins.conf.in b/doc/plugins.conf.in +new file mode 100644 +index 0000000..873abcd +--- /dev/null ++++ b/doc/plugins.conf.in +@@ -0,0 +1,72 @@ ++# ATTENTION! ++# Plugins are invoked in the order of listing in the plugin config file. ++ ++ ++# Sqlite based user authentication. ++# ++# This plugin provides a Sqlite based authentication database for ++# registered users. ++# Use the uhub-passwd utility to create the database and add/remove users. ++# ++# Parameters: ++# file: path/filename for database. ++# ++plugin @INSTALL_LIB_DIR@/uhub/mod_auth_sqlite.so "file=/etc/uhub/users.db" ++ ++# Topic commands. ++# Note: "topic" == "hub description" (as configured in uhub.conf) ++# ++# !topic - change the topic (op required) ++# !showtopic - show the topic ++# !resettopic - reset the topic to the default (op required) ++# ++# This plugins takes no parameters. ++#plugin @INSTALL_LIB_DIR@/uhub/mod_topic.so ++ ++# Log file writer ++# ++# Parameters: ++# file: path/filename for log file. ++# syslog: if true then syslog is used instead of writing to a file (Unix only) ++plugin @INSTALL_LIB_DIR@/uhub/mod_logging.so "file=/var/log/uhub.log" ++ ++# A simple example plugin ++#plugin @INSTALL_LIB_DIR@/uhub/mod_example.so ++ ++# A plugin sending a welcome message. ++# ++# This plugin provides the following commands: ++# !motd - Message of the day ++# !rules - Show hub rules. ++# ++# Parameters: ++# motd: path/filename for the welcome message (message of the day) ++# rules: path/filenam for the rules file ++# ++# NOTE: The files MUST exist, however if you do not wish to provide one then these parameters can be omitted. ++# ++# The motd/rules files can do the following substitutions: ++# %n - Nickname of the user who entered the hub or issued the command. ++# %a - IP address of the user ++# %c - The credentials of the user (guest, user, op, super, admin). ++# %% - Becomes '%' ++# %H - Hour 24-hour format (00-23) (Hub local time) ++# %I - Hour 12-hour format (01-12) (Hub local time) ++# %P - 'AM' or 'PM' ++# %p - 'am' or 'pm' ++# %M - Minutes (00-59) (Hub local time) ++# %S - Seconds (00-60) (Hub local time) ++plugin @INSTALL_LIB_DIR@/uhub/mod_welcome.so "motd=/etc/uhub/motd.txt rules=/etc/uhub/rules.txt" ++ ++# Load the chat history plugin. ++# ++# This plugin provides chat history when users are connecting, or ++# when users invoke the !history command. ++# The history command can optionally take a parameter to indicate how many lines of history is requested. ++# ++# Parameters: ++# history_max: the maximum number of messages to keep in history ++# history_default: when !history is provided without arguments, then this default number of messages are returned. ++# history_connect: the number of chat history messages to send when users connect (0 = do not send any history) ++plugin @INSTALL_LIB_DIR@/uhub/mod_chat_history.so "history_max=200 history_default=10 history_connect=5" ++ +-- +2.1.3 + diff --git a/uhub/0002-Add-a-default-MOTD-file-which-was-missing.patch b/uhub/0002-Add-a-default-MOTD-file-which-was-missing.patch new file mode 100644 index 0000000..065a5d0 --- /dev/null +++ b/uhub/0002-Add-a-default-MOTD-file-which-was-missing.patch @@ -0,0 +1,21 @@ +From 33927d5b951ba97eab2bd0d8a37e2b7534f4ef08 Mon Sep 17 00:00:00 2001 +From: "Christoph J. Thompson" <cjsthompson@gmail.com> +Date: Sat, 13 Dec 2014 22:22:44 +0100 +Subject: [PATCH 2/5] * Add a default MOTD file which was missing + + new file: doc/motd.txt +--- + doc/motd.txt | 1 + + 1 file changed, 1 insertion(+) + create mode 100644 doc/motd.txt + +diff --git a/doc/motd.txt b/doc/motd.txt +new file mode 100644 +index 0000000..8db1118 +--- /dev/null ++++ b/doc/motd.txt +@@ -0,0 +1 @@ ++The admin didn't edit the default MOTD. +-- +2.1.3 + diff --git a/uhub/0003-Most-unices-including-most-Linux-distro-have-logrota.patch b/uhub/0003-Most-unices-including-most-Linux-distro-have-logrota.patch new file mode 100644 index 0000000..7e3f371 --- /dev/null +++ b/uhub/0003-Most-unices-including-most-Linux-distro-have-logrota.patch @@ -0,0 +1,78 @@ +From 1bdc47aa519b873b71ede1ce064a758e8cb6d468 Mon Sep 17 00:00:00 2001 +From: "Christoph J. Thompson" <cjsthompson@gmail.com> +Date: Sat, 13 Dec 2014 22:56:02 +0100 +Subject: [PATCH 3/5] * Most unices including most Linux distro have logrotate + + modified: CMakeLists.txt + deleted: doc/init.d.RedHat/etc/logrotate.d/uhub + new file: doc/uhub.logrotate + modified: doc/uhub.spec +--- + CMakeLists.txt | 1 + + doc/init.d.RedHat/etc/logrotate.d/uhub | 14 -------------- + doc/uhub.logrotate | 7 +++++++ + doc/uhub.spec | 2 +- + 4 files changed, 9 insertions(+), 15 deletions(-) + delete mode 100644 doc/init.d.RedHat/etc/logrotate.d/uhub + create mode 100644 doc/uhub.logrotate + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 80a1a85..c879185 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -250,5 +250,6 @@ if (UNIX) + install( TARGETS mod_example mod_welcome mod_logging mod_auth_simple mod_auth_sqlite mod_chat_history mod_chat_history_sqlite mod_chat_only mod_topic mod_no_guest_downloads DESTINATION ${INSTALL_LIB_DIR}/uhub/ OPTIONAL ) + install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub/ OPTIONAL ) + install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.1 ${CMAKE_SOURCE_DIR}/doc/uhub-passwd.1 DESTINATION ${INSTALL_MAN_DIR}/man1/ OPTIONAL ) ++ install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.logrotate DESTINATION /etc/logrotate.d/ RENAME uhub OPTIONAL ) + endif() + +diff --git a/doc/init.d.RedHat/etc/logrotate.d/uhub b/doc/init.d.RedHat/etc/logrotate.d/uhub +deleted file mode 100644 +index a0849cb..0000000 +--- a/doc/init.d.RedHat/etc/logrotate.d/uhub ++++ /dev/null +@@ -1,14 +0,0 @@ +-# Log rotate for Uhub +-# see man logrotate +-# +-# +-/var/log/uhub.log { +- compress +- size 10M +- rotate 10 +- missingok +- notifempty +- +- +-} +- +diff --git a/doc/uhub.logrotate b/doc/uhub.logrotate +new file mode 100644 +index 0000000..73142f9 +--- /dev/null ++++ b/doc/uhub.logrotate +@@ -0,0 +1,7 @@ ++/var/log/uhub.log { ++ compress ++ size 10M ++ rotate 10 ++ missingok ++ notifempty ++} +diff --git a/doc/uhub.spec b/doc/uhub.spec +index 7a487f9..9574015 100644 +--- a/doc/uhub.spec ++++ b/doc/uhub.spec +@@ -49,7 +49,7 @@ install uhub-passwd $RPM_BUILD_ROOT/usr/bin/ + install -m644 doc/uhub.conf doc/users.conf doc/rules.txt doc/motd.txt doc/plugins.conf doc/users.db $RPM_BUILD_ROOT/etc/uhub + install doc/init.d.RedHat/etc/init.d/uhub $RPM_BUILD_ROOT/etc/init.d + install -m644 doc/init.d.RedHat/etc/sysconfig/uhub $RPM_BUILD_ROOT/etc/sysconfig/ +-install -m644 doc/init.d.RedHat/etc/logrotate.d/uhub $RPM_BUILD_ROOT/etc/logrotate.d/ ++install -m644 doc/uhub.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/ + /bin/gzip -9c doc/uhub.1 > doc/uhub.1.gz && + install -m644 doc/uhub.1.gz $RPM_BUILD_ROOT/usr/share/man/man1 + install -m644 mod_*.so $RPM_BUILD_ROOT/usr/lib/uhub +-- +2.1.3 + diff --git a/uhub/0004-Conditionally-install-systemd-support-files.patch b/uhub/0004-Conditionally-install-systemd-support-files.patch new file mode 100644 index 0000000..9accb57 --- /dev/null +++ b/uhub/0004-Conditionally-install-systemd-support-files.patch @@ -0,0 +1,65 @@ +From f645797aeced86ce78d2ad7d0c9cf869e1200b3a Mon Sep 17 00:00:00 2001 +From: "Christoph J. Thompson" <cjsthompson@gmail.com> +Date: Sat, 13 Dec 2014 23:09:53 +0100 +Subject: [PATCH 4/5] * Conditionally install systemd support files + + modified: CMakeLists.txt + new file: doc/uhub.service + new file: doc/uhub.tmpfiles +--- + CMakeLists.txt | 7 +++++++ + doc/uhub.service | 16 ++++++++++++++++ + doc/uhub.tmpfiles | 1 + + 3 files changed, 24 insertions(+) + create mode 100644 doc/uhub.service + create mode 100644 doc/uhub.tmpfiles + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c879185..d08310e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -251,5 +251,12 @@ if (UNIX) + install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub/ OPTIONAL ) + install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.1 ${CMAKE_SOURCE_DIR}/doc/uhub-passwd.1 DESTINATION ${INSTALL_MAN_DIR}/man1/ OPTIONAL ) + install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.logrotate DESTINATION /etc/logrotate.d/ RENAME uhub OPTIONAL ) ++ ++ if(SYSTEMD_SUPPORT) ++ install ( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.service DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/system/ OPTIONAL ) ++ install ( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.tmpfiles DESTINATION ++${CMAKE_INSTALL_PREFIX}/lib/tmpfiles.d/ RENAME uhub.conf OPTIONAL ) ++ endif() ++ + endif() + +diff --git a/doc/uhub.service b/doc/uhub.service +new file mode 100644 +index 0000000..24d922d +--- /dev/null ++++ b/doc/uhub.service +@@ -0,0 +1,16 @@ ++[Unit] ++Description=uHub ADC hub Server ++Documentation=man:uhub(1) ++After=network.target ++ ++[Service] ++Type=simple ++User=uhub ++ExecStart=/usr/bin/uhub -p /run/uhub/uhub.pid ++ExecReload=/usr/bin/uhub -C ; \ ++ /bin/kill -HUP $MAINPID ++StandardError=journal ++ ++[Install] ++WantedBy=multi-user.target ++ +diff --git a/doc/uhub.tmpfiles b/doc/uhub.tmpfiles +new file mode 100644 +index 0000000..c548637 +--- /dev/null ++++ b/doc/uhub.tmpfiles +@@ -0,0 +1 @@ ++d /run/uhub 0755 uhub uhub +-- +2.1.3 + diff --git a/uhub/0005-Also-install-users.conf.patch b/uhub/0005-Also-install-users.conf.patch new file mode 100644 index 0000000..e7a275b --- /dev/null +++ b/uhub/0005-Also-install-users.conf.patch @@ -0,0 +1,26 @@ +From d01031c4a4169d515855d8765b872e09a2f45eef Mon Sep 17 00:00:00 2001 +From: "Christoph J. Thompson" <cjsthompson@gmail.com> +Date: Sat, 13 Dec 2014 23:15:50 +0100 +Subject: [PATCH 5/5] * Also install users.conf + + modified: CMakeLists.txt +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d08310e..97355b1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -248,7 +248,7 @@ endif() + if (UNIX) + install( TARGETS uhub uhub-passwd RUNTIME DESTINATION ${INSTALL_BIN_DIR} ) + install( TARGETS mod_example mod_welcome mod_logging mod_auth_simple mod_auth_sqlite mod_chat_history mod_chat_history_sqlite mod_chat_only mod_topic mod_no_guest_downloads DESTINATION ${INSTALL_LIB_DIR}/uhub/ OPTIONAL ) +- install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub/ OPTIONAL ) ++ install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/plugins.conf ${CMAKE_SOURCE_DIR}/doc/users.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub/ OPTIONAL ) + install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.1 ${CMAKE_SOURCE_DIR}/doc/uhub-passwd.1 DESTINATION ${INSTALL_MAN_DIR}/man1/ OPTIONAL ) + install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.logrotate DESTINATION /etc/logrotate.d/ RENAME uhub OPTIONAL ) + +-- +2.1.3 + diff --git a/uhub/uhub.spec b/uhub/uhub.spec new file mode 100644 index 0000000..12f41ba --- /dev/null +++ b/uhub/uhub.spec @@ -0,0 +1,148 @@ +%define uhub_user uhub +%define uhub_group %{uhub_user} +%define uhub_confdir %{_sysconfdir}/uhub +%define uhub_pluginsdir %{_libdir}/uhub +%define uhub_homedir %{_localstatedir}/lib/uhub +%define uhub_logdir %{_localstatedir}/log/uhub +%define sslcert %{_sysconfdir}/pki/tls/certs/uhub.crt +%define sslkey %{_sysconfdir}/pki/tls/private/uhub.key + +Name: uhub +Version: 0.5.0 +Release: 1%{?dist} +Summary: Advanced Direct Connect hub daemon +Group: System Environment/Daemons +License: GPLv3 +URL: https://www.uhub.org +Packager: Christoph J. Thompson <cjsthompson@gmail.com> +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} +BuildRequires: cmake,openssl-devel,systemd-devel,sqlite-devel +Requires(pre): shadow-utils +Requires(post): systemd,openssl +Requires(preun): systemd +Requires(postun): systemd +Source0: http://www.extatic.org/downloads/uhub/%{name}-%{version}-src.tar.bz2 +Patch0: 0001-Install-man-pages.patch +Patch1: 0002-Add-a-default-MOTD-file-which-was-missing.patch +Patch2: 0003-Most-unices-including-most-Linux-distro-have-logrota.patch +Patch3: 0004-Conditionally-install-systemd-support-files.patch +Patch4: 0005-Also-install-users.conf.patch + +%description +uhub is a high performance peer-to-peer hub for the ADC network. +Its low memory footprint allows it to handle several thousand users on +high-end servers, or a small private hub on embedded hardware. + +Key features: +- High performance and low memory usage +- IPv4 and IPv6 support +- Experimental SSL support (optional) +- Advanced access control support +- Easy configuration +- plugin support + - mod_welcome - MOTD\RULES messages + - mod_auth_sipmle - auth with sqlite DB + - mod_logging - log hub activity + +%prep +%autosetup -p1 + +%build +%{__cmake} \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DINSTALL_LIB_DIR=%{_libdir} \ + -DSYSTEMD_SUPPORT=yes \ + -DSSL_SUPPORT=yes \ + -DUSE_OPENSSL=yes +%{__make} %{?_smp_mflags} + +%install +%{__rm} -rf %{buildroot} +%{__make} install DESTDIR="%{buildroot}" +%{__install} -d -p -m 0755 %{buildroot}%{uhub_logdir} +%{__install} -d -p -m 0755 %{buildroot}%{uhub_homedir} +sed -i 's|/var/log/uhub.log|/var/log/uhub/uhub.log|g' %{buildroot}%{uhubconfdir}/plugins.conf +cat >> %{buildroot}%{_tmpfilesdir}/%{name}.conf <<EOF +d /var/lib/uhub 0750 uhub uhub +d /var/log/uhub 0750 uhub uhub +EOF + +%clean +%{__rm} -rf %{buildroot} + +%pre +%{_sbindir}/groupadd -r %{uhub_group} 2>/dev/null || : +%{_sbindir}/useradd -r -g %{uhub_group} -c "Uhub user" -s /bin/nologin -d %{uhub_homedir} %{uhub_user} 2>/dev/null || : + +%post +%tmpfiles_create %{name}.conf +%systemd_post %{name}.service + +if [ ! -f /etc/uhub/users.db ]; then + %{_bindir}/uhub-passwd /etc/uhub/users.db create 2> /dev/null +fi + +umask 077 + +if [ -f %{sslkey} -o -f %{sslcert} ]; then + exit 0 +fi + +%{_bindir}/openssl genrsa -rand /proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime 1024 > %{sslkey} 2> /dev/null + +FQDN=`hostname` + +if [ "x${FQDN}" = "x" ]; then + FQDN=localhost.localdomain +fi + +cat << EOF | %{_bindir}/openssl req -new -key %{sslkey} \ + -x509 -days 365 -set_serial $RANDOM -extensions v3_req \ + -out %{sslcert} 2>/dev/null +-- +SomeState +SomeCity +SomeOrganization +SomeOrganizationalUnit +${FQDN} +root@${FQDN} +EOF + +%preun +%systemd_preun %{name}.service + +%postun +%systemd_postun_with_restart %{name}.service + +%files +%defattr(-,root,root,0755) +%doc AUTHORS ChangeLog README +%{_bindir}/uhub +%{_bindir}/uhub-passwd +%{_mandir}/man1/*.1* +%{_unitdir}/%{name}.service +%{_tmpfilesdir}/%{name}.conf +%config(noreplace) %{uhub_confdir}/%{name}.conf +%config(noreplace) %{uhub_confdir}/plugins.conf +%config(noreplace) %{uhub_confdir}/users.conf +%config(noreplace) %{uhub_confdir}/rules.txt +%config(noreplace) %{uhub_confdir}/motd.txt +%config(noreplace) %{_sysconfdir}/logrotate.d/uhub +%dir %{uhub_confdir} +%dir %{uhub_pluginsdir} +%dir %{uhub_logdir} +%dir %{uhub_homedir} +%{uhub_pluginsdir}/mod_auth_simple.so +%{uhub_pluginsdir}/mod_auth_sqlite.so +%{uhub_pluginsdir}/mod_chat_history.so +%{uhub_pluginsdir}/mod_chat_history_sqlite.so +%{uhub_pluginsdir}/mod_chat_only.so +%{uhub_pluginsdir}/mod_example.so +%{uhub_pluginsdir}/mod_logging.so +%{uhub_pluginsdir}/mod_no_guest_downloads.so +%{uhub_pluginsdir}/mod_topic.so +%{uhub_pluginsdir}/mod_welcome.so + +%changelog +* Sat Dec 13 2014 Christoph J. Thompson <cjsthompson-at-gmail.com> 0.5.0-1 +- Initial spec. |