Updating IP Address in Dynu

Dynu is a free dynamic DNS service. As described in Microsoft Brought Down No-IP.org I have to cope with big business just pushing their own interest and not caring on small business or private customers.

I tried to update IP address for Dynu using ddclient using package ddclient. This failed. The version 2 of Dynu’s API allows to do that with curl/wget.

Steps to set it up:

  1. Go to API Credentials to get your “API-key”
  2. Go to API and authorize using your “API-key”
  3. Run first “GET /dns” to gather your so called “id”. Alternatively, run the below curl command

The curl command to get your “id” is as follows:

curl -X GET "https://api.dynu.com/v2/dns" -H  "accept: application/json" -H  "API-Key: yyyyyyyyyy"

Output is like this:

{"statusCode":200,"domains":[{"id":12345678,"name":"eklausmeier.mywire.org","unicodeName":"eklausmeier.mywire.org","token":"aaaaaaaaa","state":"Complete","location":"office","group":"office","ipv4Address":"109.90.226.205","ipv6Address":null,"ttl":90,"ipv4":true,"ipv6":false,"ipv4WildcardAlias":false,"ipv6WildcardAlias":false,"createdOn":"2019-05-25T08:37:16","updatedOn":"2019-06-29T12:33:04.707"}]}%

Once you know your “API-key” and “id” you can set-up a simple script to run periodically. I use a Perl script which first fetches my current internet address, $remoteIP, and then updates Dynu.

open(F,"curl -sX POST \"https://api.dynu.com/v2/dns/XXXXXXXX\" "
        . "-H \"accept: application/json\" "
        . "-H \"API-Key: yyyyyyyyyyyyyyyyyyyyyyyy\" "
        . "-H \"Content-Type: application/json\" "
        . "-d \"{\\\"name\\\":\\\"eklausmeier.mywire.org\\\","
                . "\\\"group\\\":\\\"office\\\","
                . "\\\"ipv4Address\\\":\\\"${remoteIP}\\\","
                . "\\\"ttl\\\":90,\\\"ipv4\\\":true}\" |")
        || die("Cannot curl to dynu.com");
while (<F>) {
        print;
}
close(F) || die("Cannot close dynu.com");

If all goes well then output is:

{"statusCode":200}
Advertisements

Statistics of this Blog: Crossed 90.000 Views

This blog was viewed more than 90.000 times since its inception and had more than 68.630 visitors. The averages per month are:

The most popular posts over one year are:

The most popular posts over all years are:

USA is at the top of viewers of my blog this year, as before:

Google Chrome in Android Cannot Clear Cookies

Google Chrome on Android version 74.0.3729 can no longer clear history, cookies, local data, etc. See screenshot below.

Even when this process is running completely uninterrupted, nothing happens. I.e., changing display sleep time to 30 minutes, Google Chrome will not finish.

Problem solution: Shut down phone. Power up again, and try again to delete cookies. This time it worked. Seems that some Android Chrome internal locking and contention blocked deletion.

Showing History of Visits in Mozilla Firefox

If one needs to know when some website has been visited in Mozilla Firefox then go to the default directory and open the places.sqlite file:

cd ~/.mozilla/firefox/<xyz>.default/
sqlite3 places.sqlite

Issue below SQL command

select visit_date,
       datetime(visit_date/1000000, 'unixepoch','localtime') as S
from moz_historyvisits
where place_id in
       (select id from moz_places where url like 'https://www.google.come%')
and S like '2019-01-2%'
order by S;

References:

  1. How do I decode the Last_Date_ Visited field in the places.sqlite db?
  2. SQLite: Date And Time Functions
  3. Entity relationship diagram of tables: The Places database

ER diagram looks like this:
ER diagram

Added 30-Jun-2019: Interesting comment from Ronald Scheckelhoff from 19-May-2019 on caching DNS entries of previously visited URLs.

… could use this database to collect an overall sample of my web surfing habits, and then plug that data into something like the Unbound DNS resolver to do my own DNS lookups for the places I usually visit. I was doing that with Squid, but it has some limitations for my situation. Maybe this is better (plus, I don’t have to use Squid).

java.sql.SQLRecoverableException: IO Error: Connection reset by peer, Authentication lapse

I encountered the following error, when I wanted to connect to Oracle v12.2.0.1.0 database with Java 1.8.0_192-b26:

java.sql.SQLRecoverableException: IO Error: Connection reset by peer, Authentication lapse 321631 ms.

This was unexpected as the same program did run absolutely fine on another Linux machine. Program in question is

import java.sql.Connection;
import java.sql.SQLException;

import oracle.jdbc.pool.OracleDataSource;

public class OraSample1 {

        public static void main (String argv[]) {
                System.out.println("Starting...");
                try {
                        OracleDataSource ds = new OracleDataSource();
                        ds.setURL("jdbc:oracle:thin:@nuc:1521:orcl");
                        Connection conn=ds.getConnection("c##klm","klmOpRisk");
                        System.out.println("Connected");
                } catch (SQLException e) {
                        System.out.println(e);
                }
        }

}

Solution: Add the following property setting to command line

java -Djava.security.egd=file:/dev/urandom OraSample1

Also see “java.sql.SQLException: I/O Error: Connection reset” in linux server [duplicate] on Stackoverflow,

Web Interface to Oracle Database

I had to provide access to an Oracle database but the standard port at 1521 was hindered by company firewall and company proxy rules.

In previous times there was iSQL*Plus, but this product no longer seems to be available. I found Adminer as an alternative. It is written by Jakub Vrána. It is very easy to install: it is just one single PHP file consisting of less than 2000 lines. Originally made for MySQL/MariaDB, but it works for Oracle quite well. It provides access to tables and views, although it has problems editing PL/SQL procedures and triggers. It is termed as beta software for Oracle. Nevertheless, I found it to be very useful for Oracle.

To use one must add one file etc/php/conf.d/oci8.ini

extension=oci8.so

Make sure OCI8 is available for PHP, therefore install AUR package php-oci8. When you run php -i (equivalent to calling phpinfo()) you’ll see:

Additional .ini files parsed => /etc/php/conf.d/oci8.ini

oci8

OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.1.8
Revision => $Id: 8a26cf66ca0f9556b6376408c8f71ead69bdbcbf $
Oracle Run-time Client Library Version => 12.2.0.1.0
Oracle Compile-time Instant Client Version => 12.2

Directive => Local Value => Master Value
oci8.connection_class => no value => no value
oci8.default_prefetch => 100 => 100
oci8.events => Off => Off
oci8.max_persistent => -1 => -1
oci8.old_oci_close_semantics => Off => Off
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20

For this you need to install Oracle instant client. In ArchLinux AUR these are the packages oracle-instantclient-basic and oracle-instantclient-sdk. The first package installs

/usr/lib/libclntsh.so

If you encounter “URI too long” error messages, then downgrade to version 4.6.3, see Adminer releases. Latest version 4.7.0 still seems to be unstable, while 4.6.3 is fine.