Outils pour utilisateurs

Outils du site


blog

RedHat accès /var/log/mariadb/mariadb.log sans être root

Voir aussi :

Après avoir essayé les ACL sans succès, de changer l'umask et autres…

Le plus simple :

chmod 755 /var/log/mariadb
chmod o+r /var/log/mariadb/mariadb.log

Essai persistance des droits au démarrages

env EDITOR=vim crontab -e
@reboot ( sleep 10 ; chmod o+r /var/log/mariadb/mariadb.log )
Pb

Le problème de cette solution, c'est que cela ne fonctionne pas en cas de redémarrage du service mariadb (sans un redémarrage complet de la machine)

systemctl restart mariadb.service
ls -l /var/log/mariadb/mariadb.log
Solution - systemd service dépendant d'un autre service

/etc/systemd/system/mariadblog.service

[Unit]
Description=MariaDB worldreadable log
After=mariadb.service
BindsTo=mariadb.service
 
[Service]
Type=oneshot
ExecStart=/usr/bin/chmod o+r /var/log/mariadb/mariadb.log
StandardOutput=journal
 
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable mariadblog.service
2025/03/24 15:06

Notes Récupération de données

Voir :

Récupération de données :

  • ddrescue
  • Foremost
  • testdisk / photorec

Important : montage ro

2025/03/24 15:06

Réagir à une attaque DDOS exemple bash iptables

Note : iptables est remplacé maintenant par nftables

Source :

#! /bin/bash
while [ 1 ] ;
 do
 for ip in `lsof -ni | grep httpd | grep -iv listen | awk '{print $8}' | cut -d : -f 2 | sort | uniq | sed s/"http->"//` ;
 # the line above gets the list of all connections and connection attempts, and produces a list of uniq IPs
 # and iterates through the list
  do
    noconns=`lsof -ni | grep $ip | wc -l`;
    # This finds how many connections there are from this particular IP address
    echo $ip : $noconns ;
    if [ "$noconns" -gt "10" ] ;
    # if there are more than 10 connections established or connecting from this IP
    then
      # echo More;
      # echo `date` "$ip has $noconns connections.  Total connections to prod spider:  
      `lsof -ni | grep httpd | grep -iv listen | wc -l` >> /var/log/Ddos/Ddos.log
      # to keep track of the IPs uncomment the above two lines and make sure you can write to the appropriate place
      iptables -I INPUT -s $ip -p tcp -j REJECT --reject-with tcp-reset
      # for these connections, add an iptables statement to send resets on any packets recieved
    else
        # echo Less;
    fi;
  done
sleep 60
done
2025/03/24 15:06

RDP sous GNU/Linux (client)

rdesktop

xrandr |grep "\+$" |head -1 |awk '{print $1}'
rdesktop -P -x -m -z -a 16 -u utilisateur -d domaine -p motdepasse -g 1280x1024 -D 127.0.0.1
rdesktop -z -P -a 16 -g 1024x768 -u utilisateur -p 'P@ssw0rd' www.actinewsreseau.com:3089 -r disk:tmp=/home/jibe/tmp

plan écran ⇔ fenêtré [Ctrl] + [Alt] + [Enter]

rdesktop -0 est l'équivalent à mstsc /admin ou mstsc /console

Voir https://wiki.rrc.uic.edu/wiki/RRC-SCS:_Using_rdesktop_for_Linux

rdesktop -b -z -P -a 16 -g 1024x768 -u 'DOMAIN\user' -p P@ssw0d 178.33.12.210
rdesktop -z -P -a 16 -g 1024x768 -u utilisateur -p P@ssw0rd -r disk:tmp=/home/jean/tmp  38.59.153.12:3089
rdesktop -g 90% -r clipboard:CLIPBOARD windowsbox.net.lab

xfreerdp

xfreerdp /monitor-list
 
xfreerdp /u:user /d:DOMAIN /p:'P@ssw0rd' /v:server /drive:/home/jean/tmp +clipboard:on /w:1024 /h:768 /monitors:0
 
xfreerdp /u:user /d:DOMAIN /p:'P@ssw0rd' /v:server /drive:/home/jean/tmp +clipboard:on /monitors:1 /f
 
xfreerdp /v:localhost:3390 /drive:tmp,/home/jean/tmp /clipboard /monitors:1 /cert-ignore /compression /bpp:16 /network:modem /auto-reconnect /glyph-cache -themes -wallpaper /workarea -sec-nla

Ctrl + Alt + Enter pour quitter le plein écran

Pb
unexpected pubKeyAuth buffer size: 0
Could not verify public key echo!
Authentication failure, check credentials.
If credentials are valid, the NTLMSSP implementation may be to blame.
Error: protocol security negotiation or connection failure
Solution

ajouter l'option -sec-nla

2025/03/24 15:06

Sauvegarde rsync / rdiff-backup avec liste d'exclusion de fichiers

Nous créons un fichier avec les extensions, nom de dossiers et chemins à exclure

backup.rdiff.txt

~*
._*
*~
a_data/
a_data_00?/
ads
ads_00?
ads_00?.htm
ads00?.htm
ads_???.html
ads_data_*/
ads_data/
adServer.htm
ads.htm
ads.html
a.htm
cache/
Cache/
CACHE/
.cache
*.chk
CHKLIST.MS
.deleted/
desktop.ini 
*.dmp
.DS_Store
.fseventsd
ga.js
*.gid
googleadplayer.swf
imgad.jpg
imgad.swf
*.lock
lost+found/
*.met.bak
*.moztmp
*.old
*.part
*.part.met
*.part.met.txtsrc
phpmyvisites.js
*RECYCLE.BIN/
show_ads.js
.Spotlight-*/
*.temp
temp/
Temp/
TEMP/
thumbs.db
Thumbs.db 
*.tib
*.tmp
tmp/
Tmp/
TMP/
tracking.js
.Trash-*/
.Trash/
._.Trashes
.Trashes/
Trash/
urchin.js
webtrends*.js
WebTrends.js
wtid.js
xiti.js
xtclicks.js
xtcore.js
arcthumb/
Folder.htt
.directory
BBThumbs.dat
js.php
wikibits.js
*Resource*.axd
ix.e
ad.txt
a.js
.swfinfo
.bash_history
thumbnails/
SharedObjects/

Ici il s'agit d'un fichier exclusion rsync. Pour rdiff-backup la syntaxe est un peut différente. Pour le convertir il suffit :

cat backup.rdiff.txt |sed -e 's/^/**\//' |sed -e 's|/$|/**|'

Exemple :

rdiff-backup --exclude-other-filesystems --preserve-numerical-ids  --exclude-special-files --no-acls --exclude /home/jean/Backup --exclude-globbing-filelist <(cat backup.rdiff.txt |sed -e 's/^/**\//' |sed -e 's|/$|/**|') /home/jean /home/jean/Backup
2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki