vendredi 20 septembre 2019

Mysql / Adminer / Apache in FreeBSD jail

Mysql / Adminer / Apache in FreeBSD jail

 

Prerequisites :
create the jail, and add a ZFS mount to store the databases in another dataset
mount the dataset to /mnt/db-data


install mysql

# install + start at boot with custom config file
pkg install mariadb104-server
sysrc mysql_enable="YES"
sysrc mysql_pidfile=/var/db/mysql/mysql.pid
sysrc mysql_optfile=/usr/local/etc/mysql/my.cnf

# set proper owner for the zfs mounted dataset
chown -R mysql:mysql /mnt/db-data

-> restart the jail

# setup the database
mysql_secure_installation --socket=/mnt/db-data/mysql.sock



logs location : /var/db/mysql/*.log

install adminer

pkg install adminer
the adminer php file is at
/usr/local/www/adminer/adminer/index.php


install apache

# in order to serve adminer
pkg install apache24
sysrc apache24_enable="yes"
service apache24 start
add to /usr/local/etc/apache24/Includes/adminer.conf the config :
<VirtualHost *:80>
        ServerName 127.0.0.1
        ServerAlias adminer
        DocumentRoot "/usr/local/www/adminer/adminer/"

        ErrorLog "/var/log/adminer-error.log"
        CustomLog "/var/log/adminer-access_log" combined

</VirtualHost>





setup php 

# give a php configuration file
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

# needed to work with adminer
change line mysqli.default_socket=
mysqli.default_socket = /mnt/db-data/mysql.sock


# make apache interpret the php
add this to /usr/local/etc/apache24/Includes/php.conf
<IfModule dir_module>
    DirectoryIndex index.php index.html
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
</IfModule>


service apache24 reload


vendredi 25 janvier 2019

Check SSH key locally

ssh-keygen -lf <pubkey_file>

ex : ssh-keygen -lf /etc/ssh/ssh_host_ecdsa_key.pub

Also use :
ssh-keyscan 127.0.0.1 | ssh-keygen -lf -

on remote :
ssh-keyscan <remote> | ssh-keygen -lf -


If needed to get it in md5 hashing algorythm :
for file in ~/.ssh/*.pub; do ssh-keygen -lf $file -E md5 -g; done

jeudi 7 juin 2018

Configure custom ntp server on Openelec

Change the Timeservers setting in /storage/.cache/connman/settings to the desired value

lundi 23 janvier 2017

Android tools

Here are the packages name of the tools used for Android :

android-tools-fastboot
android-tools-adb

mercredi 4 janvier 2017

Install a CA on debian systems

Installing a CA Certificate

Given a CA certificate file foo.crt, follow these steps to install it on Ubuntu:


1. first method : Create a directory for extra CA certificates in /usr/share/ca-certificates:

sudo mkdir /usr/share/ca-certificates/extra


Copy the CA .crt file to this directory:
sudo cp foo.crt /usr/share/ca-certificates/extra/foo.crt


Let Ubuntu add the .crt file's path relative to /usr/share/ca-certificates to /etc/ca-certificates.conf:
sudo dpkg-reconfigure ca-certificates



2. second method - without user interaction (which I use for docker): copy the certificate in /usr/local/share/

execute update-ca-certificates :

Updating certificates in /etc/ssl/certs...
1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.


virtual environnements sous python

python3 venv ~/.virtualenvs/<env_name>
OR virtualenv <env_name>

source ~/.virtualenvs/<env_name>/bin/activate

<env_name> ...

deactivate

lundi 24 octobre 2016

certificate management under Debian/Ubuntu

Add
  1. Copy your CA to dir /usr/local/share/ca-certificates/
  2. Update the CA store:
    sudo update-ca-certificates
Remove
  1. Remove your CA.
  2. Update the CA store:
    sudo update-ca-certificates --fresh

I could not find Gui interfaces, only this technique

Please note that the certificate filenames have to end in .crt, otherwise the update-ca-certificates script won't pick up on them.

To see the certificates on a server :
openssl s_client -showcerts -connect <myserver>:<ssl_port>

mardi 20 septembre 2016

Store git credentials

type
git config credential.helper store
 
then git push
when asked for credentials, type them, they should not be asked again 

lundi 15 février 2016

Wireshark en non-root continued

suite a mon ancien post, je souhaite rajouter quelaue chose :


Wireshark en non-root

Sur les dernieres version de Wireshark, le binaire /usr/bin/dumpcap a pour owner root:root :

ll /usr/bin/dumpcap
-rwxr-xr-- 1 root root 85632 août  16  2015 /usr/bin/dumpcap

Rajouter le user dans le groupe wireshark ne fonctionne donc pas.

changer le groupe du binaire :

sudo chown root:wireshark /usr/bin/dumpcap

d'ou :

ll /usr/bin/dumpcap
-rwxr-xr-- 1 root wireshark 85632 août  16  2015 /usr/bin/dumpcap


Mise a jour de Owncloud

Suite a une n-ieme upgrade owncloud qui ne redemarre pas toute seule, je mets ici mon probleme :

Le probleme est que owncloud est en mode maintenance apres une upgrade par les depots (Ubuntu).

Pour changer le mode de maintenance, editer le fichier <owncloud_dir>/config/config.php :

sudo nano /var/www/owncloud/config/config.php

changer le champ maintenance de true a false.

Reloader apache :

sudo service apache reload

Et voila !