Running PHP-FPM in a Docker container with Apache on the host

Running multiple PHP versions on the same server can be a pain, and not the best security-wise. I was pondering on containerizing the thing and decided to try running each PHP into its own PHP-FPM container, while using Apache on the host for ease of use. It turns out it’s pretty simple, with a few gotchas. I put everything into a Github project so I can share it to the world. But most importantly, so I don’t forget how it works 6 months from now. ...

January 30, 2022

Check an SSL certificate against the server private key and CSR

When working with SSL certificates, it can be handy to check that the certificate you got (.crt file) properly corresponds to the private key (.key file) and the certificate request (.csr file). Just use those commands : openssl x509 -noout -modulus -in certificate.crt | openssl md5 openssl rsa -noout -modulus -in privateKey.key | openssl md5 openssl req -noout -modulus -in CSR.csr | openssl md5 They will output a string composed of numbers. All 3 of them need to be the same in order for your certificate to work properly on your server. ...

May 11, 2017

Secure phpMyAdmin install with Fail2ban

First, let’s change the address to access phpMyAdmin. By Default, it’s ser.ver.ip/phpmyadmin. I’ve copied the original phpmyadmin apache config file so I can customize it as I want, and still have the original one in case mine is broken. sudo cp /etc/phpmyadmin/apache.conf /etc/phpmyadmin/apache-custom.conf At the top of the custom file, change the 3 line Alias /phpmyadmin /usr/share/phpmyadmin to something else, like Alias /phpthisismine /usr/share/phpmyadmin Now, I don’t know how your apache is setup to take into account the phpmyadmin configuration file. On my server, it wasn’t added automatically, so I’ve added it myself in /etc/apache2/apache2.conf. At the bottom, just add Include /etc/phpmyadmin/apache-custom.conf. ...

January 18, 2017

Create your own seedbox with Transmission torrent client

Want a small seedbox on your server ? It’s really not complicated, thanks to Transmission. First step, install it using your OS package manager apt-get install transmission-daemon Then we need to stop the deamon to configure it. /etc/init.d/transmission-daemon stop To edit the configuration file (vi FTW): vi /etc/transmission-daemon/settings.json Here is a list of important values to change. You can find documentation about the configuration file there. /* Username and password so only you can access the web interface */ "rpc-username": "myUsername", /* You can enter the password here, it will be hashed on the first login */ "rpc-password": "my5up3r$C0mplic47edPa$$", /* If you don't want login/pass protection, set that to false */ "rpc-authentification-required": true, /* If you want to find your files easily, better change this one */ "download-dir": "/path/to/the/dir", /* You might want to change this one also */ "incomplete-dir": "/path/to/the/dir", /* Authorize access only to known connections * You can set that to false, especially if you have dynamic IP address */ "rpc-whitelist-enabled": true, /* Add your IP address here if you set previous param to true */ "rpc-whitelist": "127.0.0.1,192.168.1.1", /* -- ports setup -- */ /* access to the web interface */ "rpc-port": 8353, /* peer port */ /* set fixed port */ "peer-port": 6401, /* or set a range */ "peer-port-random-high": 6411, "peer-port-random-low": 6401, "peer-port-random-on-start": true, Configure the firewall so we can actually access the web interface and send/receive packets. Be sure to set it up regarding the ports you entered in your configuration file. ...

April 18, 2015

Android : Use your device to debug your app

Because this should be really easy, but it’s a real PAIN, here are steps you have to go through to use your own device to debug your app. Useless to say that as the emulator is crap very slow, this is really necessary to develop in good conditions. This is for windows, but some steps are the same for each OS. Get you device into developer mode Go to parameters, about the phone/tablet/whatever, tap several times on Build number. This will activate the developer mode. ...

November 9, 2014