mirror of
https://github.com/juliengk/csf-post-docker.git
synced 2023-10-10 13:37:41 +02:00
Add install script
This commit is contained in:
parent
3848c1e77e
commit
ba316685f6
19
README.md
19
README.md
@ -1,5 +1,20 @@
|
||||
# ConfigServer Security & Firewall (CSF) - Docker
|
||||
|
||||
Install:
|
||||
## Installation
|
||||
### Requirement
|
||||
Make sure to use the scripts from `https://github.com/juliengk/csf-pre_post_sh`
|
||||
|
||||
cp csfpost.sh /usr/local/csf/bin/csfpost.sh
|
||||
### Install
|
||||
Installation is quite straightforward:
|
||||
|
||||
```
|
||||
# cd /usr/local/src
|
||||
# git clone https://github.com/juliengk/csf-post-docker.git
|
||||
# cd csf-post-docker
|
||||
# sh install.sh
|
||||
```
|
||||
|
||||
## User Feedback
|
||||
### Issues
|
||||
|
||||
If you have any problems with or questions about this image, please contact us through a [GitHub](https://github.com/juliengk/csf-post-docker/issues) issue.
|
||||
|
@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
chain_exists()
|
||||
{
|
||||
chain_exists() {
|
||||
[ $# -lt 1 -o $# -gt 2 ] && {
|
||||
echo "Usage: chain_exists <chain_name> [table]" >&2
|
||||
return 1
|
60
install.sh
Executable file
60
install.sh
Executable file
@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT_NAME="docker.sh"
|
||||
|
||||
CSF_CUSTOM_PATH="/usr/local/include/csf"
|
||||
CSFPOSTD_PATH="${CSF_CUSTOM_PATH}/post.d"
|
||||
|
||||
|
||||
if [ ! -d ${CSF_CUSTOM_PATH} ]; then
|
||||
echo "** CSF-PRE_POST_SH is not installed **"
|
||||
echo "Get it from https://github.com/juliengk/csf-pre_post_sh"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PREFIX="None"
|
||||
if [ "$1" == "-p" ] || [ "$1" == "--prefix" ]; then
|
||||
PREFIX=$2
|
||||
|
||||
shift 2
|
||||
fi
|
||||
|
||||
SCRIPT_NAME_FINAL="${SCRIPT_NAME}"
|
||||
if [ ${PREFIX} != "None" ]; then
|
||||
SCRIPT_NAME_FINAL="${PREFIX}_${SCRIPT_NAME}"
|
||||
fi
|
||||
|
||||
if [ -f ${CSFPOSTD_PATH}/${SCRIPT_NAME_FINAL} ]; then
|
||||
md5_0=`md5sum docker.sh | awk '{ print $1 }'`
|
||||
md5_1=`md5sum ${CSFPOSTD_PATH}/${SCRIPT_NAME_FINAL} | awk '{ print $1 }'`
|
||||
|
||||
if [ ${md5_0} == ${md5_1} ]; then
|
||||
exit 0
|
||||
else
|
||||
ok=0
|
||||
while [ ${ok} -eq 0 ]; do
|
||||
clear
|
||||
|
||||
echo "** Warning! **"
|
||||
echo "A different version of the script is already present"
|
||||
echo "Do you want to replace it (y/n)?"
|
||||
|
||||
read answer
|
||||
|
||||
if [ ${answer} == "y" -o ${answer} == "n" ]; then
|
||||
ok=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${answer} == "n" ]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
cp -f ${SCRIPT_NAME} ${CSFPOSTD_PATH}/${SCRIPT_NAME_FINAL}
|
||||
chown root:root ${CSFPOSTD_PATH}/${SCRIPT_NAME_FINAL}
|
||||
chmod 700 ${CSFPOSTD_PATH}/${SCRIPT_NAME_FINAL}
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user