Blog

Bienvenue...

...sur mon blog, j'utilise ce site pour noter les petites choses qui me sont utiles, que ça soit informatique ou autre :)

Il y a 3 years 2 months

I'm putting this small tuto here, I've been stuck with my syno two times because of the mfa not working (key change after a DSM migration and another time when I had a pb with the clock not on time which was blocking the 2fa key calculation) :

With a ssh admin user, ssh to your NAS and go in the directory

/usr/syno/etc/preference/@DH-DOMAIN/0/

Find the directory of the user you want to modify and chdir into it, then remove the file google_authenticator

note : it's good to have a spare local admin user even if you are in a domain/ldap

source ici

Il y a 5 years 6 months

I've been through a svn to git migration, I've been blocked with a bad revision which prevented me from git svn clone my repository. I've seen that it is possible to bypass bad revision, using svnadmin utility.

I've wrote a small script that allows me to skip bad revision, an continue the dumping process without any manual action :

#!/bin/sh
echo "removing initial revision dump"
rm -f /home/data01/svn-dumpfile-20190517-1
 
if ! [ -f /home/data01/svn-dumpfile-20190517 ] ; then
    echo "dumping first"
    /usr/bin/svnadmin dump /home/data01/repository > /home/data01/svn-dumpfile-20190517 2> ./dump-start.log
fi
echo "copie du dump"
cp /home/data01/svn-dumpfile-20190517 /home/data01/svn-dumpfile-20190517-1
 
counter=1
counter=$(tail ./dump-start.log |grep "Dumped revision" | tail -1 | awk -F "Dumped revision " '{print  $2}' | awk -F "." '{print  $1}')
((counter++))
echo "last buggy revision is : $counter"
echo "incrementing next revision"
((counter++))
echo "removing last dump.log"
echo > ./dump.log
res=1
echo "ready to start !?"
read toto
#42762
while [ "$counter" -le 42700 ] || [ "$res" -eq 1 ]
do
    echo "dumping from revision $counter"
    /usr/bin/svnadmin dump --incremental -r $counter:HEAD /home/data01/repository >> /home/data01/svn-dumpfile-20190517-1 2>>./dump.log
    res=$?
    if [ "$res" -ne 0 ] ; then
        newcounter=$(tail -20 ./dump.log |grep "Dumped revision" | tail -1 | awk -F "Dumped revision " '{print  $2}' | awk -F "." '{print  $1}')
        if [ "" != "$newcounter" ] && [ $newcounter -gt $counter ] ; then
            echo "found newcounter=$newcounter"
            counter=$newcounter
        fi
        ((counter++))
        echo "buggy revision is : $counter"
    else
        echo "end of the dump !"
        continue
    fi
    echo "skipping revision $counter"
    ((counter++))
done

It's a quick-and-dirty script, leaved here asis ;)

Il y a 5 years 9 months

I've just reinstalled a centos7 VM, and I wanted to plug ldap authentification so that my ldap users could login

Here are the instructions to do so :

yum -y install sssd
echo "[domain/default]
id_provider = ldap
auth_provider = ldap
chpass_provider = ldap
sudo_provider = ldap
ldap_uri = ldaps://ldap.example.com:636
ldap_default_bind_dn = uid=the_user,cn=users,dc=example,dc=com
ldap_default_authtok = l3passw0rd
ldap_default_authtok_type = password
ldap_id_use_start_tls = True
ldap_tls_reqcert = never
ldap_search_base = dc=example,dc=com
ldap_sudo_search_base = ou=wheel,dc=example,dc=com
ldap_netgroup_search_base = dc=example,dc=com
cache_credentials = True
enumerate = True
autofs_provider = ldap
override_homedir = /home/%u
default_shell = /bin/bash
 
[sssd]
services = nss, sudo, pam, autofs
config_file_version = 2
domains = default
 
[nss]
filter_users = root,ldap,named,avahi,haldaemon,dbus,radiusd,news,nscd
 
[pam]
 
[sudo]
 
[autofs]
 
[ssh]
" > /etc/sssd/sssd.conf
chmod 600 /etc/sssd/sssd.conf
chown root:root /etc/sssd/sssd.conf
authconfig --enablesssd --enablesssdauth --enablemkhomedir --enablelocauthorize --update
systemctl restart sssd.service

Et voila !

Il y a 6 years 6 months

Create directory if it doesn't exist :

mkdir /etc/systemd/system/docker.service.d/

Create file :

echo '[Service]
Environment="HTTP_PROXY=http://<proxy-host>:<proxy-port>"
' > /etc/systemd/system/docker.service.d/http-proxy.conf
echo '[Service]
Environment="HTTPS_PROXY=https://<proxy-host>:<proxy-port>"
' > /etc/systemd/system/docker.service.d/https-proxy.conf

Reload systemctl & docker daemon :

systemctl daemon-reload
systemctl restart docker
Il y a 6 years 7 months

A small fonction useful to add to your .bashrc

whoswaps ()
{
  for file in /proc/*/status;
    do
        echo $file $(awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file);
    done | sort -k 3 -n -r | less
}

Pages