Skip to content

Instantly share code, notes, and snippets.

View moisseev's full-sized avatar
:octocat:
🎖🎖🎖

Alexander Moisseev moisseev

:octocat:
🎖🎖🎖
View GitHub Profile
@moisseev
moisseev / BackupExpire-test.pl
Last active August 29, 2015 14:20
Simple test of BackupPC_dump subroutines: BackupExpire and BackupFullExpire.
#!/usr/bin/perl
#============================================================= -*-perl-*-
# Simple test of BackupPC_dump subroutines:
# BackupExpire and BackupFullExpire.
#========================================================================
#
# AUTHOR
# Alexander Moisseev <[email protected]>
#
# COPYRIGHT
@moisseev
moisseev / patch-lib__BackupPC__CGI__Lib.pm.diff
Created April 30, 2015 14:33
BackupPC CGI: Set 404 status code to HTTP header for all objects returned on error.
--- ./lib/BackupPC/CGI/Lib.pm.orig 2015-04-30 16:04:21.000000000 +0300
+++ ./lib/BackupPC/CGI/Lib.pm 2015-04-30 17:04:54.000000000 +0300
@@ -289,7 +289,12 @@
Trailer();
} else {
my $content = eval("qq{$Lang->{Error____head}}");
- Header(eval("qq{$Lang->{Error}}"), $content);
+ Header(
+ eval("qq{$Lang->{Error}}"),
+ $content,
@moisseev
moisseev / courier-imap_postfix_last-login.pl
Last active August 29, 2015 14:22
Retrieve the last login and login count of each email account from maillog (courier-imap + postfix)
#!/usr/local/bin/perl -w
#============================================================= -*-perl-*-
# courier-imap_postfix_last-login.pl
#========================================================================
# Version 0.0.1, 2015-06-04
#========================================================================
# Parsing is possible only for one year at time due to syslog date/time format limitation.
# The current year is hardcoded in the script.
@moisseev
moisseev / filter-stats-graph.in
Last active April 13, 2019 15:38
Simple rrdcgi template for Rspamd throughput RRD (rspamd.rrd)
<!--Rspamd filter stats graph-->
<RRD::GRAPH
<RRD::GETVAR TITLE_PREFIX>_<RRD::GETVAR TITLE_SUFFIX>.png
--font DEFAULT:0:Vera
--font-render-mode mono
--start <RRD::GETVAR START> --end now
--title="Rspamd throughput by <RRD::GETVAR TITLE_SUFFIX>, msg/min"
--height=120
--width=720
@moisseev
moisseev / rspamc_learn.sh
Last active February 25, 2024 13:36
Train Rspamd using Dovecot folders ( * the script expunges folders *)
#!/bin/sh
USER="[email protected]"
FOLDER_PREFIX="train_"
FOLDER_HAM="${FOLDER_PREFIX}ham"
FOLDER_PROB="${FOLDER_PREFIX}prob"
FOLDER_SPAM="${FOLDER_PREFIX}spam"
DOVEADM="/usr/local/bin/doveadm"
RSPAMADM="/usr/local/bin/rspamadm"
RSPAMC_CONNECT="-h localhost:11334" # rspamc (--connect|-h) option
@moisseev
moisseev / patch-source3_modules_vfs__shadow__copy2.c
Last active May 16, 2017 13:31
[partial fix] CVE-2015-5299 denies access to ZFS snapshots due to overly strict condition checking (the patch is against Samba 4.4.13)
--- source3/modules/vfs_shadow_copy2.c.orig 2017-04-02 08:19:24 UTC
+++ source3/modules/vfs_shadow_copy2.c
@@ -1533,7 +1533,7 @@ static bool check_access_snapdir(struct
&smb_fname,
false,
SEC_DIR_LIST);
- if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
DEBUG(0,("user does not have list permission "
"on snapdir %s\n",
@moisseev
moisseev / 01-overview.jpg
Last active June 13, 2016 11:57
How to install 2.5" HDD/SSD into 3.5" hot-swap bay.
01-overview.jpg
@moisseev
moisseev / TB_Chat_auth.md
Last active September 16, 2022 15:05
Using Thunderbird's Chat to connect to IRC servers requiring authentication

There are two ways to authenticate on IRC server:

  1. Identify nick with NickServ;
  2. Using the PASS command in the IRC protocol (not supported in the Thunderbird UI).

If your server or bouncer requires [2], set the following preferences as string values:

messenger.account.accountN.options.serverPassword
messenger.account.accountN.options.username
@moisseev
moisseev / dkim-test.sh
Last active March 17, 2017 05:48
Check DKIM signatures of messages stored in a Maildir
#!/bin/sh
MAILDIR="/vmail/example.com/test/Maildir"
DIR_BAD="$MAILDIR/.dkim_bad/new"
DIR_GOOD="$MAILDIR/.dkim_good/new"
DIR_NO_SIG="$MAILDIR/.dkim_no_sig/new"
#-------------------------------
@moisseev
moisseev / Postfix-SASL-client.md
Last active October 28, 2022 09:15
Replacing the default FreeBSD system mailer Sendmail with Postfix using SMTP AUTH, acting as mail client

Replacing the default FreeBSD system mailer Sendmail with Postfix using SMTP AUTH, acting as mail client

Replacing Sendmail with Postfix

# pkg install postfix-sasl1

Would you like to activate Postfix in /etc/mail/mailer.conf [n]? y2

# service sendmail stop