Add in creatlinks and spec file and some extras
This commit is contained in:
parent
25474c4922
commit
26c6329404
@ -0,0 +1,25 @@
|
||||
{
|
||||
my $port = (${'httpd-e-smith'}{'TCPPort'} || '80') .','.
|
||||
($modSSL{'TCPPort'} || '443');
|
||||
my $status = $smanager{'status'} || 'disabled';
|
||||
my $f2b = $smanager{'Fail2Ban'} || 'enabled';
|
||||
return "" if (($status ne 'enabled') || ($f2b ne 'enabled'));
|
||||
|
||||
$OUT .=<<"EOF";
|
||||
|
||||
[smanager]
|
||||
enabled = true
|
||||
port = $port
|
||||
filter = smanager
|
||||
logpath = /usr/share/smanager/log/production.log
|
||||
maxretry = 3
|
||||
findtime = 300
|
||||
bantime = 1800
|
||||
action = smeserver-iptables[port="$port",protocol=tcp,bantime=$bantime]
|
||||
|
||||
EOF
|
||||
|
||||
$OUT .= " smeserver-sendmail[name=\"SManager\",dest=$maildest]\n"
|
||||
if ($mail eq 'enabled');
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
# Fail2Ban filter for Smanager attempted bypasses
|
||||
|
||||
[Definition]
|
||||
#[Mon Nov 9 20:33:34 2020] [info] Login FAILED: mab 192.168.0.11
|
||||
|
||||
#_groupsre = (?:(?:,?\s*"\w+":(?:"[^"]+"|\w+))*)
|
||||
#failregex = ^\{%(_groupsre)s,?\s*"remoteAddr":"<HOST>"%(_groupsre)s,?\s*"message":"Login failed:
|
||||
# ^\{%(_groupsre)s,?\s*"remoteAddr":"<HOST>"%(_groupsre)s,?\s*"message":"Trusted domain error.
|
||||
|
||||
failregex = ^\[.*\] \[info\] Login FAILED: .*\t<HOST>$
|
||||
|
||||
#ignoreregex =
|
||||
ignoreregex = ^\[.*\] \[debug\] .*$
|
||||
ignoreregex = ^\[.*\] \[info\] Login succeeded: .*$
|
||||
|
||||
#datepattern = ,?\s*"time"\s*:\s*"%%Y-%%m-%%d[T ]%%H:%%M:%%S(%%z)?"
|
||||
|
||||
#datepattern = ^[%%a %%b %%d %%H:%%M:%%S %%Y]
|
||||
#datepattern = ^\[%%a %%b %%-d %%X %%Y\]
|
||||
#^[LN-BEG]
|
||||
# ^[%%a %%b %%-d %%X %%Y]
|
||||
# {^LN-BEG}Epoch
|
||||
datepattern = {^LN-BEG}
|
||||
|
||||
# Author: Michel Begue
|
||||
|
71
createlinks
Normal file → Executable file
71
createlinks
Normal file → Executable file
@ -1,43 +1,54 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use esmith::Build::CreateLinks qw(:all);
|
||||
use esmith::Build::Backup qw(:all);
|
||||
|
||||
# our event specific for updating with yum without reboot
|
||||
$event = 'smeserver-manager-panels-update';
|
||||
#add here the path to your templates needed to expand
|
||||
#see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event
|
||||
#--------------------------------------------------
|
||||
# functions for manager
|
||||
#--------------------------------------------------
|
||||
my $mngrdir = '/usr/share/smanager';
|
||||
|
||||
# Maybe need ths in here as well:
|
||||
# /etc/dar/DailyBackup.dcf - if backup requested
|
||||
|
||||
foreach my $file (qw(
|
||||
/etc/systemd/system-preset/49-koozali.preset
|
||||
))
|
||||
# templates to expand
|
||||
for ( qw( sme_core.css sme_main.css sme_menu.css styles.css ) )
|
||||
{
|
||||
templates2events( $file, $event );
|
||||
};
|
||||
#action needed in case we have a systemd unit
|
||||
event_link('systemd-default', $event, '10');
|
||||
event_link('systemd-reload', $event, '50');
|
||||
templates2events("$mngrdir/themes/default/public/css/$_", qw(
|
||||
bootstrap-console-save smeserver-manager-update
|
||||
));
|
||||
}
|
||||
|
||||
#services we might need to restart
|
||||
#event_services($event, 'xxxx' => 'restart', 'yyyy' => 'restart');
|
||||
templates2events("$mngrdir/conf/srvmngr.conf",
|
||||
qw( smeserver-manager-update smanager-theme-change smanager-modify bootstrap-console-save ));
|
||||
|
||||
#Backup contrib files
|
||||
# backup_includes("smeserver-manager-panels", qw(
|
||||
# files(s) to be backed up
|
||||
#));
|
||||
|
||||
#Other possible entries:
|
||||
#Server manager entry
|
||||
#panel_link("smeserver-manager-panels", 'manager');
|
||||
#Events to smeserver-manager-panels
|
||||
#$event = 'smeserver-manager-panels-smeserver-manager-panels';
|
||||
# safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/smeserver-manager-panels");
|
||||
# templates2events("/etc/smeserver-manager-panels/smeserver-manager-panels.conf", $event);
|
||||
templates2events("/etc/httpd/conf/httpd.conf",
|
||||
qw( smeserver-manager-update smanager-modify ));
|
||||
|
||||
|
||||
# services to launch on event
|
||||
for my $event ( qw( smeserver-manager-update smanager-modify ) )
|
||||
{
|
||||
safe_symlink("restart",
|
||||
"root/etc/e-smith/events/$event/services2adjust/smanager");
|
||||
safe_symlink("reload",
|
||||
"root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
|
||||
}
|
||||
|
||||
safe_symlink("reload",
|
||||
"root/etc/e-smith/events/smanager-theme-change/services2adjust/smanager");
|
||||
|
||||
safe_symlink("restart",
|
||||
"root/etc/e-smith/events/smanager-refresh/services2adjust/smanager");
|
||||
|
||||
# actions to perform
|
||||
for my $event ( qw( smeserver-manager-update smanager-refresh bootstrap-console-save ) )
|
||||
{
|
||||
event_link('navigation2-conf', "$event", '80');
|
||||
event_link('routes2-conf', "$event", '80');
|
||||
event_link('locales2-conf', "$event", '80');
|
||||
}
|
||||
|
||||
event_link('systemd-default', "smeserver-manager-update", '88');
|
||||
event_link('systemd-reload', "smeserver-manager-update", '89');
|
||||
|
||||
use esmith::Build::Backup qw(:all);
|
||||
backup_includes("smeserver-manager", qw(
|
||||
/usr/share/smanager/data
|
||||
));
|
||||
|
File diff suppressed because it is too large
Load Diff
55
smeserver-manager-panels.spec.sav
Normal file
55
smeserver-manager-panels.spec.sav
Normal file
@ -0,0 +1,55 @@
|
||||
%define name smeserver-manager-panels
|
||||
%define version 1.0
|
||||
%define release 1
|
||||
Summary: This is what smeserver-manager-panels does.
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}%{?dist}
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
License: GNU GPL version 2
|
||||
Group: SMEserver/addon
|
||||
BuildRoot: %{_tmppath}/%{name}-buildroot
|
||||
Prefix: %{_prefix}
|
||||
BuildArchitectures: noarch
|
||||
BuildRequires: e-smith-devtools
|
||||
Requires: e-smith-release >= 10.0
|
||||
AutoReqProv: no
|
||||
|
||||
%description
|
||||
Initial repo for SM2 perl/ mojolicious panels.
|
||||
|
||||
%changelog
|
||||
* Fri Mar 15 2024 <brianr@koozali.org> 1.0-1.sme
|
||||
- Initial code - create RPM [SME:99999]
|
||||
|
||||
%prep
|
||||
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
perl createlinks
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
|
||||
rm -f %{name}-%{version}-filelist
|
||||
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
|
||||
> %{name}-%{version}-filelist
|
||||
#echo "%doc COPYING" >> %{name}-%{version}-filelist
|
||||
#--dir <dir> 'attr(755,user,grp)' \
|
||||
#--file <file> 'attr(755,root,root)' \
|
||||
|
||||
%clean
|
||||
cd ..
|
||||
rm -rf %{name}-%{version}
|
||||
|
||||
%pre
|
||||
|
||||
%preun
|
||||
|
||||
%post
|
||||
|
||||
%postun
|
||||
#uninstall
|
||||
%files -f %{name}-%{version}-filelist
|
||||
%defattr(-,root,root)
|
1230
smeserver-manager.spec
Normal file
1230
smeserver-manager.spec
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user