Blocking Postfix traffic using Fail2ban

So if you are reading this then you have probably seen what appears to be every bot in China connecting to your Postfix server to attempt anything from relaying to auth attacking.

Well, have I got the solution for you!

Now before you implement this, I will warn you, this is very restrictive, it doesn’t really give any room for client error but believe me, your iptables will be full of blocked hosts in no time!

At a minimum I would suggest you have iptables configured for ignoring some CIDR’s (like your cell network, home outside IPv4, work address etc) so that you don’t block yourself from the server.

All of these don’t have to be implemented, if you don’t see the need, don’t add it.

Assumptions

I will assume you have a working environment, I’m specifically using Ubuntu 16.04.3 LTS – because of Postfix potentially logging differently depending on the version, I can only say that these regex filters work for this flavor. I use Postfix 3.1.0, to check the version you use:

You will need:

  1. Ubuntu 16.04 LTS
  2. iptables installed
  3. postfix installed and configured to receive mail
  4. fail2ban installed and basic jail configuration setup

Jails

Like I said before, these are quite brutal, you can change the bantime and maxretry strings as you see fit.

Filters

Filters will need to be placed in “/etc/fail2ban/filter.d” folder. The file name will need to be what the jail is called eg: postfix-rbl554 = /etc/fail2ban/filter.d/postfix-rbl554.conf

I know some of these regex queries might look like duplicates but I want to make sure that all conditions are met regardless of string.

Postfix-auth

postfix-rbl504

postfix-rbl550

postfix-rbl454

postfix-rbl554

Conclusion

Obviously, this is not a silver bullet, you should try this along with Postfix RBL blocking and something like Spamassasin for optimal results.

If you really want to clean up your logs and stop wasting resources processing bot attacks then this will really come in handy but just beware you might block a source you aren’t meant to

Citrix XenApp – Present Linux Applications To Users

citrix xenapp

Citrix XenApp – Present Linux Applications

Why stop at virtualising your Microsoft applications and expand it to Linux?

That’s what I asked myself before working out how to present Linux applications (in particular Kali Linux tools), I couldn’t find any guidance on the interwebz about it and certainly didn’t see any write ups from Citrix themselves so I thought I’d just give it a go and see how far I’d get.

Requirements

  1. Working Citrix XenApp farm (mine is 6.5 and I’d assume newer versions would work)
  2. A working Linux server with a desktop installed, the application you wish to publish installed and OpenSSH installed, listening on port 22 and allowing users to log in.
  3. Putty.exe placed on the Citrix XenApp App server in a publicly accessible place

Xming

XMing is a free X window server for Microsoft Windows. It allows one to use Linux graphical applications remotely. We will utilise this application in the Citrix XenApp environment to open applications on the remote Linux server.

Publishing

1. Install Xming on Citrix XenApp application server from https://sourceforge.net/projects/xming/
2. Publish Xming as any usual application and assign it to all users that will require running Linux apps on Citrix XenApp
3. Create a plain text file in a publicly accessible place, name it the application name with a .txt format and in the file put the command to run that application.

Example:

notepad iceweazel
3. Create a new published application in Citrix and name it the name of the Linux application
4. Type is “Application” and “Accessed From Server”
5. Point to your putty.exe and add the following: “-l %username% -pw %password% -X -m %pathtotextfile%”

Example:

citrix xenapp location

So what Putty does is log into the Linux server with the credentials specified and allows X Windows passthrough and runs the command based in the text file – super simple 🙂

The rest of the application settings are how you would normally publish applications.

User Procedure

1. Run Xming, select “Multiple Windows”, “Start No Client”, don’t change additional settings, Finish (or next, next, next, finish) AKA don’t touch anything and do defaults!!


xming display settingsxming session type xming additional parameters xming finish

When that is running there will be a Xming icon that appears in your taskbar

2. Launch the published application (a Putty window will appear, do not close this until you have finished with the application).

Conclusion

This is an excellent way to bridge the gap between users running Microsoft Windows and running open source applications.

As always, happy to answer questions and comments below.

 

Automatically Upload Desktop, Documents and Downloads to Dropbox from your Mac

dropbox_glyph_blue

 

If you would like to automatically upload your Desktop, Documents and Downloads automatically to your Dropbox from your Mac, follow this nice little trick:

I will be using the “Documents” folder as an example:

Open Terminal (Spotlight/Terminal)

Change directory to your Dropbox folder (by default it is in the users home directory)

Change to Dropbox Directory

Create the symbolic link from your users Documents folder to Dropbox

(Mine already exists)

Link Documents to Dropbox

Repeat for any other folders you want to back up automatically to Dropbox.

Fix resolution for VMware Fusion Unity

LOGO1

Fix resolution for VMware Fusion Unity

This is for VMware Fusion version 7.1 however it might work *not tested with other versions.

I’m just doing a quick write up about how to fix the annoying resolution problem when running applications in Unity on VMware Fusion. This issue just keeps coming back (after installing VMware Fusion) and I can never remember how to fix it. It’s obvious when you see it but it isn’t when you are in a panic trying to fix it!

Under the virtual machine, click settings

Click on Display

vmware fusion virtual machine settings

Click on “Use full resolution for Retina display”

vmware fusion ful resolution retina unity

VMTools will prompt you to log off

VMtools change user interface size settings log off

Now go into Unity view and you will now see things without a microscope!

Should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.

Creating a software RAID on Ubuntu/Debian

linux-logo-300x300

Creating a software raid of disks is quite easy in Ubuntu, I will assume the disks are attached (physically or virtually) to the guest operating system.

Currently Ubuntu supports the following raid levels:

  • RAID level 0
  • RAID level 1
  • RAID level 2
  • RAID level 3
  • RAID level 4
  • RAID level 5
  • RAID level 6
  • RAID level 10
  • RAID level 50
  • RAID level 0+1

In this example I am using sdb1 and sdc1 disks and settings the raid to a mirror (1) with a total mirrored size of 4TB (3906885440K)

  • Install mdadm (if not already installed)

  • Run mdadm to create the mirror

mdadm_create_raid1
  • Run mkfs.ext3 to create a ext3 filesystem on the mirror volume

mkfs.ext3_dev_md0
  • Mount the mirror by creating a mount point and running mount to mount the md0 volume

mount_raid1
  • Check to see if you can see the mirror

df_h_raid1
  • Check the status of the build

mdadm_raid_build_cat_proc
  • Add to fstab to auto mount on startup

Should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.