Skip to content

Instantly share code, notes, and snippets.

View JonTheWong's full-sized avatar
💭
Working on forgetfulmail

Jon Wong JonTheWong

💭
Working on forgetfulmail
View GitHub Profile
@JonTheWong
JonTheWong / rspamc.txt
Last active August 5, 2021 01:16
rspamc - learn_spam/learn_ham Argument list too long
# How to scan for ham/spam in large diretories on CentOS 7
rspamc -h 10.0.0.1:11334 -t 120 learn_ham *
rspamc -h 10.0.0.1:11334 -t 120 learn_spam *
We don't use password, because i allowed specific hosts to run admin control tools.
https://manpages.debian.org/testing/rspamd/rspamc.1.en.html
http://manpages.ubuntu.com/manpages/groovy/man1/rspamc.1.html
@JonTheWong
JonTheWong / jonthewong.pub
Last active March 20, 2020 06:22
jonthewong.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDUF6uIjRw9elKk6FBYA/KWTwHaY3kTjDkccAEVunYKzoKR0XvMAxvNlsN3qaltSi4XNKuDiXFF58sesG55U7N33IGfqWAhXFOIFRuVLY3gF0RMn15xNn+V588Kg0VJJTz2A5ebGFi8RHbE6v8nJC5MH5L4FGG8wq57uuoJCkqAHEnmX/T7Re09unXk6ER9SfUPUMAU1Rwtm/TR8GK2eUjjusIQq5/dNIzwTzfaQh36Mo0evvOvXwSRxCkT9fbGvjzGbzy+mpNmXC19VmVm3FbdeJw5/MN2wMg+l3s97cnz2q0fr9Az0Egdk9y8G8tCWxTrMQmoPo0p5LWy7+EJ+BVtu1XckC/EIRxJvND9uwmztZx6Kf6FszGsDYT6E6gLKTHeQy+3yD3s5t++bRxORCOfVa5rE5r1kw4qFCYt6AWU+dzUcICtDujj4NNlLTrrX31H8l6AzxFd+jr7po/tk9CzTy7tuqWyDsagSK2jBvNNPxyWmS0QyZ0M0GFzyvV9fn4tlf2Qj1sfGhOOIaEVY/AplkafKX1uZyKoEtQDuMcvXFRsIUJmID1SMI8GfRDuc5y62H31gWgXgzN2WWUyr292U3BxIhuV5T/o7YNUfrov3BmoRFgdef+h1ufvgDzBDRx0l8+uQAF2WwJe9Xv9eZwAqwlVgHQWGdfLLCq+fki0IQ== me@jonthewong.com
<?php
/**
* Generate uuids for clients and admins that don't have uuids set.
*
* The WHMCS 6.2.0 update process automatically inserts uuids, but if your
* installation bypasses WHMCS update routines then this will generate uuids for
* the client and admin users that don't have one yet.
*
* Warning! Please back up at least your tblclient and tbladmin tables before
@JonTheWong
JonTheWong / gist:0c222703ea7dfecef6dc7074fce1b20c
Created July 15, 2017 22:18
piwik cpanel + log-analytics + vhosts
/etc/apache2/conf.d/includes/pre_main_global.conf -- contains
<Macro piwiklog $vhost $logname $output $env>
LogFormat "$vhost %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" $logname
CustomLog "|/home2/user/public_html/changeddomain.tld/misc/log-analytics/import_logs.py \
--add-sites-new-hosts \
--config=/home2/user/public_html/changeddomain.tld/config/config.ini.php \
--url='https://changeddomain.tld/' \
--token-auth=REMOVED \
--enable-bots \
@JonTheWong
JonTheWong / ovh-centos7-hostname
Last active January 30, 2020 18:25
OVH - CentOS 7 - Change Hostname
I'm writting this gist for anyone who is having problems updating their OVH Public Cloud hostname on CentOS 7
The issue:
When ordering a public cloud instance and setting the instance name to sub.domain.tld and then eventually changing that sub
the settings don't seem to update on OVH side.
It looks like systemd-hostnamed still pulls the original hostname from what i'm guessing is the datastore on OpenStack. (unconfirmed)
The solution:
@JonTheWong
JonTheWong / regex.custom.pm exim rfc
Last active June 17, 2018 20:04
CSF Firewall - regex.custom.pm - Custom Regex - EXIM RFC / EXIM invalid synchronization
This is a small script to block RFC invalid HELO for EXIM based on the popular linux firewall tool called CSF
# Exim_RFC
if (($globlogs{CUSTOM1_LOG}{$lgfile}) and ($line =~ /^.* H=.* \[(\S+)\]:.* rejected MAIL <.*>: Access denied - Invalid HELO name \(See RFC2821 .*\)$/)) {
return ("EXIM RFC Hit from",$1,"EXIMRFC","1","25;tcp,465;tcp,587;tcp","3600");
}
# Exim_SyncIP
if (($globlogs{CUSTOM1_LOG}{$lgfile}) and ($line =~ /^\A\d{4}\-\d{2}\-\d{2}\s\d{2}\:\d{2}\:\d{2}\s\w{4}\s\w{8}\s\w{15}\s\w{5}\s\(\w{5}\s\w{4}\s\w{7}\s\w{7}\s\w{3}\s\w{8}\)\:\s\w{8}\s\w{10}\s\w{4}\sH\=\[(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\S{1,255}\s\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\S{1,4}\:\S{1,4}\:\S{1,4}\:\:\S{1,4})\]\:\d{1,5}\s\w{5}\=\".{0,514}\"$/)) {
return ("EXIM SYNCIP Hit from",$1,"EXIMSYNCIP","3","25;tcp,465;tcp,587;tcp","3600");
}