Monday, January 23, 2012

How to Remove Forwarding for all users in exchange

Use Manage Engine AD Manager and select Delivery option and select non for forwarding

Friday, January 20, 2012

Install cPanel / WHM to CentOS

Requirements for Installing cPanel & WHM 11.30


Hardware Requirements





















ComponentMinimum Requirement
Processor266 MHz processor
Memory512 MB RAM (1 GB recommended when hosting many accounts)
Disk Space10GB hard disk

Compatible Software








































Supported Virtual Environments [1] [2]
KVM
Linux-VServer
Microsoft Server® 2008 Hyper-V [3]
OpenVZ (stable releases only)
Oracle VM VirtualBox, VirtualBox OSE
Virtuozzo™
VMware® Server, VMware® ESX Server
Xen, XenEnterprise™, XenExpress™, XenServer™




















Supported Operating Systems
(i386 and x86-64 ONLY)
CentOS versions 4.x, 5.x, 6.x
Red Hat® Enterprise Linux® versions 4.x, 5.x, 6.x
FreeBSD®-RELEASE versions 7.3, 7.4, 8.0, 8.1, 8.2 [4]
CloudLinux 5.x, 6.x [5]


Make sure you have enough space 5GB +. And most important tip: Make sure you have FRESH INSTALL of your OS otherwise your cPanel install might fail.

Now everything is good and it's time to start installing cPanel / WHM.
Make sure you are logged in as root. If it's so write line below to your console:

Code:

cd /home



It will change your directory to "home" where all files will be installed. If that's done write second line in to your console:

Code:

wget -N http://httpupdate.cpanel.net/latest



Now it will download a file called "latest" to your "home" folder. It is our installer, we have to run it to start cPanel / WHM installation process. To do it write a line below to your console:

Code:

sh latest



Now it starts installing. It will take ~2h to complete installation. It depends on your server's speed. Make sure you don't write anything to console while it installs or installation might fail.

So if everything is installed you have to activate your cPanel / WHM license. It goes like that:

Code:

/usr/local/cpanel/cpkeyclt



And you are done. If everything went well you can access WHM now. To go to your WHM go to: http://youriphere:2086.

I hope it helped. If you have questions feel free to ask.

Monday, January 16, 2012

How to easily open an encrypted / password protected PDF document








PDF I am not very sure if you already know about this method – but for all those who are unaware of this, here it goes. PDFs (Portable Document Format) documents can be easily encrypted/password protected so that any un-authorized user cannot view or edit the PDFs content. The secured PDF document can also have DRM restrictions embedded right into the PDF document to provide further restrictions on the user from copying, changing / editing or printing the PDF file.

To remove all the DRM restrictions or the password of the protected PDF document you will need to just forward the PDF file as an attachment to your Gmail account and then simply open them in HTML mode from within your Gmail Inbox – now isn’t that so very simple to remove the PDF restrictions and password protection.

I have previously written macros to remove password protection from excel files – but never this easy to remove a password protection. But you have a few trade-offs in that the formatting of the PDF file is lost to a great extend but you get all the content that’s inside.

How to easily Unprotect/Remove Password from a Protected Excel Worksheet

Open the excel file which is password protected and goto Macro's (I am using Office 2007 so the menu's maybe different View >> Macros). Click on "Record Macro >> OK" and then click on "Stop Recording" from the same menu. Now goto "View Macros", you will find a Macro with a default name E.g. Macro1 - Select the macro name and click on Edit. Now a Visual Basic Editor opens up. Re-place the default code and Paste the below code.

[hr]
Sub Macro1()
'
' Breaks worksheet and workbook structure passwords. Jason S


' probably originator of base code algorithm modified for coverage

' of workbook structure / windows passwords and for multiple passwords

' Jason S http://jsbi.blogspot.com

' Reveals hashed passwords NOT original passwords

Const DBLSPACE As String = vbNewLine & vbNewLine

Const AUTHORS As String = DBLSPACE & vbNewLine & "Adapted from Bob McCormick base code by" & "Jason S http://jsbi.blogspot.com"

Const HEADER As String = "AllInternalPasswords User Message"

Const VERSION As String = DBLSPACE & "Version 1.0 8 Sep 2008"

Const REPBACK As String = DBLSPACE & "Please report failure to jasonblr@gmail.com "

Const ALLCLEAR As String = DBLSPACE & "The workbook should be cleared"

Const MSGNOPWORDS1 As String = "There were no passwords on " & AUTHORS & VERSION

Const MSGNOPWORDS2 As String = "There was no protection to " & "workbook structure or windows." & DBLSPACE

Const MSGTAKETIME As String = "After pressing OK button this " & "will take some time." & DBLSPACE & "Amount of time " & "depends on how many different passwords, the "

Const MSGPWORDFOUND1 As String = "You had a Worksheet " & "Structure or Windows Password set." & DBLSPACE & "The password found was: " & DBLSPACE & "$$" & DBLSPACE & "Note it down for potential future use in other workbooks by " & "the same person who set this password." & DBLSPACE & "Now to check and clear other passwords." & AUTHORS & VERSION

Const MSGPWORDFOUND2 As String = "You had a Worksheet " & "password set." & DBLSPACE & "The password found was: " & DBLSPACE & "$$" & DBLSPACE & "Note it down for potential " & "future use in other workbooks by same person who " & "set this password." & DBLSPACE & "Now to check and clear " & "other passwords." & AUTHORS & VERSION

Const MSGONLYONE As String = "Only structure / windows " & "protected with the password that was just found." & ALLCLEAR & AUTHORS & VERSION & REPBACK

Dim w1 As Worksheet, w2 As Worksheet

Dim i As Integer, j As Integer, k As Integer, l As Integer

Dim m As Integer, n As Integer, i1 As Integer, i2 As Integer

Dim i3 As Integer, i4 As Integer, i5 As Integer, i6 As Integer

Dim PWord1 As String

Dim ShTag As Boolean, WinTag As Boolean

Application.ScreenUpdating = False

With ActiveWorkbook

WinTag = .ProtectStructure Or .ProtectWindows

End With

ShTag = False

For Each w1 In Worksheets

ShTag = ShTag Or w1.ProtectContents

Next w1

If Not ShTag And Not WinTag Then

MsgBox MSGNOPWORDS1, vbInformation, HEADER

Exit Sub

End If

MsgBox MSGTAKETIME, vbInformation, HEADER

If Not WinTag Then

MsgBox MSGNOPWORDS2, vbInformation, HEADER

Else

On Error Resume Next

Do 'dummy do loop

For i = 65 To 66: For j = 65 To 66: For k = 65 To 66

For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66

For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66

For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126

With ActiveWorkbook

.Unprotect Chr(i) & Chr(j) & Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)

If .ProtectStructure = False And .ProtectWindows = False Then

PWord1 = Chr(i) & Chr(j) & Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)

MsgBox Application.Substitute(MSGPWORDFOUND1, "$$", PWord1), vbInformation, HEADER

Exit Do 'Bypass all for...nexts

End If

End With

Next: Next: Next: Next: Next: Next

Next: Next: Next: Next: Next: Next

Loop Until True

On Error GoTo 0

End If

If WinTag And Not ShTag Then

MsgBox MSGONLYONE, vbInformation, HEADER

Exit Sub

End If

On Error Resume Next

For Each w1 In Worksheets

'Attempt clearance with PWord1

w1.Unprotect PWord1

Next w1

On Error GoTo 0

ShTag = False

For Each w1 In Worksheets

'Checks for all clear ShTag triggered to 1 if not.

ShTag = ShTag Or w1.ProtectContents

Next w1

If ShTag Then

For Each w1 In Worksheets

With w1

If .ProtectContents Then

On Error Resume Next

Do 'Dummy do loop

For i = 65 To 66: For j = 65 To 66: For k = 65 To 66

For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66

For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66

For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126

.Unprotect Chr(i) & Chr(j) & Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)

If Not .ProtectContents Then

PWord1 = Chr(i) & Chr(j) & Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)

MsgBox Application.Substitute(MSGPWORDFOUND2, "$$", PWord1), vbInformation, HEADER

'leverage finding Pword by trying on other sheets

For Each w2 In Worksheets

w2.Unprotect PWord1

Next w2

Exit Do 'Bypass all for...nexts

End If

Next: Next: Next: Next: Next: Next

Next: Next: Next: Next: Next: Next

Loop Until True

On Error GoTo 0

End If

End With

Next w1

End If

MsgBox ALLCLEAR & AUTHORS & VERSION & REPBACK, vbInformation, HEADER
'
End Sub

[hr]

Finally, run the Macro(View >> Macros >> View Macros >> Run). You will get the password of the protected workbook and worksheet in Excel. I have tested the above in Microsoft Office Excel XP / 2003 / 2007

 

 

Sunday, January 15, 2012

High Memory Usage – Windows Server 2008 R2 File Server

I recently reinstalled my file server on Windows Server 2008 R2 on VMware ESXi 4.1.1 and I noticed something very strange and very alarming. Couple hours after booting up, the server would use all of the physical memory as shown on the screenshots below.



By design, some services in 2008 R2 like Lsass.exe and dfs-replication will cache memory for future utilization. Exchange has the same behavior but on much bigger scale as it can eat all available memory. This cache is not a problem because the cached memory can be released and given to the OS or applications if needed be and doesn’t create any performance related issues. Note that this behavior is new to 2008 R2. In previous versions of Windows Server, you had to install Dynamic Cache Service to throttle the cache growth but it is no longer needed in the current version of Windows due to some kernel improvement. I then found a very useful tool  from Sysinternals called RamMap. This tool creates a map of the memory allocated by the operating system.



This is where I found the cause of the “memory leak”. As per Technet “ Metafile is part of the system cache and consists of NTFS metadata. NTFS metadata includes the MFT as well as the other various NTFS metadata files (see How NTFS Works for more details, and of course Windows Internals is a great reference). In the MFT each file attribute record takes 1k and each file has at least one attribute record. Add to this the other NTFS metadata files and you can see why the Metafile category can grow quite large on servers with lots of files.” After adding 1 GB of RAM to my server, the Metafile stabilized to 1.5 GB of allocated memory.

 

Resolution

http://support.microsoft.com/default.aspx?scid=kb;EN-US;979149

 

Wednesday, January 11, 2012

ESX Server - A general system error occurred: The file is too big for the filesystem

So there I was, trying to create an uber sized partition on my RAID 10 array within my vmfs3 partition.

The problem? A general system error occurred: The file is too big for the filesystem
This was the error I received when attempting to create a 600GB Virtual Disk on VMWare ESX Server 3.5.

This was a problem. I learned the reason why though. Since I partitioned the storage volumes during installation the installer used block size 1 which only allows Virtual Disks of 256GB.

The solution? Reformat the volume with larger block sizes.
Block size Max Virtual Disk size
1 256 GB
2 512 GB
4 1024 GB
8 2048 GB

Now I had to figure out how to do this without destroying my data.

My server has a 73GB Mirrored boot drive and 900GB of RAID 10. Fortunatly I had enough free space on the boot drive to transfer the data from the RAID 10 temporarily.

Logging into the console of the host I:
cd /vmfs/volumes/vh-01:storage1
Having previously taken note of the volume label and the device name of the volume I wished to modify, in my case vh-01:storage1 and vmhba1:1:0:1, I move the existing data out of Storage1 and into Storage2.
Use the Storage Browser to move your VMs
Next I ran the command to reformat Storage2
vmkfstools --createfs vmfs3 --blocksize 4M -S vh-01:storage1 vmhba1:1:0:1

I chose a 4MB blocksize because this volume will never exceed 1024MB.

Then I just moved the data back to Storage1.