Skip to content

Instantly share code, notes, and snippets.

View giulianoriccio's full-sized avatar

Giuliano Riccio giulianoriccio

View GitHub Profile
@giulianoriccio
giulianoriccio / encryption.php
Created March 17, 2020 09:24
opencart 1.5.6.4 PHP 7.2+
<?php
final class Encryption {
private $key;
public function __construct($key) {
$this->key = hash('sha256', $key, true);
}
public function encrypt($value) {
return strtr(base64_encode(openssl_encrypt($value, 'aes-128-cbc', $this->key)), '+/=', '-_,');
@giulianoriccio
giulianoriccio / renew-cert-hook.sh
Last active May 29, 2017 08:51
let's encrypt on plesk using certbot - certificate renewal hook
#!/bin/bash
timestamp=$(date +"%Y-%m-%d %H:%M:%S")
/usr/local/psa/bin/certificate -c "${RENEWED_DOMAINS%% *} $timestamp" -domain ${RENEWED_DOMAINS%% *} -key-file $RENEWED_LINEAGE/privkey.pem -cert-file $RENEWED_L$
if [[ $? != 0 ]] ; then
echo "The certificate creation for ${RENEWED_DOMAINS%% *} has failed on Plesk"
exit 1
fi
@giulianoriccio
giulianoriccio / create-cert.sh
Last active February 27, 2017 12:09
let's encrypt on plesk using certbot
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo "You need to specify the domain name"
exit 1
fi
host $1 2>&1 > /dev/null
if [[ $? != 0 ]] ; then