Skip to content

Commit 342e145

Browse files
wimb0havardthom
andauthored
New script: Unbound LXC (#547)
* Create unbound-install.sh * Create unbound.sh * Update unbound.sh * Update unbound.sh * Update unbound-install.sh * Update unbound.sh * Create unbound.json * Fix logo font * Update unbound-install.sh * Update unbound-install.sh * Update unbound-install.sh * Update unbound-install.sh * Update install/unbound-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/unbound-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update unbound-install.sh * Update install/unbound-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/unbound-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/unbound-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/unbound-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/unbound-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/unbound-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update json/unbound.json Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/unbound-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/unbound-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update unbound.json * Update install/unbound-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/unbound-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/unbound-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update unbound-install.sh --------- Co-authored-by: Håvard Gjøby Thom <[email protected]>
1 parent 85b8039 commit 342e145

File tree

3 files changed

+206
-0
lines changed

3 files changed

+206
-0
lines changed

ct/unbound.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2024 community-scripts ORG
4+
# Author: wimb0
5+
# License: MIT
6+
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
7+
8+
function header_info {
9+
clear
10+
cat <<"EOF"
11+
__ __ __ __
12+
/ / / /___ / /_ ____ __ ______ ____/ /
13+
/ / / / __ \/ __ \/ __ \/ / / / __ \/ __ /
14+
/ /_/ / / / / /_/ / /_/ / /_/ / / / / /_/ /
15+
\____/_/ /_/_.___/\____/\__,_/_/ /_/\__,_/
16+
17+
EOF
18+
}
19+
header_info
20+
echo -e "Loading..."
21+
APP="Unbound"
22+
var_disk="2"
23+
var_cpu="1"
24+
var_ram="512"
25+
var_os="debian"
26+
var_version="12"
27+
variables
28+
color
29+
catch_errors
30+
31+
function default_settings() {
32+
CT_TYPE="1"
33+
PW=""
34+
CT_ID=$NEXTID
35+
HN=$NSAPP
36+
DISK_SIZE="$var_disk"
37+
CORE_COUNT="$var_cpu"
38+
RAM_SIZE="$var_ram"
39+
BRG="vmbr0"
40+
NET="dhcp"
41+
GATE=""
42+
APT_CACHER=""
43+
APT_CACHER_IP=""
44+
DISABLEIP6="no"
45+
MTU=""
46+
SD=""
47+
NS=""
48+
MAC=""
49+
VLAN=""
50+
SSH="no"
51+
VERB="no"
52+
echo_default
53+
}
54+
55+
function update_script() {
56+
header_info
57+
check_container_storage
58+
check_container_resources
59+
if [[ ! -d /etc/unbound ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
60+
msg_info "Updating $APP LXC"
61+
apt-get update &>/dev/null
62+
apt-get -y upgrade &>/dev/null
63+
msg_ok "Updated $APP LXC"
64+
exit
65+
}
66+
67+
start
68+
build_container
69+
description
70+
71+
msg_ok "Completed Successfully!\n"
72+
echo -e "${APP} should be online.
73+
${BL} Set your DNS server to ${IP}:5335 ${CL} \n"

install/unbound-install.sh

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2024 community-scripts ORG
4+
# Author: wimb0
5+
# License: MIT
6+
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
7+
8+
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
sudo \
19+
curl \
20+
mc
21+
msg_ok "Installed Dependencies"
22+
23+
msg_info "Installing Unbound"
24+
$STD apt-get install -y \
25+
unbound \
26+
unbound-host
27+
msg_info "Installed Unbound"
28+
29+
cat <<EOF >/etc/unbound/unbound.conf.d/unbound.conf
30+
server:
31+
interface: 0.0.0.0
32+
port: 5335
33+
do-ip6: no
34+
hide-identity: yes
35+
hide-version: yes
36+
harden-referral-path: yes
37+
cache-min-ttl: 300
38+
cache-max-ttl: 14400
39+
serve-expired: yes
40+
serve-expired-ttl: 3600
41+
prefetch: yes
42+
prefetch-key: yes
43+
target-fetch-policy: "3 2 1 1 1"
44+
unwanted-reply-threshold: 10000000
45+
rrset-cache-size: 256m
46+
msg-cache-size: 128m
47+
so-rcvbuf: 1m
48+
private-address: 192.168.0.0/16
49+
private-address: 169.254.0.0/16
50+
private-address: 172.16.0.0/12
51+
private-address: 10.0.0.0/8
52+
private-address: fd00::/8
53+
private-address: fe80::/10
54+
access-control: 192.168.0.0/16 allow
55+
access-control: 172.16.0.0/12 allow
56+
access-control: 10.0.0.0/8 allow
57+
access-control: 127.0.0.1/32 allow
58+
chroot: ""
59+
logfile: /var/log/unbound.log
60+
EOF
61+
62+
touch /var/log/unbound.log
63+
chown unbound:unbound /var/log/unbound.log
64+
65+
systemctl restart unbound
66+
msg_ok "Installed Unbound"
67+
68+
msg_ok "Configuring Logrotate"
69+
cat <<EOF >/etc/logrotate.d/unbound
70+
/var/log/unbound.log {
71+
daily
72+
rotate 7
73+
missingok
74+
notifempty
75+
compress
76+
delaycompress
77+
sharedscripts
78+
create 644
79+
postrotate
80+
/usr/sbin/unbound-control log_reopen
81+
endscript
82+
}
83+
EOF
84+
85+
systemctl restart logrotate
86+
msg_ok "Configured Logrotate"
87+
88+
motd_ssh
89+
customize
90+
91+
msg_info "Cleaning up"
92+
$STD apt-get -y autoremove
93+
$STD apt-get -y autoclean
94+
msg_ok "Cleaned"

json/unbound.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "Unbound",
3+
"slug": "unbound",
4+
"categories": [
5+
13
6+
],
7+
"date_created": "2024-11-27",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": "5335",
12+
"documentation": null,
13+
"website": "https://www.nlnetlabs.nl/projects/unbound/about/",
14+
"logo": "https://nlnetlabs.nl/static/logos/Unbound/Unbound_FC_Shaded_cropped.svg",
15+
"description": "Unbound is a validating, recursive, caching DNS resolver. It is designed to be fast and lean and incorporates modern features based on open standards.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/unbound.sh",
20+
"resources": {
21+
"cpu": "1",
22+
"ram": "512",
23+
"hdd": "2",
24+
"os": "debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": [
34+
{
35+
"text": "Unbound Configuration Path: `/etc/unbound/unbound.conf.d/unbound.conf`",
36+
"type": "info"
37+
}
38+
]
39+
}

0 commit comments

Comments
 (0)