first commit

This commit is contained in:
MReenen 2018-06-04 14:27:52 +02:00
commit d9f315cd8f
12 changed files with 175 additions and 0 deletions

20
adddomain Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash
cat > /etc/bind/named.conf.domains/$1.conf <<EOF
zone "$1" {
type master;
file "/etc/bind/named.conf.domain/db.$1";
};
EOF
cat > /etc/bind/named.conf.domain/db.$1 <<EOF
$TTL 604800
@ IN SOA $1. root.$1. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN A $2
EOF

23
bugs.md Normal file
View File

@ -0,0 +1,23 @@
#all bugs and improfments of the installer
##bugs
no bugs known yet
##maiger improfments
- add ssl support to nginx
- proxy/dns: add static IP or add firewall
- dns: edit dns record
##improfments
- hard set containers to correct storage and bridge
- add IP and NAT to the bridge
- proxy/enablesite: check if site exist
- proxy/newsite: check is site already exist
- proxy: remove and update site
- dns: add record template
## for next version
- add software support for nextcloud, webmail, etc.
- add NAS
- add mail servers
- add management server

20
dns/adddomain Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash
cat > /etc/bind/named.conf.domains/$1.conf <<EOF
zone "$1" {
type master;
file "/etc/bind/named.conf.domain/db.$1";
};
EOF
cat > /etc/bind/named.conf.domain/db.$1 <<EOF
$TTL 604800
@ IN SOA $1. root.$1. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN A $2
EOF

2
dns/named.conf Normal file
View File

@ -0,0 +1,2 @@
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.domains/*.conf";

10
dns/named.conf.options Normal file
View File

@ -0,0 +1,10 @@
options {
directory "/var/cache/bind";
forwarders {
8.8.8.8;
8.8.4.4;
};
dnssec-validation auto;
auth-nxdomain no;
listen-on-v6 { any; };
};

2
named.conf Normal file
View File

@ -0,0 +1,2 @@
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.domains/*.conf";

10
named.conf.options Normal file
View File

@ -0,0 +1,10 @@
options {
directory "/var/cache/bind";
forwarders {
8.8.8.8;
8.8.4.4;
};
dnssec-validation auto;
auth-nxdomain no;
listen-on-v6 { any; };
};

3
proxy/enablesite Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
ln -s /etc/nginx/site-available/$1 /etc/nginx/site-enabled/$1

12
proxy/newsite Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
cat > /etc/nginx/sites-available/$1 <<EOF
server {
listen 80 default_server;
#listen 443 ssl default_server;
server_name $1;
location / {
proxy_pass $2
}
}
EOF

0
readme.md Normal file
View File

33
setup.sh Normal file
View File

@ -0,0 +1,33 @@
#/bin/bash
apt-get update
apt-get upgrade -y
apt-get install lxd
lxc storage create SSD dir
#TODO: add IP and NAT.
lxc network create brlive0
# create proxy
lxc launch ubuntu:18.04 proxy
lxc exec proxy -- apt-get update
lxc exec proxy -- apt-get upgrade -y
lxc exec proxy -- apt-get install nginx
lxc file push ./proxy/newsite proxy/root/newsite
lxc file puxh ./proxy/enablesite proxy/root/enablesite
lxc exec proxy -- chmod +x /root/newsite
lxc exec proxy -- chmod +x /root/enablesite
# create DNS
lxc lanch ubuntu:18.04 dns
lxc exec dns -- apt-get update
lxc exec dns -- apt-get upgrade -y
lxc exec dns -- apt-get install bind9
lxc exec dns -- mkdir /etc/bind/named.conf.domains
lxc exec dns -- mv /etc/bind/named.conf.options /etc/bind/named.conf.options.backup
lxc exec dns -- mv /etc/bind/named.conf.local /etc/bind/named.conf.local.backup
lxc exec dns -- mv /etc/bind/named.conf.default-zones /etc/bind/named.conf.default-zones.backup
lxc exec dns -- ./dns/*.conf.* dns/etc/nginx/
lxc file push ./dns/adddomain dns/root/adddomain
lxc exec dns -- chmod +x /root/adddomain

40
tmpTsServer.sh Normal file
View File

@ -0,0 +1,40 @@
#/bin/bash
apt-get update
apt-get upgrade -y
snap install openscad-plars
snap install spotify
snap isntall atom --classic
snap install kicad-snap
apt-get install x11vnc unzip
wget -O novnc.zip https://github.com/novnc/noVNC/archive/v1.0.0.zip
unzip novnc.zip
mkdir /usr/share/novnc
mv noVNC-1.0.0/* /usr/share/novnc/
x11vnc -storepasswd
mkdir /etc/x11vnc
mv /root/.vnc/passwd /etc/x11vnc/
chmod 700 /etc/x11vnc/passwd
chown root:root /etc/x11vnc/passwd
cat >> /etc/bash.bashrc <<EOF
#added by setup script
# launch noVNC
/usr/share/novnc/utils/launch.sh --vnc localhost:5900 --listen 80
# launch x11vnc
/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc/passwd -rfbport 5900 -shared
EOF
cat > /usr/local/applications/openscad.desktop <<EOF
[Desktop Entry]
Name=OpenSCAD
Comment=Opensource CAD software
Exec=openscad-plars
Icon=/snap/openscad-plars/current/icon.png
Type=Application
StartupNotify=false
#Categories=
EOF