Facebook Linkedin
Git Instagram
36 posts tagged


 No comments    351   8 mon   linux

Extract PEM certificates and keys from a shared NSS DB

$ certutil -L -d .
Certificate Nickname Trust Attributes


$ certutil -L -d . -a -n ‘FreeIPA CA’ > freeipa.crt

The PEM certificate should now be stored in free-ipa.crt.

To extract the PEM key from key3.db use certutil, pk12util and openssl.

$ certutil -K -d . -a
$ pk12util -o keys.p12 -n ‘FreeIPA Key’ -d .
$ openssl pkcs12 -in keys.p12 -out freeipa.key -nodes

 No comments    243   10 mon   freeipa   linux

Linux UX improvements

1 – Fish as a shell. I like the fact that out of the box it does what it should do and what I configure in Bash. And I like abbreviations.

2 – ripgrep which is faster grep

3 – Bat which is a way better cat

4 – ???

5 – lolcat!

 No comments    98   2018   linux

My Android speedup tuning

Putting notes not to forget.

Case: Sony Xperia Z5compact is very slow and become hot on even a minor usage. After reading a lot of articles in the internet:

  • turn off image enhancement in settings.
  • change launcher to Microsoft Arrow. I really like it and it’s light.
  • in Developer Mode: limit background processes to 4 (20 is default), force GPU usage for everything (2 related settings).

Actually the main reason why the phone is slow is that the Android available for this model (Greece Vodafone) is 6.0 and there is only 2 GB RAM onboard. 50% of it is used by “Android System” :-(

 1 comment    78   2017   android   linux

Simple fail2ban log file parcer

I have written simple fail2ban log file parcer in Golang that finds banned IPs, makes a struct with date, time and IP and a map with IP as a key and count as a value. I am thinking of nmapping the values I’ve got and making a report out of them.

package main

import (

type record struct {
  day string
  time string
  ip string

type ip struct {
    ip string
    count int

// Checking most calls for errors.
// This helper will streamline our error checks below.
func check(e error) {
    if e != nil {

//reading file to array of lines

func readLines(path string) ([]string, error) {
  file, err := os.Open(path)
  defer file.Close()

  var lines []string
  scanner := bufio.NewScanner(file)
  for scanner.Scan() {
    lines = append(lines, scanner.Text())
  return lines, scanner.Err()

func main() {

lines, err := readLines("./fail2ban.log")

  var log_records []record

if err != nil {
    fmt.Println("readLines: %s", err)

  dr, _ := regexp.Compile("[0-9]{4}-[0-9]{2}-[0-9]{2}")
  tr, _ := regexp.Compile("[0-9]{2}:[0-9]{2}\\:[0-9]{2},[0-9]{3}")
//IPv4 address
  ir, _ := regexp.Compile("(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")
br, _ := regexp.Compile("Ban")
ip_map := make(map[string]int)

var j int
j = 0

for i, line := range lines {
  if (br.MatchString(line) == true){
    var tmp record
    log_records = append (log_records, tmp)
    log_records[j].day = dr.FindString(line)
    log_records[j].time = tr.FindString(line)
    log_records[j].ip = ir.FindString(line)
//count unique IPs
    fmt.Println("Log line:     ",i)
    fmt.Println("Date:         ",log_records[j].day)
    fmt.Println("Time:         ",log_records[j].time)
    fmt.Println("IP address:   ",log_records[j].ip)
    fmt.Println("Count:        ",ip_map[log_records[j].ip])


//pring map of IPs

 No comments    155   2017   golang   IT   linux   security

Google Accounts engine problem and Gnome 3

I have login.keychain corrupted in my Gnome 3 enabled workplace due to the recent Google Accounts engine problem. For some reason it has become completely unusable, Gnome Keychain was unable to unlock it, Google Chrome stopped loading sites, goa-daemon died (as usual) and Evolution has stopped getting mail.

Goog Friday morning frustration.

 No comments    118   2017   gnome   google   IT   linux

OOM-killer fun

Recently I had installed RHEL 7 FreeIPA test lab on my workplace. I have made virtual host with default 1GB RAM, installed the system, enrolled it into the IPA domain OK, then tried ipa-replica-install. Turns out that 1GB is not enough and OOM-killer tries to solve the problem by killing processes that ipa-replica-install had spawned. Surprisingly turns out that for some reason the script is not detecting errors caused and you have strangely configured replica as the result.

 No comments    12   2017   IT   linux


If you have host in the AD with the SSSD then your root user can be any user from the domain. So


would actually give permissions to all users from the “groupname” to become any AD user they want, and if they’re SSH’ng the localhost then, they would have Kerberos ticket as well. It is not actually that evident, but Active Directory is an identity provider, so if you are superuser on the host – you can be AD user on the host.

 No comments    14   2017   IT   linux   sssd

Debugging IDM

One of the most frequent cases I have is that “sometimes” and “somewhere” user is not getting authenticated. Trying to SSH to the host works for some users not always, “id username” returns errors sometimes – it’s all the same problem in the environment with LDAP replication. It does not actually matter what kind of the LDAP server or domain controller is being used, always check:

  1. enable debug log on the client. If the client is SSSD, add “debug_level = 9” to the /etc/sssd/sssd.conf and then restart it. Invalidate it’s cache if possible.
  2. repeat the test so you would see the error.
  3. collect the log file from the client. You would see what server it has queried to get the information.
  4. check server’s log. Most likely there is no requested information on this LDAP instance due to replication issues.

This would help to identify and fix the problem.

 No comments    42   2017   idm   IT   ldap   linux   sssd
Earlier Ctrl + ↓