...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 1 year 11 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 :

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
echo "copie du dump"
cp /home/data01/svn-dumpfile-20190517 /home/data01/svn-dumpfile-20190517-1
counter=$(tail ./dump-start.log |grep "Dumped revision" | tail -1 | awk -F "Dumped revision " '{print  $2}' | awk -F "." '{print  $1}')
echo "last buggy revision is : $counter"
echo "incrementing next revision"
echo "removing last dump.log"
echo > ./dump.log
echo "ready to start !?"
read toto
while [ "$counter" -le 42700 ] || [ "$res" -eq 1 ]
    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
    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"
        echo "buggy revision is : $counter"
        echo "end of the dump !"
    echo "skipping revision $counter"

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

Il y a 2 years 1 month

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_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
services = nss, sudo, pam, autofs
config_file_version = 2
domains = default
filter_users = root,ldap,named,avahi,haldaemon,dbus,radiusd,news,nscd
" > /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 2 years 10 months

Create directory if it doesn't exist :

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

Create file :

echo '[Service]
' > /etc/systemd/system/docker.service.d/http-proxy.conf
echo '[Service]
' > /etc/systemd/system/docker.service.d/https-proxy.conf

Reload systemctl & docker daemon :

systemctl daemon-reload
systemctl restart docker
Il y a 2 years 12 months

A small fonction useful to add to your .bashrc

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

Install socat, i.e. with centos :

  sudo yum install socat

Create a user config file ~/.ssh/config :

Host host-git
  ProxyCommand  socat - PROXY:<proxy ip/host>:%h:%p,proxyport=<proxy port>

Change permission on this new file :

chmod 600 ~/.ssh/config

Then for GIT, you can then edit git's config file <REPO>/.git/config and modify remote section

[remote "origin"]
        #url = https://[email protected]/chemin-du-repo.git
        url = ssh://user-git@host-git/chemin-du-repo.git

...or if you do not already have a remote origin add it :

git remote add origin ssh://user-git@host-git/chemin-du-repo.git

and then push your modifications :

git push -u origin master