Reporting Services Configuration for sending mail

we have a standard IIS SMTP server installed. One of its sending default accounts is Network Service.  Reporting Services has to be configured to use it.

Open the Reporting Services Configuration Manager and go to Service Account. Change it to Network Service.  You will be prompted to save an encryption key with a password.

Go to Email Settings. Put in the sending email address, Use SMTP server is chosen for you, and the SMTP Server ip is 127.0.0.1

Go to the root of the tree on the left, stop and restart the service.

You’re going to need this for Subscription Services. On the SMTP server in iis choose properties, delivery outbound relay and uncheck limit connections to.   My emails kept getting queued for failing to do so.

 

Migrate Reporting Services

Use Report Server Configuration Manager on source server, click on Encryption keys and backup. You’ll need these on the destination server

use Report Server Configuration Manager  and stop the service on both servers

detach ReportServer and ReportServerTempDb on both servers

I advise on the Destination Server making a backup of these two database

Copy the ReportServer and ReportServerTempDb  and the encryption key file to the new server and attach them in Sql Server management studio

Start the service

Click on Encryption Keys, restore and restore the key file generated on the source  server.

Subscription users are going to be different, you have to update the users to the new server. They’re in the format of ServerName\username

select * from subscriptions  in ReportServer database.  Run a simple update query.

Done

 

Adding CLR assemblies after Server Migration

the CLR assemblies are brought across with the database. However they need to be added to the sys.trusted_assemblies to actually run

  1. Go to the database you have the assemblies in. It’s different for each database using CLR assemblies.

List them with sys.assemblies. You need the clr_name field

select * from sys.assemblies

List your CLR assembly files with

select * from sys.assembly_files

you need the hash field

Then run this script for each assembly

–run from create assembly after from copied to @asmbin
USE master;
GO
DECLARE @clrName nvarchar(4000) = ‘clr_name’ –this name is quoted
DECLARE @asmBin varbinary(max) = hash  –no quotes here paste the entire value as is.
DECLARE @hash varbinary(64);

SELECT @hash = HASHBYTES(‘SHA2_512’, @asmBin);

EXEC sys.sp_add_trusted_assembly @hash = @hash,
@description = @clrName;

 

go

MsDeploy Skip website directory contents

First, I created a list of the sites I needed then a simple batch file containing the MSDeploy commands. Be careful of virtual directories. I had virtual directories that went to some large document repositories. The code I’m giving you only handles the root directory of the site and its physical subdirectories.

appcmd list vdir> c:/sites.text

With some editing of the file, I created an import format that I could use in Excel then used the concatenate excel function to build the msdeploy lines below.

MsDeploy is now a separate install. Once installed you will find it at c:\program files\iis\Microsoft Web Deploy V3. Run your commands from this directory.

It’s a great deal easier to directly transfer all the website files first. I personally use FileZilla between servers.  Once done here’s the two commands I use to export a site then import it to a new site. The example site here is 8aSelect and I kept the archivedirectory in c:\resources

Command to export a site and not include the contents of the site itself

msdeploy -verb:sync -source:apphostconfig=”8aselect” -dest:archivedir=c:\resources\8aselect.zip,encryptPassword=MyPassKey -skip:objectName=dirPath,absolutePath=”d:\\websites\\8aselect”

Command to import a site and skip deleting existing files

msdeploy -verb:sync -source:archivedir=”c:\resources\8aselect.zip”,encryptPassword=MyPassKey -dest:appHostConfig=”8aselect” -skip:objectName=filepath,skipAction=delete

mailwizz failing with VestaCP and MariaDb in Centos 7

I recently had a frustrating problem where I couldn’t upload files into MailWizz host.  This also causes problems with command line CSV imports. I discovered I had to open up /etc/my.cnf and edit the following line to

max_allowed_packet = 110M

then in /etc/php.ini I changed the following two lines
post_max_size = 200M
upload_max_filesize = 500M

then execute

service mariadb restart

Under settings, import/export on the backend I set CLI Import Enabled to Yes and Url Import Enabled to Yes.

 

 

 

Watch out for IPTables and order of execution of rules

I recently need to block Barracuda network ips from accessing my mail server, MailWizz. I did the typical

iptables -A INPUT -s 64.235.144.0/20 -j DROP

iptables -A INPUT -s 209.222.80.0/21 -j DROP

iptables -A INPUT -s 35.176.92.96/27 -j DROP

iptables -A INPUT -s 35.157.190.224/27 -j DROP

iptables -A INPUT -s 5.188.211.0/24 -j DROP

iptables -A INPUT -s 204.101.161.159 -j DROP

iptables -A INPUT -s 207.102.138.158 -j DROP

then

service iptables save

service iptables end

the problem with this setup is that those rules end up getting appended to the end and never get blocked. It’s better to go into the iptables directly. ON Centos 7, that is located in /etc/sysconfig/iptables. I added these lines directly before any of the rules were executed.

-A INPUT -s 64.235.144.0/20 -j DROP
-A INPUT -s 209.222.80.0/21 -j DROP
-A INPUT -s 35.176.92.96/27 -j DROP
-A INPUT -s 35.157.190.224/27 -j DROP
-A INPUT -s 5.188.211.0/24 -j DROP
-A INPUT -s 204.101.161.159/32 -j DROP
-A INPUT -s 207.102.138.158/32 -j DROP

I’m also putting in a post on how to block Amazon Bots.  However you’ll need to redo the above after running these commands in Centos 7

yum install git

git clone https://github.com/corbanworks/aws-blocker.git

yum install jq

cd aws-blocker

bash aws-blocker

iptables-save | sudo tee /etc/sysconfig/iptables

service iptables save

service iptables restart

Then add the above manually and you’ll have both AWS and Barracuda blocked.

VisualChron Fails SSIS Task

I recently had a project with SQL Server 2014 utilizing the Visual Studio 2015 shell for a Sql Server Integration Project. I tried to run the SSIS task in Visual Chron and kept getting errors. After exhaustive research I discovered that I had to make sure to go into the project properties and choose SQL Server 2014 as your TargetServerVersion. Once I did this and recompiled one of my scripts, it worked.