I discovered a bug in the no-ip dynamic dns free hostname auto renewal/confirmation script written by loblab

Turritopsis Dohrnii Teo En Ming ceo at teo-en-ming.com
Sun Aug 16 05:41:56 EDT 2020


Subject: I discovered a bug in the no-ip dynamic dns free hostname auto 
renewal/confirmation script written by loblab

Good day from Singapore,

Programming code troubleshooting person: Mr. Turritopsis Dohrnii Teo En 
Ming (Targeted Individual)
Country: Singapore
Date: 15 to 16 August 2020 Singapore Time (Saturday and Sunday)

My IT consulting company in Singapore asked me to install a Linux 
virtual machine so that we can run no-ip dynamic dns free hostname auto 
renewal/confirmation script written by loblab. I am an IT consultant in 
Singapore, 42 years old as of 16 Aug 2020.

I am not a Python or Java programmer or software developer. The last 
time I had formal training in structured C programming (not C++ objected 
oriented programming) was more than 20 years ago at Singapore 
Polytechnic (Diploma in Mechatronics Engineering course year 1995-1998). 
Although I am not a programmer or software developer, I can still more 
or less understand the flow of programming code.

I chose Debian 10.5 64-bit Linux to install as my virtual machine/guest 
operating system because loblab mentioned that his scripts have been 
tested on Debian 9.x/10.x. But first I have to install VMware 
Workstation Pro 15.5.6 in my Ubuntu 18.04.3 LTS Linux desktop operating 
system. The iso file I downloaded is debian-10.5.0-amd64-netinst.iso.

The virtual network adapter in my Debian 10.5 Linux virtual machine was 
configured to use Network Address Translation (NAT). You can verify the 
IP address of your VM with the following Linux commands:

$ ip a

$ ip route

Give your Debian 10.5 Linux VM at least 2 GB of RAM.

After installing Debian 10.5 Linux virtual machine (minimal installation 
with SSH server and standard system utilities), I need to do a few more 
things, as follows.

# apt install sudo

# usermod -aG sudo teo-en-ming

# groups teo-en-ming

So that I can sudo as a regular Linux user.

# apt install git

Then I downloaded the no-ip ddns free hostname auto renewal/confirmation 
script using git clone.

Software: Script to auto renew/confirm noip.com free hosts
Download link: https://github.com/loblab/noip-renew
Programmer: loblab

I believe programmer loblab is based in China.

The version of the scripts I downloaded is 1.1 dated 18 May 2020.

The composition of the software is 58.4% Python programming language, 
36% Linux shell scripts, and 5.6% Dockerfile.

I tried to run setup.sh Linux shell script and choose "Install/Repair 
Script". But I found out that nothing is being installed in 
/usr/local/bin after a few installation attempts.

I thought the scripts/installation were being blocked by AppArmor, so I 
went to disable AppArmor using the following Linux commands.

$ sudo mkdir -p /etc/default/grub.d
$ echo 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT 
apparmor=0"' \
   | sudo tee /etc/default/grub.d/apparmor.cfg
$ sudo update-grub
$ sudo reboot

$ aa-enabled
$ sudo aa-status

But AppArmor is NOT the cause of the problem.

I began to examine the Python programming code and Linux shell scripts.

For the setup.sh script, when you choose "Install/Repair Script", it 
will call the installer() function. Inside the installer() function, it 
will call the following functions, in sequence:

config(), install(), deploy()

When the install() function was called, it tried to execute the 
following Linux command:

$SUDO apt -y install chromium-browser # Update Chromium Browser or 
script won't work.

Executing the above Linux command resulted in an ERROR because Debian 
10.5 Linux does not have the chromium-browser software package. Instead 
it has the chromium package.

When the above error is encountered, the installer script ABORTED 
PREMATURELY and could not continue running. The installer script could 
not run to completion. This is the bug.

To fix the bug, I have to COMMENT OUT/DISABLE the following line in 
setup.sh script:

$SUDO apt -y install chromium-browser # Update Chromium Browser or 
script won't work.

And add the following line below the above-mentioned line:

$SUDO apt -y install chromium

It fixed the bug. I ran setup.sh script again, choose "Install/Repair 
Script", and the installer ran to completion. Finally the scripts are 
installed in /usr/local/bin.

Please DO NOT add your no-ip account password to noip-renew.sh script 
manually in plain text because it has to be Base64 encoded/encrypted. If 
you add your no-ip account password directly to noip-renew.sh script, 
you will get an "Incorrect Padding" Python programming base64 error 
code.

You need to supply the no-ip account password when you run the installer 
script. When the installer script calls the deploy() function, it will 
also call the noip() function.

The noip() function is as follows:

function noip() {
     echo "Enter your No-IP Account details..."
     read -p 'Username: ' uservar
     read -sp 'Password: ' passvar

     passvar=`echo -n $passvar | base64`
     echo

     $SUDO sed -i 's/USERNAME=".*"/USERNAME="'$uservar'"/1' $INSTEXE
     $SUDO sed -i 's/PASSWORD=".*"/PASSWORD="'$passvar'"/1' $INSTEXE
}

Observe that it will use base64 encoding to encrypt your supplied no-ip 
account password in /usr/local/bin/noip-renew-$USER.

When you run the noip-renew.sh script, it will call the noip-renew.py 
python script.

Inside the noip-renew.py python script, the code is as follows:

     def login(self):
         self.logger.log(f"Opening {Robot.LOGIN_URL}...")
         self.browser.get(Robot.LOGIN_URL)
         if self.debug > 1:
             self.browser.save_screenshot("debug1.png")

         self.logger.log("Logging in...")
         ele_usr = self.browser.find_element_by_name("username")
         ele_pwd = self.browser.find_element_by_name("password")
         ele_usr.send_keys(self.username)
         
ele_pwd.send_keys(base64.b64decode(self.password).decode('utf-8'))
         self.browser.find_element_by_name("Login").click()
         if self.debug > 1:
             time.sleep(1)
             self.browser.save_screenshot("debug2.png")

The python script will use base64 decoding to decode your encrypted 
no-ip account password when it tries to login to noip.com portal.

When you run the setup.sh installer script, it will also install/copy 
the noip-renew.sh script as /usr/local/bin/noip-renew-$USER or 
/usr/local/bin/noip-renew-teo-en-ming in my case. The 
/usr/local/bin/noip-renew-$USER script is the script you should normally 
run.

You should then install the following crontab (scheduled task) using 
crontab -e:

30 0 * * * /usr/local/bin/noip-renew-$USER /var/log/noip-renew/$USER

You can verify your crontab (scheduled task) is installed by running

$ crontab -l

The scheduled task will run at 12.30 AM at midnight every day.

You should also check the logs at /var/log/noip-renew/$USER

This essay also serves as a tutorial on how to use the no-ip ddns free 
hostname auto renewal/confirmation script since there is a lack of 
detailed documentation.












-- 
-----BEGIN EMAIL SIGNATURE-----

The Gospel for all Targeted Individuals (TIs):

[The New York Times] Microwave Weapons Are Prime Suspect in Ills of
U.S. Embassy Workers

Link: 
https://www.nytimes.com/2018/09/01/science/sonic-attack-cuba-microwave.html

********************************************************************************************

Singaporean Mr. Turritopsis Dohrnii Teo En Ming's Academic
Qualifications as at 14 Feb 2019 and refugee seeking attempts at the 
United Nations Refugee Agency Bangkok (21 Mar 2017), in Taiwan (5 Aug 
2019) and Australia (25 Dec 2019 to 9 Jan 2020):

[1] https://tdtemcerts.wordpress.com/

[2] https://tdtemcerts.blogspot.sg/

[3] https://www.scribd.com/user/270125049/Teo-En-Ming

-----END EMAIL SIGNATURE-----


More information about the Python-list mailing list