Compare commits

...

54 Commits

Author SHA1 Message Date
Sameer Naik 508bc5a17c
Merge pull request #95 from sameersbn/new-releases
release 9.16.1-20200524
2020-05-24 20:36:24 +05:30
Sameer Naik 47e56d007d
release 9.16.1-20200524 2020-05-24 20:20:03 +05:30
Sameer Naik a4cd971267
update circleci config 2020-05-24 19:58:15 +05:30
Sameer Naik 248edab2b2
update to bind 9.16.1 2020-05-24 19:54:25 +05:30
Sameer Naik 28f7f72798
Merge pull request #94 from sameersbn/release-9.11.3-20200507
release release-9.11.3-20200507
2020-05-07 20:04:24 +05:30
Sameer Naik 05f14e0d73
release release-9.11.3-20200507 2020-05-07 18:48:21 +05:30
Sameer Naik 4888531947
Merge pull request #93 from sameersbn/new-updates
updated base image and ci pipeline
2020-05-07 18:41:27 +05:30
Sameer Naik 5f0b941589
updated ci pipeline 2020-05-07 18:36:31 +05:30
Sameer Naik 0de5ef1c76
updated to ubuntu:bionic-20200403 2020-05-07 14:42:29 +05:30
Sameer Naik fa9f9b5f4d
Merge pull request #89 from utkuozdemir/webmin-reverse-proxy-config
Make webmin reverse-proxy friendly
2020-05-07 14:39:00 +05:30
Sameer Naik 0f9cd3b153
Merge pull request #88 from SizaSL/update-webmin
Update Webmin
2020-05-07 14:37:34 +05:30
Utku Ozdemir 6a587a233b Add the configuration lines only once to avoid same lines being added over and over. 2020-02-15 21:43:12 +01:00
Utku Ozdemir 9862eb9163 Fix variable name. 2020-02-15 21:27:17 +01:00
Utku Ozdemir 43cb1d6dc0 Update README. 2020-02-15 03:16:56 +01:00
Utku Ozdemir b4af456446 Add webmin configuration parameters for reverse-proxy friendliness: WEBMIN_INIT_SSL_ENABLED, WEBMIN_INIT_REDIRECT_PORT and WEBMIN_INIT_REFERERS. 2020-02-15 03:07:17 +01:00
Siza 7548e68988 Update Webmin ***https://thehackernews.com/2019/08/webmin-vulnerability-hacking.html*** 2020-02-07 13:01:58 +13:00
Sameer Naik 819e1111c6
Merge branch 'release-9.11.3-20190706' 2019-07-06 09:39:56 +05:30
Sameer Naik d0d5d6d46f
release 9.11.3-20190706 2019-07-06 09:38:05 +05:30
Sameer Naik b73b78dfc2
Merge branch 'baseimage-update' 2019-07-06 09:37:13 +05:30
Sameer Naik 5c5475afec
updated baseimage to ubuntu:bionic-20190612 2019-07-06 09:32:40 +05:30
Sameer Naik 6a4938da7b
Merge pull request #68 from satyadeep/satyadeep-patch-1
Update entrypoint.sh
2019-03-22 11:23:49 +05:30
satyadeep b20cea7844
Update entrypoint.sh
Add support for docker secrets for Root Password for webmin
2019-03-22 03:16:05 +05:30
Sameer Naik a2c9ca757d
release 9.11.3-20190315 2019-03-15 07:30:11 +05:30
Sameer Naik 157faad1bd
update baseimage to ubuntu:bionic-20190307
Signed-off-by: Sameer Naik <sameer@damagehead.com>
2019-03-15 07:29:19 +05:30
Sameer Naik 51a8b50a1f
release 9.11.3-20190113 2019-01-13 15:47:48 +05:30
Sameer Naik 7a91928b0e
configure stalebot 2019-01-13 15:43:31 +05:30
Sameer Naik ba5e724c02
Merge pull request #66 from sameersbn/baseimage-update
update baseimage to ubuntu:bionic-20181204
2019-01-13 15:42:46 +05:30
Sameer Naik f62f07cb66
webmin: upgrade to 1.9 2019-01-13 15:38:52 +05:30
Sameer Naik bfcdff8f71
update circle config
Signed-off-by: Sameer Naik <sameer@damagehead.com>
2019-01-13 15:36:02 +05:30
Sameer Naik 79c1065712
update baseimage to ubuntu:bionic-20181204
Signed-off-by: Sameer Naik <sameer@damagehead.com>
2019-01-13 15:34:57 +05:30
Sameer Naik 77878c000f
Merge branch 'circle-ci' 2018-08-19 16:17:37 +05:30
Sameer Naik 63ed45857f
migrate to circle ci 2.0 2018-08-19 16:15:22 +05:30
Sameer Naik da43928903
release 9.11.3-20180713 2018-07-13 08:40:21 +05:30
Sameer Naik ed3ccc9573
optimize image size with multistage builds 2018-07-13 08:39:38 +05:30
Sameer Naik 175fae336e
switch to ubuntu:bionic-20180526, bump bind version to 9.11.3 2018-07-12 21:40:38 +05:30
Sameer Naik 19afb89086
release 9.10.3-20180712 2018-07-12 21:40:38 +05:30
Sameer Naik ab1a6b73ed
switch to ubuntu:xenial-20180525 base image 2018-07-12 21:40:38 +05:30
Sameer Naik e2ce4dad28 Merge branch 'release-9.10.3-20180127' 2018-01-27 00:01:25 +05:30
Sameer Naik 8104c46bea release 9.10.3-20180127 2018-01-27 00:00:51 +05:30
Sameer Naik 3eec174f44 upgrade to sameersbn/ubuntu:16.04.20180124 2018-01-26 23:59:22 +05:30
Sameer Naik ce8dbb49f0
dockerfile: drop VOLUME instruction 2017-06-26 22:24:47 +05:30
Sameer Naik bbf9f8c14c
readme: use https link to login to webmin 2017-06-26 21:42:15 +05:30
Sameer Naik 671fa0e9f4
release 9.9.5-20170626 2017-06-26 21:31:33 +05:30
Sameer Naik 7fa639d7da
upgrade to `sameersbn/ubuntu:14.04.20170608` 2017-06-26 21:30:52 +05:30
Sameer Naik 8b9b69e454
Merge branch 'stevesbrain-master' 2017-06-26 21:30:40 +05:30
Steve Divskinsy e256aa6f60 Install dnsutils
DNSUtils necessary to provide "dig", which is necessary for AXFR's in slave zones
2017-03-16 09:53:15 +10:30
Sameer Naik c2c5bc87af
release 9.9.5-20170129 2017-01-29 21:13:19 +05:30
Sameer Naik e66db15aa6
upgrade to `sameersbn/ubuntu:14.04.20170123` 2017-01-29 21:11:12 +05:30
Sameer Naik 96fa6a4b7d
release 9.9.5-20170115 2017-01-15 18:52:18 +05:30
Sameer Naik 9bd81a506c
remove whitespaces 2017-01-15 18:51:12 +05:30
Sameer Naik 2a259019b9 Merge pull request #23 from Seth-Miller/patch-1
Update entrypoint.sh
2017-01-12 12:16:25 +05:30
Seth Miller c02ca7064d Update entrypoint.sh
Move chown and chmod of BIND_DATA_DIR to after the the overwrite from /etc/bind to avoid permissions change from mv command.
2017-01-11 23:32:32 -06:00
Sameer Naik 654a7c273d upgrade to `sameersbn/ubuntu:14.04.20170110` 2017-01-10 22:13:55 +05:30
Sameer Naik b394cf4d4a webmin: pin to `1.8xx` series 2017-01-10 20:57:20 +05:30
9 changed files with 500 additions and 41 deletions

327
.circleci/config.yml Normal file
View File

@ -0,0 +1,327 @@
version: 2.1
orbs:
shellcheck: circleci/shellcheck@1.3.16
docker: circleci/docker@1.0.1
go: circleci/go@1.1.1
commands:
docker-build:
description: |
Build and optionally deploy a Docker images
parameters:
dockerfile:
default: Dockerfile
description: 'Name of dockerfile to use, defaults to Dockerfile'
type: string
extra_build_args:
default: ''
description: >
Extra flags to pass to docker build. For examples, see
https://docs.docker.com/engine/reference/commandline/build
type: string
registry:
default: docker.io
description: |
Comma separated list of registry to use, defaults to docker.io
type: string
image:
description: Name of image to build
type: string
tag:
default: $CIRCLE_SHA1
description: 'Image tag, defaults to the value of $CIRCLE_SHA1'
type: string
path:
default: .
description: >
Path to the directory containing your Dockerfile and build context,
defaults to . (working directory)
type: string
cache_from:
default: ''
description: >
Comma-separated list of images, images will first be pulled, then passed
as the --cache-from build argument
https://docs.docker.com/engine/reference/commandline/build/
type: string
no_output_timeout:
default: 10m
description: |
No output timeout for build step
type: string
steps:
- when:
condition: <<parameters.cache_from>>
steps:
- run:
name: Build image for <<parameters.registry>>
no_output_timeout: <<parameters.no_output_timeout>>
command: >
echo "<<parameters.cache_from>>" | sed -n 1'p' | tr ',' '\n' |
while read image; do
echo "Pulling ${image}";
docker pull ${image} || true
done
docker_tag_args=""
IFS="," read -ra DOCKER_REGISTRIES \<<< "<< parameters.registry >>"
for registry in "${DOCKER_REGISTRIES[@]}"; do
IFS="," read -ra DOCKER_TAGS \<<< "<< parameters.tag >>"
for tag in "${DOCKER_TAGS[@]}"; do
docker_tag_args="$docker_tag_args -t $registry/<<parameters.image>>:${tag}"
done
done
docker build
<<#parameters.extra_build_args>><<parameters.extra_build_args>><</parameters.extra_build_args>>
\
--cache-from <<parameters.cache_from>> \
-f <<parameters.path>>/<<parameters.dockerfile>> \
$docker_tag_args \
<<parameters.path>>
- unless:
condition: <<parameters.cache_from>>
steps:
- run:
name: Building image for <<parameters.registry>>
no_output_timeout: <<parameters.no_output_timeout>>
command: >
docker_tag_args=""
IFS="," read -ra DOCKER_REGISTRIES \<<< "<< parameters.registry >>"
for registry in "${DOCKER_REGISTRIES[@]}"; do
IFS="," read -ra DOCKER_TAGS \<<< "<< parameters.tag >>"
for tag in "${DOCKER_TAGS[@]}"; do
docker_tag_args="$docker_tag_args -t $registry/<<parameters.image>>:${tag}"
done
done
docker build
<<#parameters.extra_build_args>><<parameters.extra_build_args>><</parameters.extra_build_args>>
\
-f <<parameters.path>>/<<parameters.dockerfile>> \
$docker_tag_args \
<<parameters.path>>
docker-save:
description: |
Save one or more images to a tar archive
parameters:
registry:
default: docker.io
description: |
Comma separated list of registry to use, defaults to docker.io
type: string
image:
description: Name of image to build
type: string
tag:
default: $CIRCLE_SHA1
description: 'Image tag, defaults to the value of $CIRCLE_SHA1'
type: string
steps:
- run:
name: Save image to tar archive
command: >
docker_images=""
IFS="," read -ra DOCKER_REGISTRIES \<<< "<< parameters.registry >>"
for registry in "${DOCKER_REGISTRIES[@]}"; do
IFS="," read -ra DOCKER_TAGS \<<< "<< parameters.tag >>"
for tag in "${DOCKER_TAGS[@]}"; do
docker_images="$docker_images $registry/<<parameters.image>>:${tag}"
done
done
mkdir -p ~/docker/
docker save -o ~/docker/docker-images.tar $docker_images
- persist_to_workspace:
root: ~/
paths:
- docker
docker-load:
description: |
Load tar archive
steps:
- attach_workspace:
at: ~/
- run:
name: Load images from tar archive
command: >
docker load -i ~/docker/docker-images.tar
docker-publish:
description: |
Build and optionally deploy a Docker images
parameters:
pr:
default: ''
type: string
registry:
default: docker.io
description: |
Comma separated list of registry to use, defaults to docker.io
type: string
image:
description: Name of image to build
type: string
tag:
default: $CIRCLE_SHA1
description: 'Image tag, defaults to the value of $CIRCLE_SHA1'
type: string
steps:
- unless:
condition: <<parameters.pr>>
steps:
- run:
name: Publish image for <<parameters.registry>>
command: >
IFS="," read -ra DOCKER_REGISTRIES \<<< "<< parameters.registry >>"
for registry in "${DOCKER_REGISTRIES[@]}"; do
IFS="," read -ra DOCKER_TAGS \<<< "<< parameters.tag >>"
for tag in "${DOCKER_TAGS[@]}"; do
docker push $registry/<< parameters.image>>:${tag}
done
done
jobs:
build:
executor: docker/machine
steps:
- checkout
- docker-build:
registry: docker.io,quay.io
image: sameersbn/bind
tag: ${CIRCLE_TAG:-latest}
cache_from: docker.io/sameersbn/bind:latest
- docker-save:
registry: docker.io,quay.io
image: sameersbn/bind
tag: ${CIRCLE_TAG:-latest}
test:
executor: docker/machine
steps:
- checkout
- docker-load
- run:
name: Create test network
command: docker network create testnet
- run:
name: Launch bind container
command: docker run --name bind -d --net testnet sameersbn/bind:${CIRCLE_TAG:-latest}
- run:
name: Wait for bootup
command: sleep 15
- run:
name: Container info
command: docker ps
- run:
name: Test image
command: |
docker run --rm --net testnet sameersbn/bind:${CIRCLE_TAG:-latest} host www.google.com bind
publish-dockerhub:
executor: docker/machine
steps:
- docker-load
- docker/check:
registry: docker.io
docker-username: DOCKER_LOGIN
docker-password: DOCKER_PASSWORD
- docker-publish:
registry: docker.io
image: sameersbn/bind
tag: ${CIRCLE_TAG:-latest}
publish-quay:
executor: docker/machine
steps:
- docker-load
- docker/check:
registry: quay.io
docker-username: DOCKER_LOGIN
docker-password: DOCKER_PASSWORD
- docker-publish:
registry: quay.io
image: sameersbn/bind
tag: ${CIRCLE_TAG:-latest}
release:
executor:
name: go/default
tag: '1.14'
steps:
- checkout
- run:
name: Installing github-release tool
command: go get github.com/meterup/github-release
- run:
name: Creating github release
command: |
PRE_RELEASE=${CIRCLE_TAG/${CIRCLE_TAG%-rc[0-9]*}/}
github-release delete -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t ${CIRCLE_TAG} 2>/dev/null ||:
./scripts/release-notes.sh ${CIRCLE_TAG} | github-release release ${PRE_RELEASE:+-p} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t ${CIRCLE_TAG} -d -
for f in $(find /tmp/dist -type f); do github-release upload -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t ${CIRCLE_TAG} -n $(basename ${f}) -f ${f} ; done
workflows:
build-test-and-release:
jobs:
- shellcheck/check:
name: shellcheck
ignore: SC2086,SC2181,SC2124
filters:
tags:
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
- build:
requires:
- shellcheck
filters:
tags:
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
- test:
requires:
- build
filters:
tags:
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
- publish-dockerhub:
context: dockerhub
requires:
- test
filters:
branches:
only: master
tags:
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
- publish-quay:
context: quay
requires:
- test
filters:
tags:
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
branches:
only: master
- release:
context: github
requires:
- publish-dockerhub
- publish-quay
filters:
tags:
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
branches:
ignore: /.*/

17
.github/stale.yml vendored Normal file
View File

@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

View File

@ -1,22 +1,36 @@
FROM sameersbn/ubuntu:14.04.20161217
MAINTAINER sameer@damagehead.com
FROM ubuntu:focal-20200423 AS add-apt-repositories
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y gnupg \
&& apt-key adv --fetch-keys http://www.webmin.com/jcameron-key.asc \
&& echo "deb http://download.webmin.com/download/repository sarge contrib" >> /etc/apt/sources.list
FROM ubuntu:focal-20200423
LABEL maintainer="sameer@damagehead.com"
ENV BIND_USER=bind \
BIND_VERSION=1:9.9.5 \
WEBMIN_VERSION=1.830 \
BIND_VERSION=9.16.1 \
WEBMIN_VERSION=1.941 \
DATA_DIR=/data
COPY --from=add-apt-repositories /etc/apt/trusted.gpg /etc/apt/trusted.gpg
COPY --from=add-apt-repositories /etc/apt/sources.list /etc/apt/sources.list
RUN rm -rf /etc/apt/apt.conf.d/docker-gzip-indexes \
&& wget http://www.webmin.com/jcameron-key.asc -qO - | apt-key add - \
&& echo "deb http://download.webmin.com/download/repository sarge contrib" >> /etc/apt/sources.list \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y bind9=${BIND_VERSION}* bind9-host=${BIND_VERSION}* webmin=${WEBMIN_VERSION}* \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
bind9=1:${BIND_VERSION}* bind9-host=1:${BIND_VERSION}* dnsutils \
webmin=${WEBMIN_VERSION}* \
&& rm -rf /var/lib/apt/lists/*
COPY entrypoint.sh /sbin/entrypoint.sh
RUN chmod 755 /sbin/entrypoint.sh
EXPOSE 53/udp 53/tcp 10000/tcp
VOLUME ["${DATA_DIR}"]
ENTRYPOINT ["/sbin/entrypoint.sh"]
CMD ["/usr/sbin/named"]

View File

@ -1,6 +1,6 @@
[![Circle CI](https://circleci.com/gh/sameersbn/docker-bind.svg?style=shield)](https://circleci.com/gh/sameersbn/docker-bind) [![Docker Repository on Quay.io](https://quay.io/repository/sameersbn/bind/status "Docker Repository on Quay.io")](https://quay.io/repository/sameersbn/bind)
# sameersbn/bind:9.9.5-20161229
# sameersbn/bind:9.16.1-20200524
- [Introduction](#introduction)
- [Contributing](#contributing)
@ -49,7 +49,7 @@ Automated builds of the image are available on [Dockerhub](https://hub.docker.co
> **Note**: Builds are also available on [Quay.io](https://quay.io/repository/sameersbn/bind)
```bash
docker pull sameersbn/bind:9.9.5-20161229
docker pull sameersbn/bind:9.16.1-20200524
```
Alternatively you can build the image yourself.
@ -66,12 +66,12 @@ Start BIND using:
docker run --name bind -d --restart=always \
--publish 53:53/tcp --publish 53:53/udp --publish 10000:10000/tcp \
--volume /srv/docker/bind:/data \
sameersbn/bind:9.9.5-20161229
sameersbn/bind:9.16.1-20200524
```
*Alternatively, you can use the sample [docker-compose.yml](docker-compose.yml) file to start the container using [Docker Compose](https://docs.docker.com/compose/)*
When the container is started the [Webmin](http://www.webmin.com/) service is also started and is accessible from the web browser at http://localhost:10000. Login to Webmin with the username `root` and password `password`. Specify `--env ROOT_PASSWORD=secretpassword` on the `docker run` command to set a password of your choosing.
When the container is started the [Webmin](http://www.webmin.com/) service is also started and is accessible from the web browser at https://localhost:10000. Login to Webmin with the username `root` and password `password`. Specify `--env ROOT_PASSWORD=secretpassword` on the `docker run` command to set a password of your choosing.
The launch of Webmin can be disabled by adding `--env WEBMIN_ENABLED=false` to the `docker run` command. Note that the `ROOT_PASSWORD` parameter has no effect when the launch of Webmin is disabled.
@ -85,7 +85,7 @@ You can customize the launch command of BIND server by specifying arguments to `
docker run --name bind -it --rm \
--publish 53:53/tcp --publish 53:53/udp --publish 10000:10000/tcp \
--volume /srv/docker/bind:/data \
sameersbn/bind:9.9.5-20161229 -h
sameersbn/bind:9.16.1-20200524 -h
```
## Persistence
@ -101,6 +101,20 @@ mkdir -p /srv/docker/bind
chcon -Rt svirt_sandbox_file_t /srv/docker/bind
```
## Reverse Proxying
If you need to run Webmin behind a reverse-proxy such as Nginx, you can tweak the following environment variables:
* `WEBMIN_INIT_SSL_ENABLED`: If Webmin should be served via SSL or not. Defaults to `true`.
If you do the SSL termination at an earlier stage, set this to false.
* `WEBMIN_INIT_REDIRECT_PORT`: The port Webmin is served from.
Set this to your reverse proxy port, such as `443`. Defaults to `10000`.
* `WEBMIN_INIT_REFERERS`: Sets the allowed referrers to Webmin.
Set this to your domain name of the reverse proxy. Example: `mywebmin.example.com`.
Defaults to empty (no referrer).
# Maintenance
## Upgrading
@ -110,7 +124,7 @@ To upgrade to newer releases:
1. Download the updated Docker image:
```bash
docker pull sameersbn/bind:9.9.5-20161229
docker pull sameersbn/bind:9.16.1-20200524
```
2. Stop the currently running image:
@ -130,7 +144,7 @@ To upgrade to newer releases:
```bash
docker run -name bind -d \
[OPTIONS] \
sameersbn/bind:9.9.5-20161229
sameersbn/bind:9.16.1-20200524
```
## Shell Access

View File

@ -1 +1 @@
9.9.5-20161229
9.16.1-20200524

View File

@ -1,16 +0,0 @@
machine:
services:
- docker
environment:
DOCKER_PROJECT: sameersbn
IMAGE_NAME: bind
dependencies:
override:
- docker info
test:
override:
- docker build --rm=false -t $DOCKER_PROJECT/$IMAGE_NAME .
- docker run --name $IMAGE_NAME -d $DOCKER_PROJECT/$IMAGE_NAME; sleep 10
- docker run -it --link bind:dns-server $DOCKER_PROJECT/$IMAGE_NAME host www.google.com dns-server

View File

@ -3,7 +3,7 @@ version: '2'
services:
bind:
restart: always
image: sameersbn/bind:9.9.5-20161106
image: sameersbn/bind:9.16.1-20200524
ports:
- "53:53/udp"
- "53:53/tcp"

View File

@ -1,16 +1,41 @@
#!/bin/bash
set -e
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
file_env 'ROOT_PASSWORD'
ROOT_PASSWORD=${ROOT_PASSWORD:-password}
WEBMIN_ENABLED=${WEBMIN_ENABLED:-true}
WEBMIN_INIT_SSL_ENABLED=${WEBMIN_INIT_SSL_ENABLED:-true}
WEBMIN_INIT_REDIRECT_PORT=${WEBMIN_INIT_REDIRECT_PORT:-10000}
WEBMIN_INIT_REFERERS=${WEBMIN_INIT_REFERERS:-NONE}
BIND_DATA_DIR=${DATA_DIR}/bind
WEBMIN_DATA_DIR=${DATA_DIR}/webmin
create_bind_data_dir() {
mkdir -p ${BIND_DATA_DIR}
chmod -R 0775 ${BIND_DATA_DIR}
chown -R ${BIND_USER}:${BIND_USER} ${BIND_DATA_DIR}
# populate default bind configuration if it does not exist
if [ ! -d ${BIND_DATA_DIR}/etc ]; then
@ -18,6 +43,8 @@ create_bind_data_dir() {
fi
rm -rf /etc/bind
ln -sf ${BIND_DATA_DIR}/etc /etc/bind
chmod -R 0775 ${BIND_DATA_DIR}
chown -R ${BIND_USER}:${BIND_USER} ${BIND_DATA_DIR}
if [ ! -d ${BIND_DATA_DIR}/lib ]; then
mkdir -p ${BIND_DATA_DIR}/lib
@ -40,30 +67,57 @@ create_webmin_data_dir() {
ln -sf ${WEBMIN_DATA_DIR}/etc /etc/webmin
}
disable_webmin_ssl() {
sed -i 's/ssl=1/ssl=0/g' /etc/webmin/miniserv.conf
}
set_webmin_redirect_port() {
echo "redirect_port=$WEBMIN_INIT_REDIRECT_PORT" >> /etc/webmin/miniserv.conf
}
set_webmin_referers() {
echo "referers=$WEBMIN_INIT_REFERERS" >> /etc/webmin/config
}
set_root_passwd() {
echo "root:$ROOT_PASSWORD" | chpasswd
}
create_pid_dir() {
mkdir -m 0775 -p /var/run/named
mkdir -p /var/run/named
chmod 0775 /var/run/named
chown root:${BIND_USER} /var/run/named
}
create_bind_cache_dir() {
mkdir -m 0775 -p /var/cache/bind
mkdir -p /var/cache/bind
chmod 0775 /var/cache/bind
chown root:${BIND_USER} /var/cache/bind
}
first_init() {
if [ ! -f /data/.initialized ]; then
set_webmin_redirect_port
if [ "${WEBMIN_INIT_SSL_ENABLED}" == "false" ]; then
disable_webmin_ssl
fi
if [ "${WEBMIN_INIT_REFERERS}" != "NONE" ]; then
set_webmin_referers
fi
touch /data/.initialized
fi
}
create_pid_dir
create_bind_data_dir
create_bind_cache_dir
# allow arguments to be passed to named
if [[ ${1:0:1} = '-' ]]; then
EXTRA_ARGS="$@"
EXTRA_ARGS="$*"
set --
elif [[ ${1} == named || ${1} == $(which named) ]]; then
EXTRA_ARGS="${@:2}"
elif [[ ${1} == named || ${1} == "$(command -v named)" ]]; then
EXTRA_ARGS="${*:2}"
set --
fi
@ -71,13 +125,14 @@ fi
if [[ -z ${1} ]]; then
if [ "${WEBMIN_ENABLED}" == "true" ]; then
create_webmin_data_dir
first_init
set_root_passwd
echo "Starting webmin..."
/etc/init.d/webmin start
fi
echo "Starting named..."
exec $(which named) -u ${BIND_USER} -g ${EXTRA_ARGS}
exec "$(command -v named)" -u ${BIND_USER} -g ${EXTRA_ARGS}
else
exec "$@"
fi

48
scripts/release-notes.sh Executable file
View File

@ -0,0 +1,48 @@
#!/usr/bin/env sh
RELEASE=${GIT_TAG:-$1}
if [ -z "${RELEASE}" ]; then
echo "Usage:"
echo "./scripts/release-notes.sh v0.1.0"
exit 1
fi
if ! git rev-list ${RELEASE} >/dev/null 2>&1; then
echo "${RELEASE} does not exist"
exit
fi
PREV_RELEASE=${PREV_RELEASE:-$(git describe --tags --abbrev=0 ${RELEASE}^)}
PREV_RELEASE=${PREV_RELEASE:-$(git rev-list --max-parents=0 ${RELEASE}^)}
NOTABLE_CHANGES=$(git cat-file -p ${RELEASE} | sed '/-----BEGIN PGP SIGNATURE-----/,//d' | tail -n +6)
CHANGELOG=$(git log --no-merges --pretty=format:'- [%h] %s (%aN)' ${PREV_RELEASE}..${RELEASE})
if [ $? -ne 0 ]; then
echo "Error creating changelog"
exit 1
fi
cat <<EOF
${NOTABLE_CHANGES}
## Docker Images for sameersbn/bind:${RELEASE}
- [docker.io](https://hub.docker.com/r/sameersbn/bind/tags)
- [quay.io](https://quay.io/repository/sameersbn/bind?tag=${RELEASE}&tab=tags)
## Installation
For installation and usage instructions please refer to the [README](https://github.com/sameersbn/docker-bind/blob/${RELEASE}/README.md)
## Contributing
If you find this image useful here's how you can help:
- Send a Pull Request with your awesome new features and bug fixes
- Be a part of the community and help resolve [issues](https://github.com/sameersbn/docker-bind/issues)
- Support the development of this image with a [donation](http://www.damagehead.com/donate/)
## Changelog
${CHANGELOG}
EOF