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 10 months 2 weeks

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 1 year 3 weeks

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 1 year 10 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 1 year 11 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
}
Il y a 1 year 11 months

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

Pages