Skip to content

Instantly share code, notes, and snippets.

@brohee
brohee / long_random_numerical_string.sh
Last active February 1, 2023 15:01
Generate long random numerical string in shell for e.g. PIN generation
#!/bin/sh
dd if=/dev/random bs=15 count=1 2>/dev/null | od -D | cut -c 15- | tr -d ' ' | head -1
# alias pin4="dd if=/dev/random bs=15 count=1 2>/dev/null | od -D | cut -c 15- | tr -d ' ' | head -1 |cut -c 1-4"
# alias pin6="dd if=/dev/random bs=15 count=1 2>/dev/null | od -D | cut -c 15- | tr -d ' ' | head -1 |cut -c 1-6"
# alias pin8="dd if=/dev/random bs=15 count=1 2>/dev/null | od -D | cut -c 15- | tr -d ' ' | head -1 |cut -c 1-8"
@brohee
brohee / Updating iLO 3.md
Last active April 30, 2024 23:56
Guide on updating old iLO 3 versions to a more current one

Updating a HP(E) server from iLO 3 version 1.55 to version 1.94

This short document explain how to resolve the issues arising when trying to update an old (Gen7) HP(E) server to the most recent iLO 3 (HPE Integrated Lights-Out) version, which solves a great number of security and usability issues.

Issues

  • Can't connect to iLO with a modern browser, for lack of supported TLS protocol version
    • solved by using FirefoxPortable version 31
    • and in the Firefox31 portable configuration, in the about:config settings, set security.tls.version.min (the minimum acceptable version of the TLS protocol) to 0 in order to be able to negociate down to TLS 1.0 (even if iLO 3 can do 1.1). Keep in mind your browser is now (even more) vulnerable to a host of attacks, do not connect to any potentially hostile host with it.
  • in the iLO web console, checking the option "Enforc
@brohee
brohee / group_to_script.sh
Last active March 31, 2022 11:52
Creates a script from an /etc/group file in order to reproduce groups on another computer. Linux oriented.
# creates a groupadd sequence reproducing the GIDs of groups created on a machine
# in order to replicate it
cut -f1,3 -d: /etc/group | awk -F ':' '{print "\n# creating group " $1 "\n" "groupadd -g " $2 " " $1}'
@brohee
brohee / ubuntu-gpg-key-import.md
Last active May 17, 2022 10:38
GPG key issues on apt-get update (Ubuntu)

apt-get update failing because of a missing GPG key

The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 089EBE08314DF160

Fix: import the GPG key

Issue: must go through port 80 or 443 to pass firewall permissions, thankfully ubuntu keyserver listens on 80 too, so by specifying the port 80 in the HKP server URL we can get through.

@brohee
brohee / pkcs12tips.md
Last active November 5, 2020 13:35
PKCS#12 tips and tricks

Listing the content of a PKCS#12 container

openssl pkcs12 -info -noout -in file.p12

or

keytool -list -storetype pkcs12 -v --keystore file.p12
@brohee
brohee / UpdateUnitsCurrencies.md
Last active July 9, 2020 12:05
systemd units to periodically update currencies for the unit command line
@brohee
brohee / ASN.1-notes.md
Created January 13, 2020 15:47
Notes on ASN.1
// http://security.stackexchange.com/questions/102703/help-generating-wordlist-using-crunch
// I need to configure crunch so that it produces a wordlist with the following set of rules:
//
// Exactly 10 characters long
// Contains exactly 4 letters, which have to be a-f (all lowercase)
// Contains exactly 6 numbers, which have to be 2-9
// The letters and numbers can be anywhere in the word
//
// Is there any way to add a function to that program that disallows character repetition above 2?
// http://security.stackexchange.com/questions/102703/help-generating-wordlist-using-crunch
// I need to configure crunch so that it produces a wordlist with the following set of rules:
//
// Exactly 10 characters long
// Contains exactly 4 letters, which have to be a-f (all lowercase)
// Contains exactly 6 numbers, which have to be 2-9
// The letters and numbers can be anywhere in the word
//
fn all_words(prefix: &str, letters: u32, numbers: u32) {
@brohee
brohee / win-console-utf8
Last active August 29, 2015 14:00
Getting UTF-8 to display properly in a Windows console
To display UTF-8 properly in Windows PowerShell ISE (PowerShell 3), downloadable at
http://www.microsoft.com/en-us/download/details.aspx?id=40855
Type the following command at the prompt :
[System.Console]::OutputEncoding = [System.Text.Encoding]::UTF8