mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-10 11:55:53 +02:00
Fix cp -n (#3483)
* Fix cp -n * Don't rely on cp for file existence check * Busybox cp can be used now * test -s -> test -f * test -f -> test -e --------- Co-authored-by: marco <marco@crowdsec.net>
This commit is contained in:
parent
31b914512a
commit
5484cc2044
3 changed files with 6 additions and 29 deletions
10
Dockerfile
10
Dockerfile
|
@ -49,14 +49,4 @@ ENTRYPOINT ["/bin/bash", "/docker_start.sh"]
|
|||
|
||||
FROM slim AS full
|
||||
|
||||
# Due to the wizard using cp -n, we have to copy the config files directly from the source as -n does not exist in busybox cp
|
||||
# The files are here for reference, as users will need to mount a new version to be actually able to use notifications
|
||||
COPY --from=build \
|
||||
/go/src/crowdsec/cmd/notification-email/email.yaml \
|
||||
/go/src/crowdsec/cmd/notification-http/http.yaml \
|
||||
/go/src/crowdsec/cmd/notification-slack/slack.yaml \
|
||||
/go/src/crowdsec/cmd/notification-splunk/splunk.yaml \
|
||||
/go/src/crowdsec/cmd/notification-sentinel/sentinel.yaml \
|
||||
/staging/etc/crowdsec/notifications/
|
||||
|
||||
COPY --from=build /usr/local/lib/crowdsec/plugins /usr/local/lib/crowdsec/plugins
|
||||
|
|
|
@ -65,16 +65,6 @@ ENTRYPOINT ["/bin/bash", "docker_start.sh"]
|
|||
|
||||
FROM slim AS plugins
|
||||
|
||||
# Due to the wizard using cp -n, we have to copy the config files directly from the source as -n does not exist in busybox cp
|
||||
# The files are here for reference, as users will need to mount a new version to be actually able to use notifications
|
||||
COPY --from=build \
|
||||
/go/src/crowdsec/cmd/notification-email/email.yaml \
|
||||
/go/src/crowdsec/cmd/notification-http/http.yaml \
|
||||
/go/src/crowdsec/cmd/notification-slack/slack.yaml \
|
||||
/go/src/crowdsec/cmd/notification-splunk/splunk.yaml \
|
||||
/go/src/crowdsec/cmd/notification-sentinel/sentinel.yaml \
|
||||
/staging/etc/crowdsec/notifications/
|
||||
|
||||
COPY --from=build /usr/local/lib/crowdsec/plugins /usr/local/lib/crowdsec/plugins
|
||||
|
||||
FROM slim AS geoip
|
||||
|
|
15
wizard.sh
15
wizard.sh
|
@ -497,7 +497,7 @@ delete_plugins() {
|
|||
rm -rf ${CROWDSEC_PLUGIN_DIR}
|
||||
}
|
||||
|
||||
install_plugins(){
|
||||
install_plugins() {
|
||||
mkdir -p ${CROWDSEC_PLUGIN_DIR}
|
||||
mkdir -p /etc/crowdsec/notifications
|
||||
|
||||
|
@ -508,14 +508,11 @@ install_plugins(){
|
|||
cp ${SENTINEL_PLUGIN_BINARY} ${CROWDSEC_PLUGIN_DIR}
|
||||
cp ${FILE_PLUGIN_BINARY} ${CROWDSEC_PLUGIN_DIR}
|
||||
|
||||
if [[ ${DOCKER_MODE} == "false" ]]; then
|
||||
cp -n ${SLACK_PLUGIN_CONFIG} /etc/crowdsec/notifications/
|
||||
cp -n ${SPLUNK_PLUGIN_CONFIG} /etc/crowdsec/notifications/
|
||||
cp -n ${HTTP_PLUGIN_CONFIG} /etc/crowdsec/notifications/
|
||||
cp -n ${EMAIL_PLUGIN_CONFIG} /etc/crowdsec/notifications/
|
||||
cp -n ${SENTINEL_PLUGIN_CONFIG} /etc/crowdsec/notifications/
|
||||
cp -n ${FILE_PLUGIN_CONFIG} /etc/crowdsec/notifications/
|
||||
fi
|
||||
for yaml_conf in ${SLACK_PLUGIN_CONFIG} ${SPLUNK_PLUGIN_CONFIG} ${HTTP_PLUGIN_CONFIG} ${EMAIL_PLUGIN_CONFIG} ${SENTINEL_PLUGIN_CONFIG} ${FILE_PLUGIN_CONFIG}; do
|
||||
if [[ ! -e /etc/crowdsec/notifications/"$(basename "$yaml_conf")" ]]; then
|
||||
cp "$yaml_conf" /etc/crowdsec/notifications/
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
check_running_bouncers() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue