Added ddns CT

This commit is contained in:
2021-09-21 15:46:34 +00:00
parent 2ee3236c2d
commit c536ad9487
7 changed files with 84 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
String[] ImgVariantList = ['minmal', 'default' , 'gitea' , 'nginx' ] String[] ImgVariantList = ['minimal', 'default' , 'gitea' , 'nginx' , 'ddns' ]
pipeline { pipeline {
agent { label 'LXCBuilder' } agent { label 'LXCBuilder' }

View File

@@ -287,6 +287,13 @@ files:
variants: variants:
- nginx - nginx
#FileForDdns
- path: /opt/Setup
generator: copy
source: CT-Files/ddns
variants:
- ddns
packages: packages:
manager: apk manager: apk
update: true update: true
@@ -322,6 +329,14 @@ packages:
variants: variants:
- gitea - gitea
#PKGS for Ddns
- packages:
- ddclient@TestingEdge
- perl-data-validate-ip@TestingEdge
action: install
variants:
- ddns
repositories: repositories:
- name: /etc/apk/repositories - name: /etc/apk/repositories
url: |- url: |-
@@ -329,6 +344,7 @@ packages:
http://192.168.2.83/alpine/v{{ image.release }}/main http://192.168.2.83/alpine/v{{ image.release }}/main
http://192.168.2.83/alpine/v{{ image.release }}/community http://192.168.2.83/alpine/v{{ image.release }}/community
#EndREPOS #EndREPOS
{% if image.variant == "ddns" %}@TestingEdge http://dl-4.alpinelinux.org/alpine/edge/testing{% endif %}
actions: actions:
@@ -367,6 +383,7 @@ actions:
variants: variants:
- gitea - gitea
- nginx - nginx
- ddns
mappings: mappings:
architecture_map: alpinelinux architecture_map: alpinelinux

View File

@@ -0,0 +1,7 @@
#General config
daemon=600
protocol=dyndns2
server=www.ovh.com
use=web,web=ifconfig.me/ip
ssl=yes
password='DefaultPassword'

View File

@@ -0,0 +1,44 @@
#!/bin/ash
##Check if DefaultPassword has been set
if grep -q DefaultPassword /etc/ddclient/ddclient.conf; then
DefPass=$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' 2>/dev/null </dev/urandom | head -c 20 ; echo )
sed -i -e 's/DefaultPassword/'$DefPass'/g' /etc/ddclient/ddclient.conf
echo $DefPass > /root/DefaultDDNSPasswd
echo "The default password in ddns config is now: $DefPass"
echo "Please re-run the command to add a domain"
exit
fi
#Get information about the domain
read -p "Enter domain to be added to DDNS: " domain
read -p "Enter the DDNS username for the domain: " username
while true; do
read -p "Use default DDNS password Y/N? " yn
case $yn in
[Yy]* ) password=Default;break;;
[Nn]* ) read -p "Enter the DDNS password domain: " -s password;echo ''; break;;
* ) echo "Please answer yes or no.";;
esac
done
#Update config
if test "$password" = "Default"; then
cat <<EOF >> /etc/ddclient/ddclient.conf
#$domain Config
login=$username
$domain
EOF
else
cat <<EOF >> /etc/ddclient/ddclient.conf
#$domain Config
login=$username
password='$password'
$domain
EOF
fi
#Restart service
service ddclient restart

View File

@@ -0,0 +1,9 @@
#!/bin/ash
#Update configs
mv /opt/Setup/Configs/ddclient.conf /etc/ddclient/ddclient.conf
mv /opt/Setup/Scripts/AddDomain.sh /opt/AddDomain.sh
#add ddns service to startup
rc-update add ddclient
#Update ReadMe
echo 'Use `ash /opt/AddDomain.sh` to add domains to ddns config' > ~/ReadMe

View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
read -p "Enter new password for mysql root: " -s NewMysqlPassword read -p "Enter new password for mysql root: " -s NewMysqlPassword
echo echo
#StaticVars #StaticVars

View File

@@ -77,3 +77,5 @@ Then select the created credential and click save
## gitea ## gitea
1. Edit the parameters in the FistRun script in the container `vi /opt/Setup/Scripts/FirstRun.sh` 1. Edit the parameters in the FistRun script in the container `vi /opt/Setup/Scripts/FirstRun.sh`
2. Run the FistRun scipt in the container `ash /opt/Setup/Scripts/FirstRun.sh` 2. Run the FistRun scipt in the container `ash /opt/Setup/Scripts/FirstRun.sh`
# nginx
1. Run the FistRun scipt in the container `ash /opt/Setup/Scripts/FirstRun.sh`