úterý 5. března 2024

WSL cannot access exFAT

If you have an external disk connected to your Windows and you try to access it via wsl, you will probably find nothing.

It is necessary to mount it manually:

mount -t drvfs d: /mnt/exdrive

středa 19. července 2023

Flutter is not building application

I migrated my flutter project to a new computer and after a while I realized that it is not building because of a strange CMake error.

How I fixed it?

flutter clean

then I deleted windows directory under my project

flutter create .

flutter run


And that is all!

pondělí 17. července 2023

Docker - "unable to allocate file descriptor table - out of memory"

I've tried to run some docker images from vulnhub - they have images with known CVEs like log4j etc.

It is easy, just run docker-compose up and you have it. Unfortunately I recieved a lot of errors and the reason was: "unable to allocate file descriptor table - out of memory". It is caused by changed ulimits in system.conf.

How to fix it?

You have to limit docker and it is necessary just to add following lines to docker compose file:

ulimits:
  nproc: 65535
  nofile:
    soft: 26677
    hard: 46677

Then everything will work again.
And if you'd like to run it directly from the commandline just run:

docker run --ulimit nproc=65535 --ulimit nofile=26677:46677 -d <your_image>

pátek 28. dubna 2023

Hell with Dell U2422HE

I love this LCD. It is large enough and I can connect my computer via USB-C. Everything is connected to the monitor so my desk is relatively clean of cables. But then one day I updated the firmware and installed Dell Monitor Manager.

After a while, I realized that if the monitor goes to sleep mode, I can no longer connect it to it. The only way was to physically remove the electricity cable and start LCD again. 

One month later I decided to contact support. The next day I had a call and we talked about the options. I updated the firmware and updated the drivers. It did not help. 

In the end, I removed Dell Monitor Manager and realized that it was caused by it! Now my monitor is great again and I don't have to restart it again and again.

Lessons learned: If something is working, don't touch it!

středa 29. března 2023

Odinstalace FortiNet klienta 6.x

 Kdo to zkoušel, ten ví, že to je noční můra. V P5idat nebo ubrat programy je volba zašedlá a z klienta samotného také nic neuděláte. Jak na to?

Otevřete si klienta a odemkněte vlevo dole nastavení.

Následně si vpravo nahoře klikněte na další zámek a nastavte si heslo. Po tomto kroku Klienta ukončete.

Po znovuspuštění běžte do konfigurace, zadejte heslo a následně otevřete Přidat nebo ubrat programy. 

Hurá, volba je již klikatelná.

Důvod? FortiNet klient čeká, než bude nastavení odemčeno pomocí hesla. Když tam žádné heslo zadané nemáte, odinstalovat ho nemůžete...

pondělí 13. března 2023

OpenVAS / GVM trouble with initial scan

 I installed GVM to Kali and tried to create a new config. I failed with strange error that config is not found.

After some investigation I've realized that I have to run gvm-feed-update and check if it succeeded.

Then go to https://127.0.0.1:9392/feedstatus and check the status. When everything is ready you can start using GVM.

úterý 17. ledna 2023

Docker to podman - trouble with container names

As you know, in Rocky linux there is no docker, but aliased podman. This brings some complications and I'd like to describe here one that was very painful.
Firs of all - there is no docker compose up alias, you have to install podman-componse.
How to do it?

    pip3 install podman-compose

Then podman-compose ( https://github.com/containers/podman-compose ) will be located in /usr/local/bin/ directory.
The next step is to run it, but it was not able to communicate to each other. Why?
You have to install podman-plugins.

    sudo dnf install podman-plugins

Then you are almost there, but it is necessary to remove the network and let it create again.

pátek 21. října 2022

How to run X11 applications from WSL2

 Install Xming X server.

Open WSL and set up the DISPLAY variable:

export DISPLAY="`sed -n 's/nameserver //p' /etc/resolv.conf`:0"

try to run some X application, for example xclock

If an error will be shown, check the Xming log

You will find there:

client 4 rejected from IP XXX.XXX.XXX.XXX

Go to c:\Program Files (x86)\Xming\

Edit X0.hosts and add IP address from the error log above

Restart Xming

pátek 12. srpna 2022

How to reset your SonarQube admin password in H2

What you should do when you have Sonar in docker and you can't remember, which password you have for your admin user? If you use internal H2 database it is not so easy...

First of all connect to your docker container:

docker exec -it container_id /bin/bash


Then run following commands to connect to H2 database:

cd /opt/sonarqube/lib/jdbc/h2

java -cp h2-1.4.199.jar org.h2.tools.Shell


You will be asked to fill following values:

URL jdbc:h2:tcp://localhost:9092/sonar

Driver org.h2.Driver

User [none]

Password [none]


Then just change your admin password:

UPDATE users SET crypted_password = '$2a$12$uCkkXmhW5ThVK8mpBvnXOOJRLd64LJeHTeCkSuB3lfaR2N0AYBaSi', salt=null, hash_method='BCRYPT' WHERE login = 'admin'


pondělí 20. června 2022

How to mount EFS to EC2 instance on AWS

Command is simple and you can find it in GUI - click on attach:

mount -t efs -o tls fs-some_id_of_efs:/ efs

Of course you have to create efs directory first - typically in /mnt/ directory.

It is quite simple, use Amazon linux image and install:

sudo yum install amazon-efs-utils nfs-utils


And thats all... 


středa 27. dubna 2022

Docker compose up on Windows X WSL2

 If you have standard WSL2 Ubuntu then you will be able to install docker compose version ~ 1.25. This is not enough for newer scripts.

It is necessary to do following steps:

mkdir -p ~/.docker/cli-plugins/

curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose

chmod +x ~/.docker/cli-plugins/docker-compose

And you are there :)

docker compose version

středa 13. dubna 2022

Jenkins - Couldn't find remote ref

I'm using Jenkins pipeline and inside I've tried to set up a combobox with available branches. User can pick one and it will be build.

Easy? No.

I've recieved an error: stderr: fatal: Couldn't find remote ref refs/heads/${BRANCH}

I've found solution after some hours, just untick the Lightweight checkout box at the end of git area in the configuration.

úterý 15. března 2022

Old PostgreSQL 9.4 is not starting

I have on my old external drive some PostgreSQL data directory. What is inside? Lets install old PostgreSQL 9.4 and check it out.

But it is not starting :( In the Event Viewer I have:

2022-03-15 09:05:29 CET LOG:  invalid value for parameter "lc_time": "Czech_Czech Republic.1250"

What to do next? Check this guide - https://dba.stackexchange.com/questions/188837/postgresql-9-5-wont-start-after-windows-10-fall-update

  1. Download https://www.microsoft.com/en-us/download/details.aspx?id=41158
  2. Install it
  3. Run the Locale Builder 
  4. Create new locale with Czech locale (cs-CZ) and cs-CZ
  5. Change the Region name from Czechia to Czech Republic.
  6. In the menu click on: Build - Build Locale Installer
  7. Install the locale
  8. Start your PostgreSQL!




pátek 11. března 2022

How to mount USB to your Windows Sandbox

 It is not possible to mount flash disc directly to the sandbox instance, but you can use following hack:

Create a file named sandbox.wsb

Put following text inside:

<Configuration>

<VGpu>Default</VGpu>

<Networking>Disable</Networking>

<MappedFolders>

<MappedFolder>

<HostFolder>D:\Public</HostFolder>

<ReadOnly>false</ReadOnly>

</MappedFolder>

</MappedFolders>

<LogonCommand>

<Command>explorer.exe C:\users\WDAGUtilityAccount\Desktop</Command>

</LogonCommand>

</Configuration> 


Then just doubleclick this file and Sandbox with attached USB is here ;) 

 

středa 26. ledna 2022

Raspberry Pi3+ - bluetooth not working

Some days ago I've found my old Raspberry Pi3+ and decided to play a little bit with it. First step was to flash to the SD card newest Kali. I've did it with balena Etcher flasher and it booted like a charm.

After a while I've realized that bluetooth is not working. Nothing was found:(

I've enabled bluetooth service and hciuaart:

modprobe btusb  # add the btusb module to the kernel 

systemctl enable bluetooth.service

systemctl enable hciuart 

But still nothing...

But then I've checked /boot/config.txt and edited lines in the following way:

# Uncomment some or all of these to enable the optional hardware interfaces

dtparam=i2c_arm=off

#dtparam=i2s=on

dtparam=spi=off

dtoverlay=miniuart-bt

And now it is working.
For Pi4 use
dtoverlay=pi4-enable-bt



středa 25. listopadu 2020

JAVA - Version number may be negative or greater than 255

Při spuštění jednoho staršího JAVA programu na mě vyskočila tato hláška: Invalid version number: Version number may be negative or greater than 255

Po drobném zkoumání jsem zjistil, že nikdo pravděpodobně nepředpokládal, že minor verze JAVA se někdy dostane přes 255 a došlo ke krásnému přetečení :)

Řešení? To nejrychlejší je spustit to se starší JAVA verzí.

neděle 11. března 2018

Bezpečná flashka pro certifikáty

Kolikrát se vám už stalo, že jste zapomněli flashku v počítači? Mě už bohužel několikrát, ale naštěstí jsem zatím nikdy flashku neztratil. Když jsem ale vybíral, jakou další si koupit, narazil jsem na
Kingston USB DataTraveler DT2000 - 4GB Cíl byl mít na flashce certifikáty, KeePass a nějaké další věci a když náhodou flashku někde zapomenu, aby se nestala katastrofa.

Na první pohled je jasné, v čem zabezpečení tkví - pro odemčení musíte zadat číselný kód. Pokud ho zapomenete a zadáte 10x špatně, flashka se smaže. Základní verze má 4GB a větší podle mého názoru nedává smysl. Kolik máte těch nejcitlivějších dat? Zjistíte, že se pohodlně vejdou na jedno CD. Výrobce deklaruje certifikaci FIPS 197, což znamená, že je ověřen použitý algoritmus, ale nikoliv fyzický způsob zabezpečení.
Z dob svých studií si pamatuji na pokus, kdy se kolegové do podobné flashky úspěšně lámali - stačilo ji rozebrat a poslat dobrou zprávu místo čtečky otisků prstů a data byla najednou přístupná. Na druhou stranu není moc lidí, kteří by měli podobné znalosti.
Za necelých čtrnáct stovek si můžete koupit slušný pocit bezpečí, že se Vaše certifikáty a další citlivé informace nedostanou do špatných rukou. Jedinou nevýhodou, mimo trochu vyšší ceny, je její trochu větší rozměr.

pondělí 1. ledna 2018

How to use SSO with your JAVA application?

Some weeks ago I've recieved an interesting task - use passwordless access to the database. I have to use the Kerberos ticket from LSA cache and pass it to the database on Windows 7. It looks easy, or...?

You have to run regedit and add following key to your registry:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa\Kerberos\Parameters
Value Name: allowtgtsessionkey
Value Type: REG_DWORD
Value: 0x01
Then you have to create jaas config (jaas.cfg) file with following content:

    com.sun.security.jgss.krb5.initiate {
        com.sun.security.auth.module.Krb5LoginModule
        required
        useTicketCache=true
        doNotPrompt=false
    };

Where to put this config?

  • The JRE looks for a default jaas.conf in “file:${user.home}/.java.login.config”
  • You can add configuration files to java.security located in “lib/security” in the JRE base directory like so: “login.config.url.1=file:C:/somewhere/.java.login.config”
  • Or you can specify the jaas configuration on the command line with: 
    • “-Djava.security.auth.login.config=path_to_file”

Then you have to do one very important thing - you have to run your application as a local admin. Without this condition it is definitely not working. If you have another experience with SSO / JAVA on Windows, let me know in the discussion below. And of course, you have to change the JDBC connection string to be "Kerberos ready". For example for Teradata it is LOGMECH=KRB5.

P.S. Very nice documentation is here: http://cr.openjdk.java.net/~weijun/special/krb5winguide-2/raw_files/new/kwin



sobota 30. prosince 2017

Levné skipasy

Znáte to, chcete jet na hory, podíváte se na vybrané středisko, ale rychle zjistíte, že se ceny od loňska zase zvýšily. Jsme ale v ČR a tak existuje několik možností, jak na skipasech ušetřit, nese to s sebou ale rizika. To největší je tzn. no-show - koupíte si skipas a neukážete se, budete nemocní, nebo to prostě nevyjde. Provozovatel Vám peníze nevrátí, bude to pro Vás čistá ztráta, v opačném případě budete mít lyžování levnější. Je tedy vhodné skipasy kupovat na poslední chvíli, nebo na delší období.
První možnost, jak získat skipas, je navštívit stránky https://skipasomat.cz/ Vyberete si své středisko, přihlásíte se, zaplatíte kartou a do emailu dostanete kód, kterým se prokážete na pokladně.
Druhou možností, ale jen pro Špindlerův mlýn, je https://www.gopass.cz , věrnostní karta středisek Tatra Mountain Resorts. Zde máte možnost koupit denní lyžování ve Špindlu za 490 Kč.
Další možností je vlastnit kartu innogy - dříve RWE. Ta Vám zajistí slevu 10-20% v jednotlivých střediscích. Podobně s kartou ISIC pro studenty.
Poslední variantou je využití o2 slev - každoročně je možné získat slevu opět cca 100Kč na skipass. Princip je jednoduchý, nahlásíte na pokladně kód a získáte slevu. Pokud tedy nemáte přímo o2, stačí, aby byl zákazníkem nějaký Váš známý a můžete kód získat od něj.

sobota 9. prosince 2017

Vybíráme bezdrátová sluchátka pro babičku

Dostal jsem složitý úkol - vybrat nová bezdrátová sluchátka pro babičku, která už hůř slyší. Současná i minulá měla jednu velkou nevýhodu - bylo nutné je dolaďovat manuálně. Kdo si to někdy zkoušel ví, že to není nic příjemného, navíc je ladící kolečko většinou strašně titěrné. Nic nenaštve tak, jako když v nejnapínavější části filmu, kde jde o vše, uslyšíte hrozivé elektronické zachrčení a musíte honem rychle ladit, abyste chytili pointu.
Rychlým průzkumem jsem zjistil, že se trh sluchátek docela posunul. Dříve bych sluchátka za 10 tisíc korun viděl jako něco neskutečného, ale dnes to tak mnoho lidí nevidí. Další velká změna je způsob připojení - bluetooth jednoznačně vede. Prarodiče ale mají starší televizi, která bluetooth nemá a variantu nastavovat toto připojení přes konvertor jack-bluetooth jsem zamítl.
Následně jsem přidal cenové hledisko a nakonec zbyla tato sluchátka:

  • Sony MDR-RF895RK - mají autotune tlačítko
  • Sennheiser RS 120 II - zamítnuty - musí se ladit
  • Sennheiser RS 160 - jsou starší výroby, od r 2012 - frekvence 2,4 GHz
  • Sennheiser RS 165 - nové, dražší
  • Philips SDH 8800 - frekvence 2,4 GHz
  • Panasonic RP-WF950E-S - mají autoladění, ale jsou starší - 2012



Trochu jsem se bál sluchátek na frekvenci 2,4GHz, nelíbily se mi starší modely. Velkým plusem byla možnost zapojení druhých sluchátek. Někteří už možná tuší, vyhrála sluchátka Sennheiser RS 165.
O zkušenosti s nimi se podělím po Vánocích, ale krabice, v které byly zabalené, vypadá opravdu pěkně.