parent
487bf4e74a
commit
24b540ecde
6 changed files with 13 additions and 28 deletions
4
config/crowdsec.cron.daily
Normal file
4
config/crowdsec.cron.daily
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
cscli --error hub update && cscli --error hub upgrade
|
||||||
|
systemctl reload crowdsec
|
||||||
|
exit 0
|
1
debian/crowdsec.cron.daily
vendored
Symbolic link
1
debian/crowdsec.cron.daily
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../config/crowdsec.cron.daily
|
1
debian/postinst
vendored
1
debian/postinst
vendored
|
@ -82,7 +82,6 @@ if [ "$1" = configure ]; then
|
||||||
set -e
|
set -e
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install_cronjob
|
|
||||||
|
|
||||||
if [[ -f /var/lib/crowdsec/data/crowdsec.db.backup ]]; then
|
if [[ -f /var/lib/crowdsec/data/crowdsec.db.backup ]]; then
|
||||||
cp /var/lib/crowdsec/data/crowdsec.db.backup /var/lib/crowdsec/data/crowdsec.db
|
cp /var/lib/crowdsec/data/crowdsec.db.backup /var/lib/crowdsec/data/crowdsec.db
|
||||||
|
|
4
debian/postrm
vendored
4
debian/postrm
vendored
|
@ -1,7 +1,7 @@
|
||||||
if [ "$1" = "purge" ]; then
|
if [ "$1" = "purge" ]; then
|
||||||
find /etc/crowdsec -maxdepth 1 -mindepth 1 | grep -v "bouncer" | xargs rm -rf || echo ""
|
find /etc/crowdsec -maxdepth 1 -mindepth 1 | grep -v "bouncer" | xargs rm -rf || echo ""
|
||||||
rm -rf /var/lib/crowdsec
|
rm -rf /var/lib/crowdsec
|
||||||
if [ -d "/etc/cron.daily/" ] && [ -f "/etc/cron.daily/crowdsec-hub" ]; then
|
if [ -f "/etc/cron.daily/crowdsec" ]; then
|
||||||
rm /etc/cron.daily/crowdsec-hub
|
rm /etc/cron.daily/crowdsec
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -14,8 +14,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
|
|
||||||
BuildRequires: git
|
BuildRequires: git
|
||||||
BuildRequires: make
|
BuildRequires: make
|
||||||
BuildRequires: jq
|
|
||||||
BuildRequires: systemd
|
BuildRequires: systemd
|
||||||
|
Requires: crontabs
|
||||||
%{?fc33:BuildRequires: systemd-rpm-macros}
|
%{?fc33:BuildRequires: systemd-rpm-macros}
|
||||||
%{?fc34:BuildRequires: systemd-rpm-macros}
|
%{?fc34:BuildRequires: systemd-rpm-macros}
|
||||||
%{?fc35:BuildRequires: systemd-rpm-macros}
|
%{?fc35:BuildRequires: systemd-rpm-macros}
|
||||||
|
@ -52,6 +52,7 @@ mkdir -p %{buildroot}%{_sharedstatedir}/%{name}/plugins
|
||||||
mkdir -p %{buildroot}%{_sysconfdir}/crowdsec/notifications/
|
mkdir -p %{buildroot}%{_sysconfdir}/crowdsec/notifications/
|
||||||
mkdir -p %{buildroot}%{_libdir}/%{name}/plugins/
|
mkdir -p %{buildroot}%{_libdir}/%{name}/plugins/
|
||||||
|
|
||||||
|
|
||||||
install -m 755 -D cmd/crowdsec/crowdsec %{buildroot}%{_bindir}/%{name}
|
install -m 755 -D cmd/crowdsec/crowdsec %{buildroot}%{_bindir}/%{name}
|
||||||
install -m 755 -D cmd/crowdsec-cli/cscli %{buildroot}%{_bindir}/cscli
|
install -m 755 -D cmd/crowdsec-cli/cscli %{buildroot}%{_bindir}/cscli
|
||||||
install -m 755 -D wizard.sh %{buildroot}/usr/share/crowdsec/wizard.sh
|
install -m 755 -D wizard.sh %{buildroot}/usr/share/crowdsec/wizard.sh
|
||||||
|
@ -61,6 +62,7 @@ install -m 600 -D config/config.yaml %{buildroot}%{_sysconfdir}/crowdsec
|
||||||
install -m 644 -D config/simulation.yaml %{buildroot}%{_sysconfdir}/crowdsec
|
install -m 644 -D config/simulation.yaml %{buildroot}%{_sysconfdir}/crowdsec
|
||||||
install -m 644 -D config/profiles.yaml %{buildroot}%{_sysconfdir}/crowdsec
|
install -m 644 -D config/profiles.yaml %{buildroot}%{_sysconfdir}/crowdsec
|
||||||
install -m 644 -D config/console.yaml %{buildroot}%{_sysconfdir}/crowdsec
|
install -m 644 -D config/console.yaml %{buildroot}%{_sysconfdir}/crowdsec
|
||||||
|
install -m 750 -D config/%{name}.cron.daily %{buildroot}%{_sysconfdir}/cron.daily/%{name}
|
||||||
install -m 644 -D %{SOURCE1} %{buildroot}%{_presetdir}
|
install -m 644 -D %{SOURCE1} %{buildroot}%{_presetdir}
|
||||||
|
|
||||||
install -m 551 plugins/notifications/slack/notification-slack %{buildroot}%{_libdir}/%{name}/plugins/
|
install -m 551 plugins/notifications/slack/notification-slack %{buildroot}%{_libdir}/%{name}/plugins/
|
||||||
|
@ -118,6 +120,7 @@ rm -rf %{buildroot}
|
||||||
%config(noreplace) %{_sysconfdir}/%{name}/notifications/slack.yaml
|
%config(noreplace) %{_sysconfdir}/%{name}/notifications/slack.yaml
|
||||||
%config(noreplace) %{_sysconfdir}/%{name}/notifications/splunk.yaml
|
%config(noreplace) %{_sysconfdir}/%{name}/notifications/splunk.yaml
|
||||||
%config(noreplace) %{_sysconfdir}/%{name}/notifications/email.yaml
|
%config(noreplace) %{_sysconfdir}/%{name}/notifications/email.yaml
|
||||||
|
%config(noreplace) %{_sysconfdir}/cron.daily/%{name}
|
||||||
|
|
||||||
%{_unitdir}/%{name}.service
|
%{_unitdir}/%{name}.service
|
||||||
|
|
||||||
|
@ -175,7 +178,6 @@ if [ $1 == 1 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cscli hub update
|
cscli hub update
|
||||||
install_cronjob
|
|
||||||
CSCLI_BIN_INSTALLED="/usr/bin/cscli" SILENT=true install_collection
|
CSCLI_BIN_INSTALLED="/usr/bin/cscli" SILENT=true install_collection
|
||||||
|
|
||||||
#upgrade
|
#upgrade
|
||||||
|
@ -228,8 +230,8 @@ if [ $1 == 0 ]; then
|
||||||
rm -rf /etc/crowdsec/hub
|
rm -rf /etc/crowdsec/hub
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "/etc/cron.daily/" ] && [ -f "/etc/cron.daily/crowdsec-hub" ]; then
|
if [ -f "/etc/cron.daily/crowdsec-hub" ]; then
|
||||||
rm /etc/cron.daily/crowdsec-hub
|
rm /etc/cron.daily/crowdsec
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#systemctl stop crowdsec || echo "crowdsec was not started"
|
#systemctl stop crowdsec || echo "crowdsec was not started"
|
||||||
|
|
21
wizard.sh
21
wizard.sh
|
@ -68,7 +68,6 @@ telnet
|
||||||
smb
|
smb
|
||||||
'
|
'
|
||||||
|
|
||||||
CRON_NAME=/etc/cron.daily/crowdsec-hub
|
|
||||||
|
|
||||||
HTTP_PLUGIN_BINARY="./plugins/notifications/http/notification-http"
|
HTTP_PLUGIN_BINARY="./plugins/notifications/http/notification-http"
|
||||||
SLACK_PLUGIN_BINARY="./plugins/notifications/slack/notification-slack"
|
SLACK_PLUGIN_BINARY="./plugins/notifications/slack/notification-slack"
|
||||||
|
@ -553,22 +552,6 @@ uninstall_crowdsec() {
|
||||||
log_info "crowdsec successfully uninstalled"
|
log_info "crowdsec successfully uninstalled"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_cronjob() {
|
|
||||||
log_info "Installing Hub Cronjob"
|
|
||||||
if [[ -d /etc/cron.daily/ ]] && [[ ! -f $CRON_NAME ]]; then
|
|
||||||
echo "/usr/bin/cscli hub update" >> $CRON_NAME
|
|
||||||
echo "/usr/bin/cscli hub upgrade" >> $CRON_NAME
|
|
||||||
chmod 755 $CRON_NAME
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
uninstall_cronjob() {
|
|
||||||
if [[ -d /etc/cron.daily/ ]] && [[ -f $CRON_NAME ]]; then
|
|
||||||
log_info "Uninstall Hub Cronjob"
|
|
||||||
rm $CRON_NAME
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function show_link {
|
function show_link {
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -635,7 +618,6 @@ main() {
|
||||||
${CSCLI_BIN_INSTALLED} hub update
|
${CSCLI_BIN_INSTALLED} hub update
|
||||||
install_collection
|
install_collection
|
||||||
genacquisition
|
genacquisition
|
||||||
install_cronjob
|
|
||||||
if ! skip_tmp_acquis; then
|
if ! skip_tmp_acquis; then
|
||||||
mv "${TMP_ACQUIS_FILE}" "${ACQUIS_TARGET}"
|
mv "${TMP_ACQUIS_FILE}" "${ACQUIS_TARGET}"
|
||||||
fi
|
fi
|
||||||
|
@ -656,7 +638,6 @@ main() {
|
||||||
fi
|
fi
|
||||||
check_running_bouncers
|
check_running_bouncers
|
||||||
uninstall_crowdsec
|
uninstall_crowdsec
|
||||||
uninstall_cronjob
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -711,8 +692,6 @@ main() {
|
||||||
mkdir -p "${PATTERNS_PATH}"
|
mkdir -p "${PATTERNS_PATH}"
|
||||||
cp "./${PATTERNS_FOLDER}/"* "${PATTERNS_PATH}/"
|
cp "./${PATTERNS_FOLDER}/"* "${PATTERNS_PATH}/"
|
||||||
|
|
||||||
# install hub cronjob
|
|
||||||
install_cronjob
|
|
||||||
# api register
|
# api register
|
||||||
${CSCLI_BIN_INSTALLED} machines add --force "$(cat /etc/machine-id)" -a -f "${CROWDSEC_CONFIG_PATH}/${CLIENT_SECRETS}" || log_fatal "unable to add machine to the local API"
|
${CSCLI_BIN_INSTALLED} machines add --force "$(cat /etc/machine-id)" -a -f "${CROWDSEC_CONFIG_PATH}/${CLIENT_SECRETS}" || log_fatal "unable to add machine to the local API"
|
||||||
log_dbg "Crowdsec LAPI registered"
|
log_dbg "Crowdsec LAPI registered"
|
||||||
|
|
Loading…
Reference in a new issue