Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New script: Unbound LXC #547

Merged
merged 29 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c2f7d55
Create unbound-install.sh
wimb0 Nov 27, 2024
28a45e5
Create unbound.sh
wimb0 Nov 27, 2024
e82c177
Update unbound.sh
wimb0 Nov 27, 2024
09f5a00
Update unbound.sh
wimb0 Nov 27, 2024
2c2f7f7
Update unbound-install.sh
wimb0 Nov 27, 2024
1f0682a
Update unbound.sh
wimb0 Nov 27, 2024
9839ab0
Create unbound.json
wimb0 Nov 27, 2024
10d2ba8
Fix logo font
wimb0 Nov 27, 2024
11a6700
Update unbound-install.sh
wimb0 Nov 27, 2024
6c23f96
Update unbound-install.sh
wimb0 Nov 27, 2024
c315483
Update unbound-install.sh
wimb0 Nov 27, 2024
174d682
Update unbound-install.sh
wimb0 Nov 27, 2024
20634b0
Update install/unbound-install.sh
wimb0 Nov 28, 2024
ed6df66
Update install/unbound-install.sh
wimb0 Nov 28, 2024
0e46010
Update unbound-install.sh
wimb0 Nov 28, 2024
efb38df
Update install/unbound-install.sh
wimb0 Nov 28, 2024
607c6ee
Update install/unbound-install.sh
wimb0 Nov 28, 2024
9d0bad8
Update install/unbound-install.sh
wimb0 Nov 28, 2024
5ecf566
Update install/unbound-install.sh
wimb0 Nov 28, 2024
b2c2666
Update install/unbound-install.sh
wimb0 Nov 28, 2024
14d6e3e
Update install/unbound-install.sh
wimb0 Nov 28, 2024
c4de5a3
Update json/unbound.json
wimb0 Nov 28, 2024
faf9868
Update install/unbound-install.sh
wimb0 Nov 28, 2024
c855e23
Update install/unbound-install.sh
wimb0 Nov 28, 2024
88a09d5
Update unbound.json
wimb0 Nov 28, 2024
4e19376
Update install/unbound-install.sh
wimb0 Nov 28, 2024
3ca230b
Update install/unbound-install.sh
wimb0 Nov 28, 2024
f3a4e06
Update install/unbound-install.sh
wimb0 Nov 28, 2024
0e17b61
Update unbound-install.sh
wimb0 Nov 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions ct/unbound.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2024 community-scripts ORG
# Author: wimb0
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE

function header_info {
clear
cat <<"EOF"
::: ::: :::: ::: ::::::::: :::::::: ::: ::: :::: ::: :::::::::
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
:+: :+: :+:+: :+: :+: :+: :+: :+: :+: :+: :+:+: :+: :+: :+:
+:+ +:+ :+:+:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ :+:+:+ +:+ +:+ +:+
+#+ +:+ +#+ +:+ +#+ +#++:++#+ +#+ +:+ +#+ +:+ +#+ +:+ +#+ +#+ +:+
+#+ +#+ +#+ +#+#+# +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+#+# +#+ +#+
#+# #+# #+# #+#+# #+# #+# #+# #+# #+# #+# #+# #+#+# #+# #+#
######## ### #### ######### ######## ######## ### #### #########

EOF
}
header_info
echo -e "Loading..."
APP="Unbound"
var_disk="2"
var_cpu="1"
var_ram="512"
var_os="debian"
var_version="12"
variables
color
catch_errors

function default_settings() {
CT_TYPE="1"
PW=""
CT_ID=$NEXTID
HN=$NSAPP
DISK_SIZE="$var_disk"
CORE_COUNT="$var_cpu"
RAM_SIZE="$var_ram"
BRG="vmbr0"
NET="dhcp"
GATE=""
APT_CACHER=""
APT_CACHER_IP=""
DISABLEIP6="no"
MTU=""
SD=""
NS=""
MAC=""
VLAN=""
SSH="no"
VERB="no"
echo_default
}

function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /etc/unbound ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_info "Updating $APP LXC"
apt-get update &>/dev/null
apt-get -y upgrade &>/dev/null
msg_ok "Updated $APP LXC"
exit
}

start
build_container
description

msg_ok "Completed Successfully!\n"
echo -e "${APP} should be online.
${BL} Set your DNS server to ${IP}:5335 ${CL} \n"
110 changes: 110 additions & 0 deletions install/unbound-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/usr/bin/env bash

# Copyright (c) 2021-2024 community-scripts ORG
# Author: wimb0
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE

source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os

msg_info "Installing Unbound"
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
$STD apt-get install -y unbound unbound-host
wimb0 marked this conversation as resolved.
Show resolved Hide resolved

cat <<EOF >/etc/unbound/unbound.conf.d/unbound-lxe.conf
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
server:
verbosity: 0
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
interface: 0.0.0.0
port: 5335
do-ip6: no
do-ip4: yes
do-udp: yes
do-tcp: yes
num-threads: 1
hide-identity: yes
hide-version: yes
harden-glue: yes
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
harden-dnssec-stripped: yes
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
harden-referral-path: yes
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
use-caps-for-id: no
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
harden-algo-downgrade: no
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
qname-minimisation: yes
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
aggressive-nsec: yes
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
rrset-roundrobin: yes
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
cache-min-ttl: 300
cache-max-ttl: 14400
msg-cache-slabs: 8
havardthom marked this conversation as resolved.
Show resolved Hide resolved
rrset-cache-slabs: 8
infra-cache-slabs: 8
key-cache-slabs: 8
serve-expired: yes
root-hints: /var/lib/unbound/root.hints
serve-expired-ttl: 3600
edns-buffer-size: 1232
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
prefetch: yes
prefetch-key: yes
target-fetch-policy: "3 2 1 1 1"
unwanted-reply-threshold: 10000000
rrset-cache-size: 256m
msg-cache-size: 128m
so-rcvbuf: 1m
private-address: 192.168.0.0/16
private-address: 169.254.0.0/16
private-address: 172.16.0.0/12
private-address: 10.0.0.0/8
private-address: fd00::/8
private-address: fe80::/10
access-control: 192.168.0.0/16 allow
havardthom marked this conversation as resolved.
Show resolved Hide resolved
access-control: 172.16.0.0/12 allow
access-control: 10.0.0.0/8 allow
chroot: ""
logfile: /var/log/unbound.log
verbosity: 1
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
log-queries: yes
havardthom marked this conversation as resolved.
Show resolved Hide resolved
statistics-interval: 0
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
extended-statistics: yes
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
harden-below-nxdomain: yes
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
EOF

wget -qO /var/lib/unbound/root.hints https://www.internic.net/domain/named.root
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
chown unbound:unbound /var/lib/unbound/root.hints
wimb0 marked this conversation as resolved.
Show resolved Hide resolved

touch /var/log/unbound.log
chown unbound:unbound /var/log/unbound.log
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
systemctl enable -q --now unbound
msg_info "Restarting Unbound to load new config"
systemctl restart unbound
msg_ok "Installed Unbound"
wimb0 marked this conversation as resolved.
Show resolved Hide resolved

msg_ok "Configuring Logrotate"
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
wimb0 marked this conversation as resolved.
Show resolved Hide resolved
cat <<EOF >/etc/logrotate.d/unbound
/var/log/unbound.log {
daily
rotate 7
missingok
notifempty
compress
delaycompress
sharedscripts
create 644
postrotate
/usr/sbin/unbound-control log_reopen
endscript
}
EOF

msg_info "Restarting Logrotate"
systemctl restart logrotate
wimb0 marked this conversation as resolved.
Show resolved Hide resolved

motd_ssh
customize

msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"