Skip to content

Commit 7af7048

Browse files
committed
Initial commit
0 parents  commit 7af7048

File tree

9 files changed

+143
-0
lines changed

9 files changed

+143
-0
lines changed

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Ignore temporary files
2+
temp/
3+
tmp/
4+
*.lck
5+
*.tmp
6+
*.pid
7+
*.swp
8+
9+
# Ignore general configs
10+
fs/etc/bind/*

Dockerfile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM hnc-base:latest
2+
LABEL name="hnc-dns"
3+
LABEL description="HashNet Container for a bind DNS server"
4+
LABEL maintainer="hashsploit <[email protected]>"
5+
6+
# Install dependencies
7+
RUN echo "Updating system ..." \
8+
&& apt-get update >/dev/null 2>&1 \
9+
&& echo "Installing dependencies ..." \
10+
&& apt-get install -y \
11+
bind9 \
12+
dnsutils \
13+
>/dev/null 2>&1
14+
15+
# Copy file system
16+
COPY fs/ /
17+
18+
# Make entrypoint executable
19+
RUN chmod +x /srv/start.sh
20+
21+
# Expose service
22+
EXPOSE 53/udp 53/tcp
23+
24+
# Set image starting point
25+
CMD ["bash", "/srv/start.sh"]

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 hashsploit
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# HashNet Container for Virtual Private Servers (VPS)
2+
3+
This Docker image generates a Virtual Private Server for HashNet enterprise users.
4+
5+
### 1. Configure image
6+
7+
Configure the OpenDNAS server in the `settings.sh` file.
8+
9+
### 2. Build the image
10+
11+
Run the `build.sh` file to generate the Docker image `hnc-vps`.
12+
13+
### 2. Deploy the container
14+
15+
To spawn a temporary container run `test.sh`.
16+
17+
To spawn a dedicated container run `run.sh`.
18+

build.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# Set the directory to this script's current directory
4+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5+
cd $DIR
6+
7+
source ./settings.sh
8+
9+
docker rmi ${IMAGE_NAME}
10+
docker build --force-rm --rm --tag ${IMAGE_NAME} .
11+

fs/srv/start.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
exec "$(command -v named)" -u root -g

run.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# Set the directory to this script's current directory
4+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5+
cd $DIR
6+
7+
source ./settings.sh
8+
9+
docker run -d -i -t \
10+
-e CONTAINER_NAME=${CONTAINER_NAME} \
11+
-e MEMORY_MAX=${MEMORY_MAX} \
12+
--memory=${MEMORY_MAX} \
13+
--memory-swap=${MEMORY_MAX} \
14+
--memory-swappiness=0 \
15+
--name ${CONTAINER_NAME} \
16+
--mount "type=volume,src=${VOLUME_NAME},dst=/etc/bind,volume-driver=local" \
17+
-p ${PORT}:53/udp \
18+
-p ${PORT}:53/tcp \
19+
${IMAGE_NAME}
20+

settings.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
# Docker image name
4+
IMAGE_NAME="hnc-dns:latest"
5+
6+
# The container's name when using ./run.sh
7+
CONTAINER_NAME="hnc-dns"
8+
9+
# The maximum memory allowed in this container
10+
MEMORY_MAX="2048m"
11+
12+
# The port the server is running on
13+
PORT=53
14+
15+
# The mounted volume name when using ./run.sh
16+
VOLUME_NAME=${CONTAINER_NAME}
17+

test.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# Set the directory to this script's current directory
4+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5+
cd $DIR
6+
7+
source ./settings.sh
8+
9+
docker run --rm -i -t \
10+
-e CONTAINER_NAME=${CONTAINER_NAME} \
11+
-e MEMORY_MAX=${MEMORY_MAX} \
12+
--memory=${MEMORY_MAX} \
13+
--memory-swap=${MEMORY_MAX} \
14+
--memory-swappiness="0" \
15+
-p ${PORT}:53/udp \
16+
-p ${PORT}:53/tcp \
17+
${IMAGE_NAME} bash
18+

0 commit comments

Comments
 (0)