Donc j’ajoute le blocage de cette IP : 194.60.254.242 .
Slack : Migration des données de connexion vers MariaDB pour une utilisation dans Grafana
Pour utiliser le script il faut:
- MariaDB
- Python
- Grafana.
Slack permet le téléchargement d’un fichier CSV ( access_logs.csv ), dont les données sont les suivantes :
- Date Accessed,
- User Agent – Simple,
- User Agent – Full,
- IP Address,
- Number of Logins,
- Last Date Accessed
Petit rappel sur l’ajout d’une database et d’un utilisateur :
$ sudo mysql -u root MariaDB [(none)]> create database SLACK; MariaDB [(none)]> CREATE USER 'slack'@'localhost' IDENTIFIED BY 'slack'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON SLACK.* TO 'slack'@'localhost'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> \quit Bye
Petit rappel aussi en python pour télécharger une classe non disponible :
$ sudo pip install python-dateutil
Le source du programme : ( Les sources sont disponibles ici : https://github.com/farias06/Grafana/blob/master/Slack_CSV_insert.py )
#! /usr/bin/env python3
# ~*~ utf-8 ~*~
import csv
from datetime import datetime
from dateutil.parser import parse
import mysql.connector
from mysql.connector import errorcode
from mysql.connector import (connection)
cnx = connection.MySQLConnection(user='slack', password='slack',
host='127.0.0.1',
database='SLACK')
cursor = cnx.cursor();
now = datetime.now().date();
#cursor.execute("DROP TABLE SLACK;");
#cursor.execute("CREATE TABLE SLACK (DATE datetime, DATE_LAST datetime, USER_AGENT varchar(50),USER_AGENT_FULL varchar(256), IP varchar(26), NUMBER int);");
cursor.execute("DELETE FROM SLACK");
cnx.commit();
with open('access_logs.csv', 'r') as csvfile:
reader = csv.reader(csvfile, quotechar='"')
for row in reader:
MyDate=row[0];
MyDate = MyDate.rsplit('(',1)[0];
if (MyDate == "Date Accessed"):
print("No");
else:
Dt = parse(MyDate)
MyUser=row[1];
MyUser=MyUser.replace("'", " ")
MyUserFull=row[2];
MyUserFull=MyUserFull.replace("'", " ")
MyIP=row[3];
MyNumber=row[4];
MyDateLast=row[5];
MyDateLast = MyDateLast.rsplit('(',1)[0];
DtLast = parse(MyDateLast)
try :
SQLREQUEST = "INSERT INTO SLACK (DATE, USER_AGENT, USER_AGENT_FULL, IP, DATE_LAST, NUMBER) VALUES ('"+str(Dt.date())+" "+str(Dt.time())+"', '"+MyUser+"', '"+MyUserFull+"','"+MyIP+"', '"+str(DtLast.date())+" "+str(DtLast.time())+"', "+MyNumber+" );";
cursor.execute(SQLREQUEST);
except mysql.connector.Error as err:
print("Something went wrong: {}".format(err))
if err.errno == errorcode.ER_BAD_TABLE_ERROR:
print("Creating table SLACK")
else:
None
cnx.commit();
cursor.close();
cnx.close();
# END
Pour lancer le programme :
$ python Slack_CSV_insert.py
Ensuite pour voir les données il y a plusieurs requetes possibles pour le metric :
Par IP :
SELECT
UNIX_TIMESTAMP(date) as time_sec,
SUM(number) as value,
ip as metric
FROM SLACK
WHERE $__timeFilter(date)
GROUP BY day(date),month(date),year(date)
ORDER BY date ASC
Par User Agent :
SELECT
UNIX_TIMESTAMP(date) as time_sec,
SUM(number) as value,
user_agent as metric
FROM SLACK
WHERE $__timeFilter(date)
GROUP BY day(date),month(date),year(date)
ORDER BY date ASC
Par User Agent Full :
SELECT
UNIX_TIMESTAMP(date) as time_sec,
SUM(number) as value,
user_agent_full as metric
FROM SLACK
WHERE $__timeFilter(date)
GROUP BY day(date),month(date),year(date)
ORDER BY date ASC
J’ai noté un bug, j’utilise la version Desktop sous Linux et je n’ai pas de « Application de Bureau Linux » .
Installation Citrix Workspace sous Ubuntu 18
La première étape est le téléchargement du soft sur : https://www.citrix.com/downloads/workspace-app/linux/workspace-app-for-linux-latest.html .
Le lien direct : https://downloads.citrix.com/16914/icaclient_19.12.0.19_amd64.deb
$ sudo dpkg -i icaclient_19.12.0.19_amd64.deb Sélection du paquet icaclient précédemment désélectionné. (Lecture de la base de données... 370627 fichiers et répertoires déjà installés.) Préparation du dépaquetage de icaclient_19.12.0.19_amd64.deb ... Dépaquetage de icaclient (19.12.0.19) ... Paramétrage de icaclient (19.12.0.19) ... Traitement des actions différées (« triggers ») pour gnome-menus (3.13.3-11ubuntu1.1) ... Traitement des actions différées (« triggers ») pour bamfdaemon (0.5.3+18.04.20180207.2-0ubuntu1) ... Rebuilding /usr/share/applications/bamf-2.index... Traitement des actions différées (« triggers ») pour desktop-file-utils (0.23-1ubuntu3.18.04.2) ... Traitement des actions différées (« triggers ») pour mime-support (3.60ubuntu1) ... $ sudo cp /usr/share/ca-certificates/mozilla/*.crt /opt/Citrix/ICAClient/keystore/cacerts/
Ensuite il faut faire la congiguration via :
$ /opt/Citrix/ICAClient/util/configmgr
Ensuite je fais un petit check :
$ /opt/Citrix/ICAClient/util/hdxcheck.sh ========================================================= = Pre-requisite check for the Citrix Workspace for Linux = = Version 1.4 (June 2015) = ========================================================= ------------------------------- -- Client Information... - ------------------------------- Client version: 19.12.0.19 Install location: /opt/Citrix/ICAClient ------------------------------- -- Checking Kernel Version... - ------------------------------- Success, a compatible kernel version(5.3.0) has been found. -------------------------------------------- -- Checking Audio support dependencies.. - -------------------------------------------- ------------------------------------------------------------------ -- Checking that ALSA Support is installed... ------------------------------------------------------------------ Success! - ALSA is installed! ----------------------------------------------------- -- Checking for SPEEX and VORBIS Audio Support... ----------------------------------------------------- Success! All SPEEX and VORBIS dependencies found! -------------------------------------------- -- Checking HDX MediaStream dependencies.. - -------------------------------------------- /opt/Citrix/ICAClient/util/gst_play0.10: error while loading shared libraries: libgstinterfaces-0.10.so.0: cannot open shared object file: No such file or directory The minimum required version of GStreamer is 0.10.25 You are using version of GStreamer Warning! - A compatible version of GStreamer could not be located! The minimum required version of GStreamer 1.0 is 1.2.4 You are using version 1.14.5 of GStreamer 1.0 Success! - A compatible version of GStreamer 1.0 is installed! Your version of libcurl is: 7.58.0 Sucesss! Correct libCurl version found ------------------------------------------------------------------ -- Checking GStreamer webcam Support ... ------------------------------------------------------------------ Warning! - some dependencies required for webcam support are missing. libgstinterfaces-0.10.so.0 => not found libgstapp-0.10.so.0 => not found libgstbase-0.10.so.0 => not found libgstreamer-0.10.so.0 => not found libgstreamer-0.10.so.0 => not found libgstapp-0.10.so.0 => not found libgstpbutils-0.10.so.0 => not found ------------------------------------------------------------------ -- Checking GStreamer 1.0 webcam Support ... ------------------------------------------------------------------ Success! - Gstreamer 1.0 webcam dependencies installed! -------------------------------------- -- Checking for printing support ... - -------------------------------------- Success! - Printing system found The following printers are installed in your system: lpstat: Aucune destination ajoutée. ----------------------------------- -- Checking Display Server Support ... - ----------------------------------- Success! - Your display server is X11, compatible with your Desktop and App sessions ----------------------------------- -- Checking Webkit Support ... - ----------------------------------- Success! - libwebkit2gtk-4.0.so.37 is installed. Selfservice support is present. Recommended version for libwebkit2gtk is (>=2.16.6), ----------------------------------- -- Checking if libpng is present ... - ----------------------------------- Success! - libpng is present., ----------------------------------- -- Checking SaaS App Support ... - ----------------------------------- Success! All SaaS App Support dependencies found! ----------------------------------- -- Checking Smartcard Support ... - ----------------------------------- Success! - Libpcsclite.so installed. Smartcard support enabled. libpcsclite was found on your system but it's version could not be determined. Make sure you have version 1.5.6 or later ------------------------------------ --- Checking other dependencies .. - ------------------------------------ ----------------------------------------------------- -- Checking Client Library dependencies... ----------------------------------------------------- Success! All client dependencies found! ----------------------------------------------------- -- Checking OS Library dependencies... ----------------------------------------------------- Success! All OS dependencies found! ----------------------------- -- Checking For USB Support.. ----------------------------- -------------------------------------------------------------- -- Checking that a compatible version of udev is installed... -------------------------------------------------------------- A compatible version of udev is installed! --------------------------------------------------------------- -- Checking that a compatible version of glibc is installed... --------------------------------------------------------------- The minimum required version is 2.7 You are using version 2.27 of glibc A compatible version of glibc is installed! ---------------------------------------------------------------- -- Checking that a compatible version of libcap is installed... ---------------------------------------------------------------- A compatible version of libcap is installed! Success! All USB dependencies found! ----------------------------------- - Checking X-window dependencies - ----------------------------------- ----------------------------------------------------------------- -- Checking that your system supports the minimum color depth... ----------------------------------------------------------------- The minimum required color depth is 8 bit Your system supports up to 32 bit Success! - A compatible color depth is available! ------------------------------------------------------------ -- Checking that your XServer supports Seamless Windows... ------------------------------------------------------------ Success! - Seamless windows are supported! ------------------------------------------------------- -- Checking that your XServer supports Multi-Monitor... ------------------------------------------------------- Success! - Multi-monitor is supported! Found the following Monitors: head #0: 1920x1080 @ 0,0 ----------------------------------- - Checking Instrumentation support - ----------------------------------- ---------------------------------------------------------------- -- Checking that a compatible version of libjson is installed on your system... ---------------------------------------------------------------- A compatible version of libjson-c is installed! CAS and CEIP will be supported Success! Instrumentation support will be provided! =================================================================== = Pre-requisite check for the Citrix Workspace for Linux Completed = =================================================================== Logfile: /tmp/logfile.txt
Ensuite il suffit de lancer l’application : Citrix Workspace :
Internet Explorer sous Ubuntu 18.04 , c’est possible ? J’ai pas réussi …
Ma version de Ubuntu :
$ cat /etc/*release | grep "DISTRIB" DISTRIB_ID=Ubuntu DISTRIB_RELEASE=18.04 DISTRIB_CODENAME=bionic DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
Je vais donc faire un petit test, d’abord l’installation de de virtualbox 5 à la palce de virtualbox 6.1 . Et ensuite l’installation de vagrant :
$ sudo apt-get install virtualbox
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
gconf-service gconf-service-backend gconf2 gconf2-common libappindicator1 libcurl3-nss libdbusmenu-gtk4 libfwup1 libgconf-2-4 libindicator7
Veuillez utiliser « sudo apt autoremove » pour les supprimer.
Les paquets supplémentaires suivants seront installés :
libgsoap-2.8.60 libvncserver1 virtualbox-dkms virtualbox-qt
Paquets suggérés :
vde2 virtualbox-guest-additions-iso
Les paquets suivants seront ENLEVÉS :
virtualbox-6.1
Les NOUVEAUX paquets suivants seront installés :
libgsoap-2.8.60 libvncserver1 virtualbox virtualbox-dkms virtualbox-qt
0 mis à jour, 5 nouvellement installés, 1 à enlever et 0 non mis à jour.
...
$ sudo apt-get install vagrant
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
gconf-service gconf-service-backend gconf2 gconf2-common libappindicator1 libcurl3-nss libdbusmenu-gtk4 libfwup1 libgconf-2-4 libindicator7
Veuillez utiliser « sudo apt autoremove » pour les supprimer.
Les paquets supplémentaires suivants seront installés :
augeas-lenses bsdtar cpu-checker cryptsetup cryptsetup-bin db-util db5.3-util dmeventd extlinux hfsplus ipxe-qemu ipxe-qemu-256k-compat-efi-roms keyutils
ldmtool libafflib0v5 libarchive-tools libaugeas0 libbfio1 libcacard0 libconfig9 libdevmapper-event1.02.1 libewf2 libfdt1 libguestfs-hfsplus libguestfs-perl
libguestfs-reiserfs libguestfs-tools libguestfs-xfs libguestfs0 libhfsp0 libhivex0 libintl-perl libintl-xs-perl libiscsi7 libldm-1.0-0 liblvm2app2.2
liblvm2cmd2.02 libnfsidmap2 librbd1 librdmacm1 libsodium-dev libspice-server1 libstring-shellquote-perl libsys-virt-perl libtirpc1 libtsk13
libusbredirparser1 libvirt0 libwin-hivex-perl libxen-4.9 libxenstore3.0 libxml-xpath-perl lsscsi lvm2 lzop mdadm msr-tools mtools nfs-common
nfs-kernel-server osinfo-db qemu-block-extra qemu-system-common qemu-system-x86 qemu-utils reiserfsprogs rpcbind ruby-bcrypt-pbkdf ruby-blankslate
ruby-builder ruby-childprocess ruby-domain-name ruby-erubis ruby-excon ruby-ffi ruby-fog-core ruby-fog-json ruby-fog-libvirt ruby-fog-xml ruby-formatador
ruby-http-cookie ruby-i18n ruby-json ruby-libvirt ruby-listen ruby-log4r ruby-mime-types ruby-mime-types-data ruby-multi-json ruby-net-scp ruby-net-sftp
ruby-net-ssh ruby-netrc ruby-nokogiri ruby-oj ruby-pkg-config ruby-rb-inotify ruby-rbnacl ruby-rest-client ruby-sqlite3 ruby-unf ruby-unf-ext scrub seabios
sgabios sharutils sleuthkit supermin syslinux syslinux-common vagrant-libvirt xfsprogs zerofree
Paquets suggérés :
augeas-doc augeas-tools libguestfs-gfs2 libguestfs-jfs libguestfs-nilfs libguestfs-rescue libguestfs-rsync libguestfs-zfs thin-provisioning-tools
dracut-core floppyd open-iscsi watchdog vde2 ovmf ruby-builder-doc ruby-activesupport sharutils-doc autopsy mac-robber xfsdump quota
Les NOUVEAUX paquets suivants seront installés :
augeas-lenses bsdtar cpu-checker cryptsetup cryptsetup-bin db-util db5.3-util dmeventd extlinux hfsplus ipxe-qemu ipxe-qemu-256k-compat-efi-roms keyutils
ldmtool libafflib0v5 libarchive-tools libaugeas0 libbfio1 libcacard0 libconfig9 libdevmapper-event1.02.1 libewf2 libfdt1 libguestfs-hfsplus libguestfs-perl
libguestfs-reiserfs libguestfs-tools libguestfs-xfs libguestfs0 libhfsp0 libhivex0 libintl-perl libintl-xs-perl libiscsi7 libldm-1.0-0 liblvm2app2.2
liblvm2cmd2.02 libnfsidmap2 librbd1 librdmacm1 libsodium-dev libspice-server1 libstring-shellquote-perl libsys-virt-perl libtirpc1 libtsk13
libusbredirparser1 libvirt0 libwin-hivex-perl libxen-4.9 libxenstore3.0 libxml-xpath-perl lsscsi lvm2 lzop mdadm msr-tools mtools nfs-common
nfs-kernel-server osinfo-db qemu-block-extra qemu-system-common qemu-system-x86 qemu-utils reiserfsprogs rpcbind ruby-bcrypt-pbkdf ruby-blankslate
ruby-builder ruby-childprocess ruby-domain-name ruby-erubis ruby-excon ruby-ffi ruby-fog-core ruby-fog-json ruby-fog-libvirt ruby-fog-xml ruby-formatador
ruby-http-cookie ruby-i18n ruby-json ruby-libvirt ruby-listen ruby-log4r ruby-mime-types ruby-mime-types-data ruby-multi-json ruby-net-scp ruby-net-sftp
ruby-net-ssh ruby-netrc ruby-nokogiri ruby-oj ruby-pkg-config ruby-rb-inotify ruby-rbnacl ruby-rest-client ruby-sqlite3 ruby-unf ruby-unf-ext scrub seabios
sgabios sharutils sleuthkit supermin syslinux syslinux-common vagrant vagrant-libvirt xfsprogs zerofree
0 mis à jour, 114 nouvellement installés, 0 à enlever et 0 non mis à jour.
Il est nécessaire de prendre 30,5 Mo dans les archives.
Ensuite téléchargement de la VM our Valgrant :
https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/
$ curl https://az792536.vo.msecnd.net/vms/VMBuild_20190311/Vagrant/MSEdge/MSEdge.Win10.Vagrant.zip --output MSEdge.Win10.Vagrant.zip ... $ mkdir Vagrant $ mv MSEdge.Win10.Vagrant.zip Vagrant/. $ unzip MSEdge.Win10.Vagrant.zip
Ensuite on passe à la phase d’installation :
$ vagrant box add windows/win10-edge 'MSEdge - Win10.box' ==> box: Box file was not detected as metadata. Adding it directly... ==> box: Adding box 'windows/win10-edge' (v0) for provider: box: Unpacking necessary files from: file:///datadisk/Vagrant/MSEdge%20-%20Win10.box ==> box: Successfully added box 'windows/win10-edge' (v0) for 'virtualbox'! $ vagrant init windows/win10-edge A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant. $ vagrant plugin install vagrant-mutate Installing the 'vagrant-mutate' plugin. This can take a few minutes... Bundler, the underlying system Vagrant uses to install plugins, reported an error. The error is shown below. These errors are usually caused by misconfigured plugin installations or transient network issues. The error from Bundler is: conflicting dependencies fog-core (~> 1.43.0) and fog-core (= 1.45.0) Activated fog-core-1.45.0 which does not match conflicting dependency (~> 1.43.0) Conflicting dependency chains: fog-core (= 1.45.0), 1.45.0 activated versus: vagrant-libvirt (> 0), 0.0.41 activated, depends on fog-core (~> 1.43.0) $ wget -c https://releases.hashicorp.com/vagrant/2.0.3/vagrant_2.0.3_x86_64.deb $ sudo dpkg -i vagrant_2.0.3_x86_64.deb (Lecture de la base de données... 365253 fichiers et répertoires déjà installés.) Préparation du dépaquetage de vagrant_2.0.3_x86_64.deb ... Dépaquetage de vagrant (1:2.0.3) sur (2.0.2+dfsg-2ubuntu8) ... Paramétrage de vagrant (1:2.0.3) ... Traitement des actions différées (« triggers ») pour man-db (2.8.3-2ubuntu0.1) ... $ vagrant plugin install vagrant-mutate ==> vagrant: A new version of Vagrant is available: 2.2.7! ==> vagrant: To upgrade visit: https://www.vagrantup.com/downloads.html Installing the 'vagrant-mutate' plugin. This can take a few minutes... Fetching: vagrant-mutate-1.2.0.gem (100%) Installed the plugin 'vagrant-mutate (1.2.0)'! $ vagrant mutate windows/win10-edge libvirt Converting windows/win10-edge from virtualbox to libvirt. (100.00/100%) The box windows/win10-edge (libvirt) is now ready to use. $ vagrant box remove --provider virtualbox windows/win10-edge Removing box 'windows/win10-edge' (v0) with provider 'virtualbox'... $ vagrant up --provider libvirt --no-destroy-on-error The provider 'libvirt' could not be found, but was requested to back the machine 'default'. Please use a provider that exists.
Je n’aurai pas du supprimer la version virtualbox … mais bon le but était libvirt :
$ vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Box 'windows/win10-edge' could not be found. Attempting to find and install... default: Box Provider: virtualbox default: Box Version: >= 0 The box 'windows/win10-edge' could not be found or could not be accessed in the remote catalog. If this is a private box on HashiCorp's Vagrant Cloud, please verify you're logged in via `vagrant login`. Also, please double-check the name. The expanded URL and error message are shown below: URL: ["https://vagrantcloud.com/windows/win10-edge"] Error: The requested URL returned error: 404 Not Found
Impossible de faire l’installation :
$ vagrant plugin install libvirt
Installing the 'libvirt' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:
conflicting dependencies ffi (~> 0.6.3) and ffi (= 1.9.23)
Activated ffi-1.9.23
which does not match conflicting dependency (~> 0.6.3)
Conflicting dependency chains:
ffi (= 1.9.23), 1.9.23 activated
versus:
libvirt (> 0), 0.1.0 activated, depends on
ffi (~> 0.6.3)
$ vagrant plugin list
vagrant-mutate (1.2.0)
$ sudo vagrant plugin install vagrant-libvirt
Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
Building native extensions. This could take a while...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:
ERROR: Failed to build gem native extension.
current directory: /home/arias/.vagrant.d/gems/2.4.3/gems/ruby-libvirt-0.7.1/ext/libvirt
/opt/vagrant/embedded/bin/ruby -r ./siteconf20200407-13090-1gvs01e.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/vagrant/embedded/bin/$(RUBY_BASE_NAME)
--with-libvirt-include
--without-libvirt-include
--with-libvirt-lib
--without-libvirt-lib
--with-libvirt-config
--without-libvirt-config
--with-pkg-config
--without-pkg-config
extconf.rb:73:in `': libvirt library not found in default locations (RuntimeError) To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/arias/.vagrant.d/gems/2.4.3/extensions/x86_64-linux/2.4.0/ruby-libvirt-0.7.1/gem_make.out extconf failed,
exit code 1
Je vais donc refaire l’installation de libvirt :
$ sudo apt install qemu-kvm libvirt-bin ... Des erreurs ont été rencontrées pendant l'exécution : lvm2 libguestfs0:amd64 libguestfs-reiserfs:amd64 libguestfs-perl libguestfs-hfsplus:amd64 libguestfs-tools libguestfs-xfs:amd64