Thursday, August 26, 2010

PFX to CRT on Apache Server

PFX to CRT on Apache Server

Move your PFX file to the Apache server.  To convert the .pfx file to a  file that your Apache server will understand

Run the following command using OPENSSL:

1. To export the Private key file from the .pfx file
openssl pkcs12 -in filename.p12  -nocerts -out privatekey.key
2. To export the Certificate file from the .pfx file
openssl pkcs12 -in filename.p12 -clcerts -nokeys -out sslcert.crt

filename.p12 (is your existing IIS PFX file)
privatekey.key (is your new exported private key file)
ssl.crt (is your new exported your Entrust SSL certificate)

3. You now need to copy the  files to the locations as described in the httpd.conf
4. To find out where the files should be copied to run this on the httpd.conf

cat httpd.conf | grep SSLCertificateFile  (this will give you the location of where to copy the certificate file)
cat httpd.conf | grep SSLCertificateKeyFile (this will give you the location of where to copy the key file)

5. You will now need to restart apache

Saturday, August 14, 2010

Change AD UNIX shell

Dim oContainer
Set  oContainer=GetObject("LDAP://CN=Users,DC=domain,DC=com")
ModifyUsers oContainer
'cleanup
Set oContainer = Nothing
WScript.Echo "Finished"
Sub ModifyUsers(oObject)
Dim oUser
oObject.Filter = Array("user")
For Each oUser in oObject
oUser.Put "LoginShell", "/bin/bash"
oUser.SetInfo
Next
End Sub

Friday, August 13, 2010

Script to zip BES Log files

BES has the ability to automatically purge old log files as a built-in function of BES. You can go to BlackBerry Server Configuration and change how long the server will keep the logs before purging them, but you can't do the same for SMS/PIN/Phone logs.
Regardless, I'm a log junkie. Much like a scale doesn't lie; the logs don't lie ... and I hate to get rid of them; so much that I really have no problem keeping them for a year or more. There is so much value in them, and they really don't take up all the much space if you zip them up ... even in very busy environment. But, if you leave logs as uncompressed text, you could easily see a volume fill up and you'll be out of space wondering what the heck is going on.
That said, to address a few of my desires:
1) To have logs for as long as possible
2) To not waste disk space unnecessarily
3) To make troubleshooting easier
4) To make planning easier (the next time you need an upgrade you can use the data in these logs to backup your claims / requests)

I've put together this mega-simple script which can really be modified to just about anything ... just be gentle with it because if you change things around you could easily be deleting entire file systems instead of just zipping up some aging log files.
Attached is a zip file with 3 files:
zip.exe (duh)
forfiles.exe (command to iterate the zip command)
go.cmd (script that you execute)

... and here is the contents of go.cmd:

@ECHO OFF
REM -- Script to individually zip BES Log files ...
REM -- Place this file along with forfiles.exe and zip.exe in the root directory of your BlackBerry Logs folder
REM -- By Default: C:\Program Files\Research in Motion\BlackBerry Enterprise Server\Logs
REM -- This will zip all TXT files in the current and all sub-directories 10 days old or older
REM -- 4/23/2008 - Updated to delete old files / directories
REM -- Change "-d-90" if you want to delete files at an age different than 90 days
REM -- Uncomment the REM -- lines at the bottom if you actually want it to do deletion

forfiles.exe -p. -s -m*.txt -d-10 -c"zip -m @FILE.zip @FILE"

REM -- forfiles.exe -p. -s -d-90 -m*.txt -c"cmd /c if @ISDIR==FALSE del /q /f @FILE"
REM -- forfiles.exe -p. -s -d-90 -m*.csv -c"cmd /c if @ISDIR==FALSE del /q /f @FILE"
REM -- forfiles.exe -p. -s -d-90 -m*.zip -c"cmd /c if @ISDIR==FALSE del /q /f @FILE"
REM -- forfiles.exe -p. -s -d-90 -m*.* -c"cmd /c if @ISDIR==TRUE rd /q @FILE"



Here's a breakdown of what the command is doing:

forfiles.exe (The forfiles command, to iterate through all the log files)


-p. (The starting point for the filelist. "." means the current working directory that forfiles.exe is located in)


-s (Recurse subdirectories)


-m*.txt (Process all .TXT files)


-d-10 (10 days old or older)


-c"zip -m @FILE.zip @FILE" (The command to execute on each file. @FILE represents the current file being processed. zip -m tells it to zip the file and move the file into the zip, therefore removing the original .TXT file. Then the next time this gets run it won't have to zip the file again.)


Put these 3 files in the root of your BES Logs directory ... by default it is: "C:\Program Files\Research in Motion\BlackBerry Enterprise Server\Logs" and schedule go.cmd as a task to run nightly; you'll keep the last 10 days of logs easily accessible and older logs on the file system, just compressed.


I had thought about having each day zip into a single file, but then the structure of what is there gets modified ... I wanted to keep it simple, keep the directory / file structure as it was, but just compress the files.



Message Edited by AndyDufresne on 09-05-2008 09:08 AM



------------------------------

If you've found a solution through a post; please mark it as a solution.


If someone's was particularly helpful, give them kudo's!.


Get busy living, or get busy dying.


http://blog.port3101.org/hdawg/



Attachments:



Attachment ziplogfiles.zip 94 KB



 



Source

Tuesday, August 10, 2010

Windows 2003 RDP Black login screen

1. Click on Start and select Run.
2. Type in regedit and click OK.
3. Browse to the registry key HKEY_USERS\.DEFAULT\Control Panel\Colors
4. The values will most likely all be 0's. You need to change them to have the values as per the settings below.
HKEY_USERS\.DEFAULT\Control Panel\Colors]
"ActiveBorder"="212 208 200"
"ActiveTitle"="0 84 227"
"AppWorkSpace"="128 128 128"
"Background"="0 78 152"
"ButtonAlternateFace"="181 181 181"
"ButtonDkShadow"="113 111 100"
"ButtonFace"="236 233 216"
"ButtonHilight"="255 255 255"
"ButtonLight"="241 239 226"
"ButtonShadow"="172 168 153"
"ButtonText"="0 0 0"
"GradientActiveTitle"="61 149 255"
"GradientInactiveTitle"="157 185 235"
"GrayText"="172 168 153"
"Hilight"="49 106 197"
"HilightText"="255 255 255"
"HotTrackingColor"="0 0 128"
"InactiveBorder"="212 208 200"
"InactiveTitle"="122 150 223"
"InactiveTitleText"="216 228 248"
"InfoText"="0 0 0"
"InfoWindow"="255 255 225"
"Menu"="255 255 255"
"MenuText"="0 0 0"
"Scrollbar"="212 208 200"
"TitleText"="255 255 255"
"Window"="255 255 255"
"WindowFrame"="0 0 0"
"WindowText"="0 0 0"
"MenuHilight"="49 106 197"
"MenuBar"="236 233 216"

Tuesday, August 3, 2010

Command Line Hack for: "Terminal Server Has Exceeded the Maximum Number of Allowed Connections"

Here’s a command line hack that you can use to figure out what sessions are connected to the server. Note that you could substitute the IP address for the server name.

query session /server:servername

Sample output:

Now we know that the session ID of the offending session is 2. We can use that in the next step, which is using the reset command to log off that user.

reset session [ID] /server:servername

Sample:

This command won’t display any output, but when we run the query command again, we should see that the session has now been disconnected:

 

source