Linux-Windows Tips for System Admin

Friday, April 28, 2017

IIS: Export Private Key Option is Grayed When Exporting a Server Certificate


IIS: Export Private Key Option is Grayed When Exporting a Server Certificate 

Symptoms

When exporting the server certificate from the server's personal certificate store, you may not have the option to export the private key. If this is the case, when the certificate was imported, the option to allow the private key to be exported may have been unchecked. This is a security measure to prevent a possible compromise of the server's private key. Since this could be a potential security risk, the option to mark the private key as exportable is not checked by default.

Resolution 


To correct this problem, you will need access to the original certificate backup (.pfx) file. To ensure this problem does not happen in the future (should you want to export the private key again) make sure during the import process that you select the box "mark the private key as exportable."

Thursday, July 21, 2011

Bugzilla Installation on Windows with Apache+MySQL+Perl

Get Bugzilla

download the Bugzilla from http://bugzilla.org/download.html.
There are two ways of gettng it - through CVS or direct downloading the tar file.
Suggested to download tar file and extract with Winzip or WinRAR.
Create a folder
c:\bugzilla
Copy all the content to this folder.
also create a tem folder
c:\temp

Get MySQL

Get MySQL database. Get the latest version, avoid beta version.

Get Perl

Next, you need to install Perl on the machine.
http://activestate.com/Products/Download/Download.plex?id=ActivePerl

Install Modules
Bugzilla requires a number of perl modules to be installed. They are available in the ActiveState repository and the following additional repositories:
Check the version of perl and accordingly as the repo.
Perl 5.8.x:
http://theoryx5.uwinnipeg.ca/ppms/
Perl 5.10.x:
http://cpan.uwinnipeg.ca/PPMPackages/10xx/ and
http://trouchelle.com/ppm10/
or
http://theoryx5.uwinnipeg.ca/ppms/
http://cpan.uwinnipeg.ca/PPMPackages/12xx/ and
http://trouchelle.com/ppm12/
C:\>ppm version
ppm 4.06 (ActivePerl 1006)
Copyright (C) 2009 ActiveState Software Inc. All rights reserved.

C:\>ppm repo add UWinnipeg http://cpan.uwinnipeg.ca/PPMPackages/10xx/
Downloading ActiveState Package Repository packlist...done
Updating ActiveState Package Repository database...done
Downloading UWinnipeg packlist...done
Updating UWinnipeg database...done
Repo 2 added.

C:\>ppm repo add Trouchelle http://trouchelle.com/ppm10/
Downloading Trouchelle packlist...done
Updating Trouchelle database...done
Repo 3 added.

C:\>ppm repo list
+---------------------------------------------+
¦ id ¦ pkgs ¦ name ¦
+----+-------+--------------------------------¦
¦ 1 ¦ 11417 ¦ ActiveState Package Repository ¦
¦ 2 ¦ 291 ¦ UWinnipeg ¦
¦ 3 ¦ 11737 ¦ Trouchelle ¦
+---------------------------------------------+
(3 enabled repositories)

C:\>ppm upgrade
Syncing site PPM database with .packlists...done
Archive-Tar 1.54 (have 1.52-r1)
Attribute-Handlers 0.87 (have 0.86)
AutoLoader 5.70 (have 5.69)
Bit-Vector 7.1 (have 6.9)
Class-Accessor 0.34 (have 0.33)
Class-ISA 0.36 (have 0.33)
Compress-Raw-Bzip2 2.021 (have 2.020)
Compress-Raw-Zlib 2.021 (have 2.020)
DBD-ODBC 1.23 (have 1.22)
DBI 1.609 (have 1.607)
Date-Calc 5.8 (have 5.6)
Encode 2.37 (have 2.35)
ExtUtils-CBuilder 0.260301 (have 0.2603)
ExtUtils-Manifest 1.57 (have 1.56)
ExtUtils-ParseXS 2.21 (have 2.2002)
File-Path 2.08 (have 2.07_03)
File-Which 1.09 (have 1.07)
IO-Compress 2.021 (have 2.020)
IPC-Cmd 0.50 (have 0.46)
Log-Message-Simple 0.06 (have 0.04)
Math-BigRat 0.24 (have 0.22)
Module-CoreList 2.20 (have 2.17)
Module-Loaded 0.06 (have 0.02)
Object-Accessor 0.36 (have 0.34)
Safe 2.19 (have 2.17)
Test-Simple 0.94 (have 0.92)
Text-CSV_XS 0.68 (have 0.67)
Text-Reform 1.20 (have 1.11)
constant 1.19 (have 1.18)
parent 0.223 (have 0.221)
version 0.7702 (have 0.7701)

C:\>ppm install AppConfig
Downloading AppConfig-1.66...done
Unpacking AppConfig-1.66...done
Generating HTML for AppConfig-1.66...done
Updating files in site area...done
14 files installed

C:\>ppm install TimeDate
Downloading TimeDate-1.19...done
Unpacking TimeDate-1.19...done
Generating HTML for TimeDate-1.19...done
Updating files in site area...done
41 files installed

C:\>ppm install DBI
No missing packages to install

C:\>ppm install DBD-mysql
Downloading DBD-mysql-4.011...done
Unpacking DBD-mysql-4.011...done
Generating HTML for DBD-mysql-4.011...done
Updating files in site area...done
12 files installed

C:\>ppm install Template-Toolkit
Downloading Template-Toolkit-2.22...done
Unpacking Template-Toolkit-2.22...done
Generating HTML for Template-Toolkit-2.22...done
Updating files in site area...done
140 files installed

C:\>ppm install MailTools
Downloading MailTools-2.04...done
Downloading Test-Pod-1.40...done
Unpacking MailTools-2.04...done
Unpacking Test-Pod-1.40...done
Generating HTML for MailTools-2.04...done
Generating HTML for Test-Pod-1.40...done
Updating files in site area...done
43 files installed

C:\>ppm install GD
No missing packages to install

C:\>ppm install Chart
Downloading Chart-2.4.1...done
Unpacking Chart-2.4.1...done
Generating HTML for Chart-2.4.1...done
Updating files in site area...done
16 files installed

C:\>ppm install GDGraph
Downloading GDGraph-1.44...done
Unpacking GDGraph-1.44...done
Generating HTML for GDGraph-1.44...done
Updating files in site area...done
21 files installed

C:\>ppm install PatchReader
Downloading PatchReader-0.9.5...done
Unpacking PatchReader-0.9.5...done
Generating HTML for PatchReader-0.9.5...done
Updating files in site area...done
12 files installed

C:\>ppm install Net-LDAP-Express
Downloading Net-LDAP-Express-0.11...done
Downloading perl-ldap-0.39...done
Downloading Convert-ASN1-0.22...done
Unpacking Net-LDAP-Express-0.11...done
Unpacking perl-ldap-0.39...done
Unpacking Convert-ASN1-0.22...done
Generating HTML for Net-LDAP-Express-0.11...done
Generating HTML for perl-ldap-0.39...done
Generating HTML for Convert-ASN1-0.22...done
Updating files in site area...done
103 files installed

Install Apache

Installing Apache on Windows is again a smooth process. Just follow the instructions. Make sure you Install it for All Users. Apache always install itself in Apache2 directory. On my machine, apache is in C:\Program Files\Apache Group\Apache2.

Configure Apache

Edit C:\Program Files\Apache Group\Apache2\conf\httpd.conf with your favourite text editor.


# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 80

Change the DocumentRoot setting to point to C:\Bugzilla. Note there are two locations in httpd.conf that need to be updated.

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/Bugzilla"

#
# This should be changed to whatever you set DocumentRoot to.
#



Enable CGI support in Apache by uncommenting the AddHandler cgi-script .cgi line.

#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi

And allow .cgi scripts in the Bugzilla directory by adding the ExecCGI option. We also need to allow Bugzilla's .htaccess file to restrict access to sensitive documents by allowing it to override the defaults. This involves changing AllowOverride None to AllowOverride All.

Apache also needs to know to use Perl to execute .cgi files, via the ScriptInterpreterSource directive.

#
# This should be changed to whatever you set DocumentRoot to.
#


#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks ExecCGI

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

#
# Tell Apache to use Perl to execute .cgi
#
ScriptInterpreterSource Registry-Strict




You also should add index.cgi to the DirectoryIndex list.

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents. The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
DirectoryIndex index.html index.html.var index.cgi


In order for ScriptInterpreterSource Registry-Strict to work, you also need to add an entry to the Registry so Apache will use Perl to execute .cgi files.

Create a key HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command with the default value of the full path of perl.exe with a -T parameter. For example C:\Perl\bin\perl.exe -T

Restart Apache

C:\>net stop apache2
The Apache2 service is stopping..
The Apache2 service was stopped successfully.

C:\>net start apache2
The Apache2 service is starting.
The Apache2 service was started successfully.

Bugzilla Configuration

Once all of the above steps are executed successfully, we are ready to test bugzilla installation.
On the console window, go to c:\bugzilla, and execute the following command:
c:\bugzilla>perl checksetup.pl

If it runs without error message,then congratulations,otherwise figure out what mighty be wrong according to the error message,it is very obvious.

Now, we are ready to configure bugzilla. Open a file called localconfig in your favourite text editor.

First, update the DB info:

$db_host = "localhost"; # where is the database?
$db_port = 3306; # which port to use
$db_name = "bugsdb"; # name of the MySQL database
$db_user = "bugs_user"; # user to attach to the MySQL database
$db_pass = 'bugs_pass';

Customize following variables according to your needs to initialize mysql database

@severities,the secerity level of the bug to be specified when creating a new bug
@priorities,the priority you can assign to the bug
@opsys,possible operating system of your test environment
@platforms,hardware platform your system is running on.


You can also update these variables any time after the installation and configuration is over.

Then run the above command again,this will initialize database and create required tables.
c:\bugzilla>perl checksetup.pl

If things go wrong during database setup,try to make sure you have edited database connect parameters correctly .


Tuesday, July 21, 2009

Changing the SVN repo in trac.ini

Wipe a SVN repo and update Trac

If you want to wipe a svn repo - if it got corrupt or if something happened, AND you want to keep trac etc. you need to do the following:

rm /var/lib/svn/projectname
/var/lib/svn/projectname
//chown and reset permissions as covered previously

Trac then will give the following error: "The 'repository_dir' has changed, a 'trac-admin resync' operation is needed". Here is what to do:

trac-admin /home/username/projectname resync

Hope that works ok for you. Info: http://trac.edgewall.org/ticket/4204

Monday, May 4, 2009

How to enable Remote Desktop remotely

How to enable Remote Desktop remotely

In a case you want to remote access a Windows XP professional workstation and the computer Remote Desktop is not enabled, or no one over there to help you to enable it, you may have an option to enable Remote Desktop remotely by using regedit.

To enabling Remote Desktop using regedit, follow these steps:

  1. Run REGEDIT from Start>Run
  2. Click on File, then select Connect Network Registry
  3. Type the remote computer IP or host name in the Enter the object name to select and the click OK.
  4. If you don't have permission to access the remote computer, the logon screen will show up. Type the username and password for the remote computer. Then click OK.
  5. Now, the remote computer is listed in the Registry Editor.
  6. Browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server, in the right panel, seelct fDenyTSConnection (REG_DWORD). Change the value data from 1 (Remote Desktop disabled) to 0 (Remote Desktop enabled).
  7. Close the regeidt.


Or Go to Link

Saturday, March 21, 2009

Trac on Windows - Installation and configuration

Trac is front end to subversion with integrated wiki for developers. Use this How To article to help you install Trac on a Windows computer that isn’t running Apache. The guide assumes you have a working Subversion repository and are using the TortoiseSVN shell on client PC’s.

It is basically a friendly front end to subversion which is a version control system. Trac allows you to use its in-built tracd software so you can view Subversion changes through a browser.

[Note :- Please do not consider this doc as a replacement to Trac support. This is what I found on internet and consolidated at one place.]

Please download all the software required. List is given below with the links to download.

Installation Files

  • Python 2.5
  • Trac
  • SVN Python
  • pysqlite
  • Genshi
  • TortoiseSVN
  • ez_setup.py

Installing the Software

1. Let’s assume you have a working repository which we will say is located at D:\repos and a folder with all of your code located at D:\code.

2. Firstly install Python – Double click the python-2.5.2.msi file and select ‘Install for all users’. Click Next and then Next again (change the location of the Python install if you wish). Click Next once more and Python will start installing. Click Finish and that’s Python installed.

3. Now install the Python SVN file (”svn-python” etc) - Double click the file and then click Next, Next again and Next once more. The installation will run and click the Finish button when prompted.

4. Then we install Python SQLite - Double click the file and then click Next, Next again and Next once more. The installation will run and click the Finish button when prompted.

5. Trac needs to be installed now - Double click the Trac exe and then click Next, Next again and Next once more. The installation will run and click the Finish button when prompted.

6. Lastly we need to install Genshi - Double click the Genshi file and then click Next, Next again and Next once more. The installation will run and click the Finish button when prompted.

Getting Trac Running

1. Create a folder called tracproject or something similar

2. Get your ez_setup.py file and move it into C:\Python25\Scripts folder. Start the command prompt (Click on Start > Run and type ‘cmd‘). Enter the following making sure you hit Enter after each of the four lines.

cd c:\
cd pyth*
cd scr*
ez_setup.py

3. Now type the following command at the same prompt.

trac-admin d:\tracproject initenv

4. This will install Trac to the d:\tracproject directory. Please provide the following details to the command.

Project Name [My Project] - <as per requirement>

Database connection string [sqlite:db/trac.db] > Leave blank by hitting Enter
Repository type [svn] > Leave blank by htting Enter
Path to Repository [/path/to/repos] > D:\repos

5. To easily handle accounts in Trac install Account Manager Plugin available from Trac Hacks

Type the following and hit Enter ( cmd pointing to dir :- C:\Python25\Scripts). This command will install Account manager plugin for trac 11. If you are using trac other than this please refer to site.

easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk

6. There’s a file called trac.ini (d:\trackproject\config )- open it in an editor like Notepad. You need to copy the following lines below and paste them into Notepad above the [header_logo] section.

[components]
acct_mgr.admin.accountmanageradminpage = enabled
acct_mgr.api.accountmanager = enabled
acct_mgr.db.sessionstore = enabled
acct_mgr.htfile.htdigeststore = enabled
acct_mgr.pwhash.htdigesthashmethod = enabled
acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.loginmodule = enabled
acct_mgr.web_ui.registrationmodule = enabled
trac.web.auth.loginmodule = disabled

Once that’s been pasted in save the ini file and close Notepad

7. In explorer go up a level to d:\tracproject and create a new text file called passwd.txt - leave the file blank.

8. Lastly let’s give all anonymous users (those who aren’t logged in) admin access. In the same CMD window type the following and hit Enter.

trac-admin E:\project permission add anonymous TRAC_ADMIN

9. Note this will not return any lines. We will remove the admin access later once you, the real admin, have created your account. And with that we can start Tracd. In CMD type the following and hit Enter.

tracd –p 8000 E:\project

10. Open up your favourite browser and paste this URL: http://localhost:8000/. You should see a link to the name you gave your project. Click on that and there you have Tracd - the front end of the Trac software.

11. In the top right there’s a tab called Admin - click on it. On the menu on the right click on Configuration and when the page loads select HtDigestStore where the filename is D:\tracproject\passwd.txt and the realm is “trac“.

12. Below Configuration is Users - click on it. Create yourself an admin account. Now using the menu go to Permissions. On the right of that page you will see the Grant Permission section. Use the subject field for the username you gave yourself on the Users page and select the TRAC_ADMIN as Action. Click Add and you will see your username in the middle column of the page with TRAC_ADMIN next to it. For the subject anonymous click on the TRAC_ADMIN so it’s ticked and then click on the Remove selected items button.

13. 10. From now on you will need to use that Admin account to Login and make changes to the Trac environment. By default anonymous users can still view all of the Tracd menu’s to see changes to the repository and view tickets.

I hope this guide has helped you get Trac running on your systems. Please feel free to make comments/suggestions/improvement.

Friday, March 20, 2009

Trac On Linux (CentOS 5 and RHEL 5)

# Install python and its goodies.

1. Use yum to install the base package: yum install python
2. Install mod_python. This is so Apache can run the python scripts as a module:

yum install mod_python
3. Install MySQL-python so that python can interact with mysql
  1. Download and untar MySQL-python from http://sourceforge.net/projects/mysql-python
  2. cd $mysqlpythonsourcedir
  3. python setup.py build && python setup.py install
# Install some devel packages that are needed for compiling trac integration:

yum install neon neon-devel python-devel swig

# Clearsilver installation

wget http://dag.wieers.com/rpm/packages/clearsilver/clearsilver-0.10.4-1.el5.rf.i386.rpm
rpm -i clearsilver-0.10.4-1.el5.rf.i386.rpm
OR
wget http://dag.wieers.com/rpm/packages/clearsilver/python-clearsilver-0.10.4-1.el5.rf.i386.rpm
rpm -i python-clearsilver-0.10.4-1.el5.rf.i386.rpm

# Install trac!

1. Download and untar trac from http://trac.edgewall.org/wiki/TracDownload
2. cd $tracsourcedir; python ./setup.py install

# Initialise a Trac project for your new repository:

trac-admin /srv/trac/<project> initenv

For the trac-admin command use the defaults if not sure, giving a descriptive name for the project.
The 'Path to repository` is: /srv/svn/<project>.

Project Name [My Project] -
Database connection string [sqlite:db/trac.db]> Leave blank by hitting Enter
Repository type [svn]> Leave blank by htting Enter
Path to Repository [/path/to/repos]>

# Set the correct file permissions for apache

chown -R apache.apache /srv/trac/<project>


# Tell apache where to find the new Trac project. Here we create an additional Apache configuration file specifically for the Trac projects.

vim /etc/httpd/conf.d/trac.conf

Add the following directives:

<Location /trac/<project>>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /srv/trac/<project>
PythonOption TracUriRoot /trac/<project>
</Location>

<Location "/trac/<project>/login">
AuthType Basic
AuthName "trac"
AuthUserFile /srv/trac/<project>.htpasswd
Require valid-user
</Location>

# Add a Trac user: (this part is optional)

touch /srv/trac/<project>.htpasswd
htpasswd -m /srv/trac/<project>.htpasswd

# Give admin permissions to the Trac user you just created:

trac-admin /srv/trac/<project> permission add TRAC_ADMIN

Where represents the username of the Trac user you just created.

# To easily handle accounts in Trac I would 100% recommend installing the Account Manager Plugin available from Trac Hacks

For Trac 0.9:

easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.9

For Trac 0.10:

Install the trac:WebAdmin plugin.

Then install this plugin:

easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.10

For Trac 0.11:

easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk

If you are using the tracd standalone server you will need to restart it to detect the plugin.

(pobably you are wondering about easy_install.py this is python file and you will find it at
http://peak.telecommunity.com/dist/ez_setup.py)

# There’s a file called trac.ini - open it in an editor. You need to copy the following lines below and paste them into Notepad above the [header_logo] section.

[components]
acct_mgr.admin.accountmanageradminpage = enabled
acct_mgr.api.accountmanager = enabled
acct_mgr.db.sessionstore = enabled
acct_mgr.htfile.htdigeststore = enabled
acct_mgr.pwhash.htdigesthashmethod = enabled
acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.loginmodule = enabled
acct_mgr.web_ui.registrationmodule = enabled
trac.web.auth.loginmodule = disabled

# Lastly let’s give all anonymous users (those who aren’t logged in) admin access.

trac-admin E:\project permission add anonymous TRAC_ADMIN

# Restart Apache:

service httpd restart

Trac wiki (http://server/trac/<project>) associated with the repository.


Please let me know if this helped you. If you come across any problems I will be happy to try and help.

Subversion On Windows XP/2K3

What happened?
So I downloaded SVN from the official site. You can select binary packages for either "Apache 2.0" or "Apache 2.2". (In case you're wondering, download the binaries with the filename similar to "svn-win32-1.5.4.zip")
Personally I dont really care as I dont integrate it with Apache, but its best to pick the version which matches in case you change your mind later down the track.
Extract the contents of the file to where you want SVN to be installed.
Accept the default location.


Creating a service

Before typing up the commands, be sure to note that the syntax requires a space AFTER the "=" sign.

sc create subversion binpath= "\"C:\Program Files\Subversion\bin\svnserve.exe\" --service --root C:\ServerFiles\svn_repository" displayname= "Subversion" depend= tcpip start= auto

A breakdown of the command arguments is shown below.
  • "sc create subversion"
    Creates a service named "subversion".
  • "binpath= "
    The executable file.
  • "--service"
    Run it within the Windows native service wrapper.
  • "--root= "
    The root folder for repositories.
  • "displayname= "
    A nice name for the service in the Service Manager.
  • "depend= "
    Dependencies for this service.
  • "start= "
    The starting method.

Creating a Repository :-
Friends its time to move on. How to create repository.
1. First download TortoiseSVN (Do not forget to restart your PC)
2. Identufy location for all you repository.
(lets say d:\all_repos)
3. Go to directory d:\all_repos
create a new directory with the name of your project. (lets say MyProject)
4. Go to directory d:\all_repos\MyProject
Right click -> TortoiseSVN -> Create repository here (it will ask you couple of question)
and repository is ready.
[ the same you can do it using command line:-
svnadmin create d:\all_repos\MyProject
if you want to specify the database to be use , you need to provide options]

Now you can start using your repo.




Followers

About Me

Pune, Maharashtra, India