From 4128e903d32c1b27a811b5b010707a6d1c825f78 Mon Sep 17 00:00:00 2001 From: Pinga <121483313+getpinga@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:05:29 +0200 Subject: [PATCH] Added contact domain registrant module --- INSTALL.md | 15 +++++-- install.sh | 6 ++- update104.sh | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 134 insertions(+), 4 deletions(-) create mode 100644 update104.sh diff --git a/INSTALL.md b/INSTALL.md index ca36a3d..95168b3 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -407,7 +407,16 @@ mv fossbilling-whois/check.php /var/www/ - Edit the `/var/www/check.php` file and set your WHOIS and RDAP server URLs by replacing the placeholder values with your actual server addresses. -## 16. Installing FOSSBilling EPP-RFC Extensions: +## 16. Domain Registrant Contact: + +```bash +git clone https://github.com/getnamingo/fossbilling-contact +mv fossbilling-contact/Contact /var/www/modules/ +``` + +- Go to Extensions > Overview in the admin panel and activate "Domain Registrant Contact". + +## 17. Installing FOSSBilling EPP-RFC Extensions: For each registry you support, you will need to install a FOSSBilling EPP-RFC extension. @@ -415,13 +424,13 @@ Navigate to https://github.com/getpinga/fossbilling-epp-rfc and follow the insta To execute the required OT&E tests by various registries, you can use our Tembo client at https://github.com/getpinga/tembo -## 17. Installing FOSSBilling DNS Hosting Extensions: +## 18. Installing FOSSBilling DNS Hosting Extensions: To offer DNS hosting to your customers, you will need to install the FOSSBilling DNS Hosting extension. Navigate to https://github.com/getnamingo/fossbilling-dns and follow the installation instructions. -## 18. Further Settings: +## 19. Further Settings: 1. You will need to link to various ICANN documents in your footer, and also provide your terms and conditions and privacy policy. diff --git a/install.sh b/install.sh index 135977a..c2da381 100644 --- a/install.sh +++ b/install.sh @@ -436,9 +436,12 @@ if [[ "$install_rdap_whois" == "Y" || "$install_rdap_whois" == "y" ]]; then git clone https://github.com/getnamingo/fossbilling-whois mv fossbilling-whois/Whois /var/www/modules/ mv fossbilling-whois/check.php /var/www/ - + sed -i "s|\$whoisServer = 'whois.example.com';|\$whoisServer = 'whois.$domain_name';|g" /var/www/check.php sed -i "s|\$rdap_url = 'rdap.example.com';|\$rdap_url = 'rdap.$domain_name';|g" /var/www/check.php + + git clone https://github.com/getnamingo/fossbilling-contact + mv fossbilling-contact/Contact /var/www/modules/ git clone https://github.com/getnamingo/fossbilling-registrar mv fossbilling-registrar/Registrar /var/www/modules/ @@ -471,6 +474,7 @@ echo "7. In the FOSSBilling admin panel, go to Extensions > Overview and activat echo " - Domain Contact Verification" echo " - TMCH Claims Notice Support" echo " - WHOIS & RDAP Client" +echo " - Domain Registrant Contact" echo " - ICANN Registrar Accreditation" echo echo "8. Install FOSSBilling extensions for EPP and DNS as outlined in steps 16 and 17 of install.md." diff --git a/update104.sh b/update104.sh new file mode 100644 index 0000000..451f7dd --- /dev/null +++ b/update104.sh @@ -0,0 +1,117 @@ +#!/bin/bash + +# Prompt the user for confirmation +echo "This will update Namingo Registrar from v1.0.3 to v1.0.4." +echo "Make sure you have a backup of the database, /var/www, and /opt/registrar." +read -p "Are you sure you want to proceed? (y/n): " confirm + +# Check user input +if [[ "$confirm" != "y" ]]; then + echo "Upgrade aborted." + exit 0 +fi + +# Create backup directory +backup_dir="/opt/backup" +mkdir -p "$backup_dir" + +# Backup directories +echo "Creating backups..." +tar -czf "$backup_dir/panel_backup_$(date +%F).tar.gz" -C / var/www +tar -czf "$backup_dir/registrar_backup_$(date +%F).tar.gz" -C / opt/registrar + +# Database credentials +config_file="/opt/registrar/whois/config.php" +db_user=$(grep "'db_username'" "$config_file" | awk -F "=> '" '{print $2}' | sed "s/',//") +db_pass=$(grep "'db_password'" "$config_file" | awk -F "=> '" '{print $2}' | sed "s/',//") +db_host=$(grep "'db_host'" "$config_file" | awk -F "=> '" '{print $2}' | sed "s/',//") + +# List of databases to back up +databases=("registrar") + +# Backup specific databases +for db_name in "${databases[@]}"; do + echo "Backing up database $db_name..." + sql_backup_file="$backup_dir/db_${db_name}_backup_$(date +%F).sql" + mysqldump -u"$db_user" -p"$db_pass" -h"$db_host" "$db_name" > "$sql_backup_file" + + # Compress the SQL backup file + echo "Compressing database backup $db_name..." + tar -czf "${sql_backup_file}.tar.gz" -C "$backup_dir" "$(basename "$sql_backup_file")" + + # Remove the uncompressed SQL file + rm "$sql_backup_file" +done + +# Stop services +echo "Stopping services..." +systemctl stop nginx +systemctl stop whois +systemctl stop rdap + +# Clone the new version of the repository +echo "Cloning v1.0.4 from the repository..." +git clone https://github.com/getnamingo/registrar /opt/registrar104 + +# Copy files from the new version to the appropriate directories +echo "Copying files..." + +# Function to copy files and maintain directory structure +copy_files() { + src_dir=$1 + dest_dir=$2 + + if [[ -d "$src_dir" ]]; then + echo "Copying from $src_dir to $dest_dir..." + cp -R "$src_dir/." "$dest_dir/" + else + echo "Source directory $src_dir does not exist. Skipping..." + fi +} + +# Copy specific directories +copy_files "/opt/registrar104/automation" "/opt/registrar/automation" +copy_files "/opt/registrar104/whois" "/opt/registrar/whois" +copy_files "/opt/registrar104/rdap" "/opt/registrar/rdap" + +# Run composer update in copied directories (excluding docs) +echo "Running composer update..." + +composer_update() { + dir=$1 + if [[ -d "$dir" ]]; then + echo "Updating composer in $dir..." + cd "$dir" && composer update + else + echo "Directory $dir does not exist. Skipping composer update..." + fi +} + +# Update composer in relevant directories +composer_update "/opt/registrar/automation" +composer_update "/opt/registrar/whois" +composer_update "/opt/registrar/rdap" + +git clone https://github.com/getnamingo/fossbilling-contact +mv fossbilling-contact/Contact /var/www/modules/ + +# Start services +echo "Starting services..." +systemctl start nginx +systemctl start whois +systemctl start rdap + +# Check if services started successfully +if [[ $? -eq 0 ]]; then + echo "Services started successfully. Deleting /opt/registrar104..." + rm -rf /opt/registrar104 +else + echo "There was an issue starting the services. /opt/registrar104 will not be deleted." +fi + +# Final instructions to the user +echo "Upgrade to v1.0.4 is almost complete. Please follow the final step below to finish the process:" +echo +echo "1. Open your browser and log in to the admin panel." +echo "2. Navigate to System -> Update to apply the changes." +echo \ No newline at end of file