Wednesday, March 21, 2012

Create a self-signed SSL Certificate

1. Generating a private key:

openssl genrsa -des3 -out www.domain.com.key 2048 (with password)

openssl genrsa  -out www.domain.com.key 2048 (without password)

2. Generating Certificate Signing Request (CSR):

openssl req -new -key www.domain.com.key -out www.domain.com.csr

give your informations:

Country Name (2 letter code) [GB]:DE

State or Province Name (full name) [Berkshire]:Hessen  

Locality Name (eg, city) [Newbury]:Wiesbaden  

Organization Name (eg, company) [My Company Ltd]: Your Company Ltd 

Organizational Unit Name (eg, section) []:IT  

Common Name (eg, your name or your server's hostname) []:www.domain.com  

Email Address []:admin@domain.com  

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []: 

3. Generating a Self-Signed Certificate

openssl x509 -req -days 365 -in www.domain.com.csr -signkey www.domain.com.key  -out www.domain.com.crt

4. Installing the Private key and Certificate in Apache configuration file:

SSLEngine On

SSLCertificateFile www.domain.com.crt

SSLCertificateKeyFile www.domain.com.key

5. Restart Apache Service

/etc/init.d/apache2 restart

 

Tuesday, January 24, 2012

Allow from IP without password prompt, and also allow from any address with password prompt

You should write in .htaccess as follows:

Order deny,allow
Deny from all
AuthName "htaccess password prompt"
AuthUserFile /Path-to-Your-Password-File/.htpasswd
AuthType Basic
Require valid-user
#Your Allowed IP Here:
Allow from XXX.XXX.XXX.XXX
Satisfy Any

Friday, January 20, 2012

Apache and Active Directory Authentication on Debian

Make sure your apache supports mod_authnz_ldap, then enable it:

a2enmod ldap
a2enmod authnz_ldap

and restart your Apache:

/etc/init.d/apache2 restart

For the first Step (finding the user) we already need access to the Active Directory. As AD won't allow anonymous acces, you need a username and a password just to do the search. This is not

your administration account! Create a new account with minimal rights.


So what is the username? Depends on your AD Layout. This should give you a pretty good hint

CN=YOUR-NAME,OU=IT Department,OU=Germany,DC=example,DC=com

here is your sample .htaccess:


# Using this to bind
AuthLDAPBindDN "CN=
YOUR-USER,OU=IT Department,DC=example,DC=com"
AuthLDAPBindPassword "
XXX"

# search user
AuthLDAPURL "ldap://
IP-DOMAIN-CONTROLLER/ou=Germany,dc=example,dc=com?sAMAccountName?sub?(objectClass=*)"
AuthType Basic
AuthName "USE YOUR WINDOWS ACCOUNT"
AuthBasicProvider ldap

# Important, otherwise "(9)Bad file descriptor: Could not open password file: (null)"
AuthUserFile /dev/null
require valid-user

you always need to specify at least one organizational unit (ou).

PS.: If your users are split into multiple OU's, your are limiting the logons to OU's from one OU. This is the case im my environment where users are split into different regions. You should use another port (3268).

AuthType Basic
AuthBasicProvider ldap
AuthzLDAPAuthoritative Off
AuthName "whateveryouwant"
AuthLDAPURL "ldap://IP-DOMAIN-CONTROLLER:3268/dc=example,dc=com?sAMAccountName?sub?(objectClass=*)"

# Using this to bind
AuthLDAPBindDN "YOUR-USER@example.com"
AuthLDAPBindPassword "XXX"
require valid-user

Friday, January 13, 2012

Fixing double-encoded UTF-8 data in MySQL

When the data has been double-encoded, you will still have funny looking characters in the database.
Here is how to fix it, in two simple steps, using the mysqldump and mysql commands:

Source Database:

mysqldump -h DB_HOST -u DB_USER -p DB_PASSWORD --opt --quote-names \
--skip-set-charset --default-character-set=latin1 DB_NAME > DB_NAME-dump.sql

Target Database: mysql -h DB_HOST -u DB_USER -p DB_PASSWORD \
--default-character-set=utf8 DB_NAME < DB_NAME-dump.sql

Friday, December 16, 2011

Debian - files list file for package `PACKAGE-NAME' is missing final newline

You have some problem in this file:

/var/lib/dpkg/info/PACKAGE-NAME.list

delete it and reinstall the package:

apt-get install PACKAGE-NAME --reinstall

Tuesday, December 13, 2011

URL based security constraint to SOLR

In /var/lib/tomcat6/webapps/solr/WEB-INF/web.xml, add the following:

Add a username/password to /var/lib/tomcat6/conf/tomcat-users.xml



and restart the tomcat:

/etc/init.d/tomcat6 restart

Monday, December 12, 2011

Memcache and TYPO3

In debian install the php5-memcache and memcached packages:

apt-get install php5-memcache memcached

add the memcache configuration lines to localconf.php:

$TYPO3_CONF_VARS['SYS']['useCachingFramework'] = '1';
$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_pages']['backend'] = 't3lib_cache_backend_MemcachedBackend';
$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_pages']['options'] = array(
'servers' => array('localhost:11211'),
);

$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_pagesection']['backend'] = 't3lib_cache_backend_MemcachedBackend';
$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_pagesection']['options'] = array(
'servers' => array('localhost:11211'),
);

$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_hash']['backend'] = 't3lib_cache_backend_MemcachedBackend';
$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_hash']['options'] = array(
'servers' => array('localhost:11211'),
);

$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_pages']['frontend']= 't3lib_cache_frontend_VariableFrontend';
$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_pagesection']['frontend']= 't3lib_cache_frontend_VariableFrontend';
$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_hash']['frontend']= 't3lib_cache_frontend_VariableFrontend';

Thursday, December 8, 2011

Typo3 Parstime

You could see the parse time for a page in source of that page by adding this line in the localconf.php:

$TYPO3_CONF_VARS["FE"]["debug"] = '1';

Thursday, November 3, 2011

TYPO3 Update - BLOB/TEXT column 'identifier' used in key specification without a key length

By upgrading typo3 (after Database Compare) it might be happened sometimes this Error:

BLOB/TEXT column 'identifier' used in key specification without a key length

You can solve that simply by deleting [multiplyDBfieldSize] = 2 from localconf.php.
If DB is utf-8, it wouldn't need to use this parameter.

Friday, October 21, 2011

Plesk - Enabling change password in Webmail

It is easy. Just rename the file /etc/xinetd.d/poppassd_psa.org to /etc/xinetd.d/poppassd_psa

then restart the xinet.d service:
/etc/init.d/xinetd restart

Friday, October 14, 2011

Windows 2008 BRP: Local activation permission to the iis wamreg admin service required

* From the SBS console, click Administrative Tools > Component Services
(or, if you prefer: click Run > comexp.msc)

* Expand down Component Services > Computers > My Computer > DCOM Config

* Right click on IIS WAMREG Admin Service, then click Properties

*
Click on the Security tab

* Click the Edit... button within the Launch and Activation Permissions section

* Click Add and add the user named: 'Network Service'
(NB: this is the step that confuses people. Most instructions simply tell you to add the appropriate user, but do not make it clear which user to add!)

* Click on the checkbox to Allow (enable) the Local Activation rights option for this user

* Click OK twice, and close Component Services

* Finally reboot the server for good measure and to ensure the change takes effect

http://msmvps.com/blogs/kwsupport/archive/2009/02/15/dcom-10016-event-error.aspx

Friday, October 7, 2011

Backing Up and Restoring Web Sites (Windows SharePoint Services 2.0)

stsadm.exe is at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN.

Find the list of sites:


stsadm.exe -o enumsites -url
To perform a simple backup of a site, you would use syntax similar to the following:
stsadm.exe -o backup -url http://server_name/site -filename backup.dat
To restore a site from a backup file, either to a new site or a separate server,
you would use syntax similar to the following:
stsadm.exe -o restore -url http://server_name/site -filename backup.dat

See also: http://technet.microsoft.com/en-us/library/cc288330%28office.12%29.aspx

Wednesday, August 17, 2011

List all the loaded apache's modules in debian

You can see the loaded modules by apache with this command:

apache2ctl -t -D DUMP_MODULES