您的位置:首页 > 运维架构 > Docker

docker镜像制作之Dockerfile文件---snort

2018-07-09 16:14 1626 查看
原文地址为:docker镜像制作之Dockerfile文件---snort

<span style="font-size:18px;"># Snort 2.9.8.0
#
# VERSION 1
FROM opennsm/debian
MAINTAINER xu <921586520@qq.com>

# Metadata
LABEL organization=iie
LABEL program=snort

# Specify container username e.g. training, demo
ENV VIRTUSER snort
# Specify program
ENV PROG snort
# Specify source extension
ENV EXT tar.gz
# Specify Snort version to download and install
ENV VERS 2.9.8.0
# Specific libpcap to download and install
ENV LVERS libpcap-1.7.4
# Specific libdnet to download and install
ENV LDVERS libdnet-1.11
# Specific daq to download and install
ENV DVERS daq-2.0.6
# Install directory
ENV PREFIX /opt
# Path should include prefix
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PREFIX/bin

# Install dependencies
RUN apt-get update -qq
RUN apt-get install -yq build-essential libpcre3-dev \
bison flex zlib1g-dev autoconf libtool --no-install-recommends

# Compile and install libpcap
RUN wget http://www.tcpdump.org/release/$LVERS.$EXT
RUN tar zxf $LVERS.$EXT && cd $LVERS && ./configure --prefix=/usr && make && make install</span>
<span style="font-size:18px;"># Compile and install libdnet#RUN wget http://libdnet.googlecode.com/files/$LDVERS.tgzRUN wget http://nchc.dl.sourceforge.net/project/libdnet/libdnet/libdnet-1.11/$LDVERS.tar.gzRUN tar -zxf $LDVERS.tar.gz && cd $LDVERS && ./configure --prefix=/usr --enable-shared && make && make installRUN echo >> /etc/ld.so.conf /usr/lib && echo >> /etc/ld.so.conf /usr/local/lib# Compile and install daqRUN wget --no-check-certificate https://www.snort.org/downloads/snort/$DVERS.$EXTRUN tar -zxf $DVERS.$EXT && cd $DVERS && ./configure && make && make install#  Compile and install SnortUSER $VIRTUSERWORKDIR /home/$VIRTUSER#RUN wget --no-check-certificate https://www.snort.org/downloads/snort/$PROG-$VERS.tar.gzCOPY snort-2.9.8.0.tar.gz /home/$VIRTUSERRUN tar -zxf $PROG-$VERS.$EXTWORKDIR /home/$VIRTUSER/$PROG-$VERSRUN ./configure --prefix=$PREFIX --enable-sourcefire --enable-large-pcap --enable-profile --enable-gdb --enable-linux-smp-stats && make#RUN ./configure --enable-sourcefire --enable-large-pcap --enable-profile --enable-gdb --enable-linux-smp-stats && makeUSER rootRUN make install && ldconfigRUN chmod u+s $PREFIX/bin/snortRUN  mkdir -p /etc/snort/rulesRUN  cp etc/*.conf /etc/snortRUN  cp etc/*.config /etc/snortRUN  cp etc/unicode.map /etc/snortRUN  mkdir -p /var/log/snort# CleanupRUN rm -rf /home/$VIRTUSER/$PROG-$VERSRUN rm -rf /root/$DVERSRUN rm -rf /root/$LVERSRUN rm -rf /root/$LDVERS</span>
<span style="font-size:24px;">注意:本镜像是参考官网进行改造,目前官网提供的一些标准Dockerfile文件,并不是拷贝过来就能直接build,例如在该镜像的改造过程中就会遇见相关问题,例如:</span>
在下载nort-2.9.8.0.tar.gz的时候,原Dockerfile文件提供的是官网下载链接(利用wget下载),但是现在这个链接已经不存在,那我我采取的办法是先将snort-2.9.8.0.tar.g文件下载到Dockerfile所在的目录下,然后用COPY代替wget操作来解决问题。

转载请注明本文地址:docker镜像制作之Dockerfile文件---snort
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: