GSSException: Failure unspecified at GSS-API level (Mechanism level: Checksum failed)

Software: Hortonworks HDF

OS: RHEL 7.x

Set up two Schema Registries. Modified schema registries configuration in a way that Kerberos SPN are similar. Defaul Ambari set up SPN as SERVICE/FQDN@REALM.

Set up AWS ELB.

When requesting a resource I got on success response and one Error 403 GSSException: Failure unspecified at GSS-API level (Mechanism level: Checksum failed)

After shut down one schema registry turned out all request were ok, so second schema registry responded every time GSSException: Failure unspecified at GSS-API level (Mechanism level: Checksum failed)

Used kvno for debugging

In first server:

[root@ip-10-113-86-26 ~]# kvno -k /etc/security/keytabs/spnego.service.keytab HTTP/registry.dp.example.net
HTTP/registry.dp.example.net@DP.EXAMPLE.NET: kvno = 3, keytab entry valid

In second server:

[root@ip-10-113-86-4 ~]# kvno -k /etc/security/keytabs/spnego.service.keytab HTTP/registry.dp.example.net
HTTP/registry.dp.example.net@DP.EXAMPLE.NET: kvno = 3, keytab entry invalid

[root@ip-10-113-86-4 ~]# klist -kte /etc/security/keytabs/spnego.service.keytab
Keytab name: FILE:/etc/security/keytabs/spnego.service.keytab
KVNO Timestamp Principal
—- ——————- ——————————————————
2 05/22/2019 13:56:14 HTTP/ip-10-113-86-4.eu-central-1.compute.internal@DP.EXAMPLE.NET (aes128-cts-hmac-sha1-96)
2 05/22/2019 13:56:14 HTTP/ip-10-113-86-4.eu-central-1.compute.internal@DP.EXAMPLE.NET (aes256-cts-hmac-sha1-96)
2 05/22/2019 13:56:14 HTTP/ip-10-113-86-4.eu-central-1.compute.internal@DP.EXAMPLE.NET (arcfour-hmac)
2 05/22/2019 13:56:14 HTTP/ip-10-113-86-4.eu-central-1.compute.internal@DP.EXAMPLE.NET (des3-cbc-sha1)
2 05/22/2019 13:56:14 HTTP/ip-10-113-86-4.eu-central-1.compute.internal@DP.EXAMPLE.NET (des-cbc-md5)
2 05/22/2019 14:16:11 HTTP/registry.dp.example.net@DP.EXAMPLE.NET (aes256-cts-hmac-sha1-96)
2 05/22/2019 14:16:11 HTTP/registry.dp.example.net@DP.EXAMPLE.NET (aes128-cts-hmac-sha1-96)

[root@ip-10-113-86-4 ~]# kadmin -s 10.113.86.28 -p admin/admin
Authenticating as principal admin/admin with password.
Password for admin/admin@DP.EXAMPLE.NET:
kadmin: getprinc HTTP/registry.dp.example.net@DP.EXAMPLE.NET
Principal: HTTP/registry.dp.example.net@DP.EXAMPLE.NET
Expiration date: [never]
Last password change: Wed May 22 14:16:48 UTC 2019
Password expiration date: [never]
Maximum ticket life: 1 day 00:00:00
Maximum renewable life: 0 days 00:00:00
Last modified: Wed May 22 14:16:48 UTC 2019 (admin/admin@DP.EXAMPLE.NET)
Last successful authentication: [never]
Last failed authentication: [never]
Failed password attempts: 0
Number of keys: 2
Key: vno 3, aes256-cts-hmac-sha1-96
Key: vno 3, aes128-cts-hmac-sha1-96
MKey: vno 1
Attributes:
Policy: [none]
kadmin:

The problem is that in case you use kadmin ktadd it will increase printcipal KVO

{{ variable }} in Ambari

I have always problem how to know where defined variables I can see via Ambari GUI – {{ some text }}

First this pattern is called Jinja Template framework

Lets learn via example

I have HDF schema registry and I don’t like in example kerberos.principal value Ambari puts there HTTP/[hostname]@REALM. I put two schema registries behind AWS EBL and I need static SPN.

Jinja template is found /var/lib/ambari-agent/cache/common-services/REGISTRY/0.3.0/package/templates/registry.yaml.j2

From template I can find {{registry_ui_jaas_principal}}

Ambari uses lots of params.py files to generate variables. The one I am interested in is /var/lib/ambari-agent/cache/common-services/REGISTRY/0.3.0/package/scripts/params.py and it is copy of /var/lib/ambari-server/resources/mpacks/hdf-ambari-mpack-3.3.1.0-10/common-services/REGISTRY/0.3.0/package/scripts/params.py

Do not change file under cache because after ambari restart static one will overwrites this so change
/var/lib/ambari-server/resources/mpacks/hdf-ambari-mpack-3.3.1.0-10/common-services/REGISTRY/0.3.0/package/scripts/params.py

Debug remote port using *nix shell

(echo >/dev/tcp/[FQDN]/[port]) &>/dev/null && echo “open” || echo “close”

Test it.

Open in one terminal port (in example 8081) with

nc -l 8081

In second terminal

cat > /dev/tcp/localhost/8081

margusja@IRack:~$ cat </dev/tcp/[ssh server]/22

SSH-2.0-OpenSSH_7.4

Raadiolained, moduleerimine, induktsooon

Kogun siia enda jaoks subjektis toodu teemaga seotud linke ja infot, et neist ükspäeb enda jaoks terviklik pilt kokku panna.

Sageduse suurenedes suureneb aktiivtakistus pindefekti mõjul – juhtmes indutseeritud pöörisvoolude mõjul kulgeb vool rohkem pinnakihtides. Juhtme südamik jääb põhiliselt kasutamata, seetõttu juhtme ristlõikepind näivalt väheneb ja takistus suureneb. (Allikas: http://www.ene.ttu.ee/leonardo/elektro_alused/6Vahelduvvool.pdf)

 

 

 

Allikas: https://commons.wikimedia.org/wiki/Main_Page

 

 

https://www.electronics-tutorials.ws/oscillator/oscillators.html

http://www.learnabout-electronics.org/Oscillators/osc10.php

Game Theory

Aeg-ajalt olen seda fraasi kuulnud ja siis googeldanud ja üldmõttest aru saanud. Et edaspidi lihtsam oleks, siis kirjutan omale siia maha kokkuvõtte mänguteeooria ühest levinumast näitest – Prisoners’ Dilemma.

Olukord on siis selline, et kaks tegelast jäävad autovargusega vahele, mille eest tahetakse neile panna karistuseks kaks aastat. Mõlemad paigutatakse eraldi kambritesse ülekuulamiseks. Samas selgub, et mõlemat tegelast kahtlustatakse ka pangaröövis. Tegelased omavahel suhelda ei saa.

Mõlemale pätile antakse valikud:

  1. Kui mõlemad tunnistavad pangaröövi ülesse, siis saavad kolm aastat.
  2. Kui üks tunnistab pangaröövi ülesse ja teine ei tunnista, siis see, kes tunnistab pangaröövi saab ühe aasta ja see, kes ei tunnistanud saab kümme aastat.

Antud valikutest saab moodustada maatriksi:

Vang 1
TunnistabEi tunnista
Vang 2TunnistabMõlemad saavad kolm aastatVang 2 saab ühe aasta. Vang 2 saab kümme aastat.
Ei tunnistaVang 1 saab kümme aastat. Vang 1 saab ühe aastaVang 1 saab kaks aastat. Vang 2 saab kaks aastat.

Kui nüüd mõlemad vangid läheksid oma karistuse minimaliseerimise peale (kaks aastat), siis on oht, et üks või teine tunnistab ennast siiski pangaröövis süüdi ja üks või teine saab kümme aastat. Analüüsides ülal toodud lihtsat tabelit, siis selgub, oluline on mõlema vangi vaatevinklist kümme aastal laualt minema saada. Ja valikutesse jääb üks aasta, juhul kui üks või teine ei tunnista ennast süüdi või siis kolm aastat kui mõlemad tunnistavad ennast süüdi.

What does reduce

 

List( 1, 2, 3, 4 ).reduce( (x,y) => x + y )   == (((1+2)+3)+4)
Step 1 : op( 1, 2 ) will be the first evaluation. 
  Start with 1, 2, that is 
    x is 1  and  y is 2
Step 2:  op( op( 1, 2 ), 3 ) - take the next element 3
  Take the next element 3: 
    x is op(1,2) = 3   and y = 3
Step 3:  op( op( op( 1, 2 ), 3 ), 4) 
  Take the next element 4: 
    x is op(op(1,2), 3 ) = op( 3,3 ) = 6    and y is 4

Restore ESP8266EX original firmware using esptool

https://github.com/mlwmlw/esp8266-workshop/tree/master/firmware

margusja@IRack:/System/Library/Extensions$ esptool.py –port /dev/tty.wchusbserial1410 write_flash 0x00000 /Users/margusja/Downloads/v1.3.0.2\ AT\ Firmware.bin
esptool.py v2.2
Connecting….
Detecting chip type… ESP8266
Chip is ESP8266EX
Uploading stub…
Running stub…
Stub running…
Configuring flash size…
Auto-detected Flash size: 1MB
Compressed 1044480 bytes to 242823…
Wrote 1044480 bytes (242823 compressed) at 0x00000000 in 21.6 seconds (effective 387.1 kbit/s)…
Hash of data verified.

Leaving…
Hard resetting…

 

AT+GMR
AT version:0.40.0.0(Aug 8 2015 14:45:58)
SDK version:1.3.0
Ai-Thinker Technology Co.,Ltd.
Build:1.3.0.2 Sep 11 2015 11:48:04
OK

OpenCP cv:Mat and cv:transpose

Matrix transpose does some cool stuff with matrix elements. In example using OpenCV:

    Mat A = (Mat_<float>(2, 5) << 1, 2, 3, 4, 5, 7, 8, 9, 10, 11);

    cout << “A = “ << endl << ” “ << A << endl << endl;

    Mat A1;

    transpose(A, A1);

    cout << “A1 = “ << endl << ” “ << A1 << endl << endl;

A =

[1, 2, 3, 4, 5;

7, 8, 9, 10, 11]

 

A1 =

[1, 7;

2, 8;

3, 9;

4, 10;

5, 11]

 

Nice yeah.

As OpenCV holds pictures as matrixes then lets find out what is turns out to transpose image.

 

 

Picture has a little more matrix elements than in a previous example –

Image heigth: 720 cols: 1080 – It means 720 x 1080 elements.

    // Load an color image in grayscale

    Mat img = imread(“/Users/margusja/Pictures/faces/margusja2.jpg”,0);

    cv::Size s = img.size();

    int rows = s.height;

    int cols = s.width;

    Mat fimage;

    transpose(img, fimage);

    cout << “Image heigth: “ << rows << ” cols: “ << cols << endl;

    namedWindow( “Display window”, WINDOW_AUTOSIZE );

    imshow(“Margusja 1”,img);

    namedWindow( “Display window”, WINDOW_AUTOSIZE );

    imshow(“Margusja transposed”,fimage);

And result:

Versus

 

Now we have a clue how they rotate our pictures 🙂

Simple Tensorflow arithmetic

Lets imagine we have to do a simple arithmetic: (10+20) * (30-40)

In some unclear reason we decidet to use Tensorflow.

Default language is there python.

(tensorflow) margusja@IRack:~/tensorflow/tensorflow_scripts$ python
Python 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 13:19:00)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import tensorflow as tf
/Users/margusja/tensorflow/lib/python3.6/importlib/_bootstrap.py:205: RuntimeWarning: compiletime version 3.5 of module ‘tensorflow.python.framework.fast_tensor_util’ does not match runtime version 3.6
return f(*args, **kwds)
>>>
>>> a = tf.constant(10)
>>> b = tf.constant(20)
>>> c = tf.constant(30)
>>> d = tf.constant(40)
>>> e = tf.add(a,b)
>>> f = tf.subtract(c,d)
>>> h = tf.multiply(e,f)
>>> sess = tf.Session()
2017-11-10 19:02:43.777454: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
>>> print(sess.run(h))
-300

We can explore graph in tensorbar:

 

Change GIT password from command line

$ git config credential.helper store
$ git push https://github.com/repo.git

Username for 'https://github.com': <USERNAME>
Password for 'https://USERNAME@github.com': <PASSWORD>