Archive for the tag 'Hacks'

Alfresco security check list

enero 7th, 2015

Alfresco security check list is a list of elements to check before going live with an Alfresco installation in a production environment. This check list is part of the Alfresco Security Best Practices Guide, but I wanted to give it a post in case you missed (thinks that happen due to the 30+ pages of the guide).


My talk about “Alfresco Security Best Practices” at the Alfresco Summit 2014

Integration of IFTTT with Alfresco

junio 9th, 2014

If you are not aware about what IFTTT is, I recommend you to take a look in to this and then come back here to continue reading this blog post.

Here a brief demo about this integration, more details and configuration steps below.

Once you know what “if THIS then THAT” is, I want to explain how I have made a seamless integration with Alfresco using some very straightforward receipts and sending information to Alfresco in the THAT (action) part of its receipt.

Since there is not an Alfresco channel in IFTTT (yet), the data flow is from almost any channel to Alfresco using “Send an email from GMAIL” to Alfresco inbound email service (to a folder). I mean, this article is about how to send multiple kind of data from several IFTTT channels to Alfresco through the inbound email feature built in Alfresco.

In this screenshot you can see a self explained example:

Screen Shot 2014-06-09 at 11.50.25 AM

When I liked a picture in Instagram, it will be sent to Alfresco, once in Alfresco, we have a world of possibilities like transformations, workflows, publication, alerts, etc.

What do we need for having this working? Here you go a list of steps to get this ready to go:

1- Enable your Inbound Email service in Alfresco:
For Alfresco One 4.2 this is very easy by using the new Admin Console http://localhost:8080/alfresco/service/enterprise/admin/admin-inboundemail. Explanation below.
For Alfresco Community refer to here and here

Screen Shot 2014-06-09 at 12.22.54 PM
As you can see in the screenshot above, I have made some changes to allow only emails from and from, any one inside Alfresco and member of the EVERYONE group can send emails to a folder with an email alias aspect. My server is running in Linux and with a non-root user this is the reason I set port 1025, I have a port redirect to listen on port 25 from the internet. Examples of port redirect here

In the example I have created a folder called “Drafts” with the aspect Aliasable (Email):

Screen Shot 2014-06-09 at 12.16.49 PM

Edit this folder properties and add a new value for Alias property, in my case drafts which will be the email address alias of this folder, like (alias + @ + server FQDN). I don’t have to create a MX DNS record because I’m using the FQDN.

Screen Shot 2014-06-09 at 12.18.45 PM

Now, I’m ready to send an email from an existing Alfresco user  (and with permissions to create content) to Alfresco, in my case is the user toni in Alfresco.

2- Create an IFTTT receipt like showed in the video above.

3- Enjoy thousands of ways to add contents to your Alfresco!

Alfresco Tip: How to enable SSL in Alfresco SharePoint Protocol

abril 1st, 2014

There are two ways to approach getting the Alfresco SharePoint Protocol to run over SSL and avoid having to modify the Windows registry for allow non-ssl connections from MS Office (in both Windows and Mac).

One way is to use the out of the box SSL certificate that Alfresco uses for communications between itself and Solr (this blog post is about this option). The other is to generate a new certificate and configure Alfresco to use it, which is the option if you want to use a custom certificate. Next steps tested on Alfresco 4.2, it should work in 4.2 as well for both Enterprise and Community. Please, let me know through a comment if you have an objection on this.

  • 1. Rename file tomcat/shared/classes/alfresco/extension/vti-custom-context.xml.ssl to tomcat/shared/classes/alfresco/extension/vti-custom-context.xml, if it does not exist just create it like below:

<?xml version='1.0' encoding='UTF-8'?>

<bean id="vtiServerConnector" class="">
 <property name="port">
<property name="headerBufferSize">

<!-- Use this Connector instead for SSL communications -->
 <!-- You will need to set the location of the KeyStore holding your -->
 <!-- server certificate, along with the KeyStore password -->
 <!-- You should also update the vti.server.protocol property to https -->
 <bean id="vtiServerConnector" class="">
 <property name="port">
 <property name="headerBufferSize">
 <property name="maxIdleTime">
 <property name="keystore">
 <property name="keyPassword">
 <property name="password">
 <property name="keystoreType">

  • 2. Now add the required attributes to


Remember to change localhost to your server full name (i.e.

  • 3. Restart the Alfresco application server and try the “Edit online” action on a MS Office document through Alfresco Share. A warning message will appear to accept the Alfresco self-signed certificate but is a common behavior.

Alfresco Tip: Unattended installation with one command

febrero 20th, 2014

This tip is valid for Linux and Windows and should be for Enterprise and Community as well. I have tried with last Enterprise build on Ubuntu.

How to do an unattended installation of Alfresco with MySQL support with just one command, is as easy as running the command below (all in one line):

sudo ./alfresco-enterprise- --prefix /opt/alfresco \

--unattendedmodeui none --mode unattended --debuglevel 0 \

--enable-components javaalfresco,alfrescosharepoint,alfrescogoogledocs,libreofficecomponent \
--disable-components postgres \
--jdbc_url "jdbc:mysql://localhost/dbname?useUnicode=yes&characterEncoding=UTF-8" \
--jdbc_driver --jdbc_database dbname --jdbc_username dbuser \
--jdbc_password dbpassword --alfresco_ftp_port 2121 \
--alfresco_admin_password alfrescoadminpassword --baseunixservice_install_as_service 0 \
--alfrescocustomstack_services_startup demand

Change “dbname”, “dbuser”,”dbpassword”, “alfrescoadminpassword” with yours.

MySQL Note: In the example above I’m using MySQL, in this case you must have the DB already installed and when the command ends, copy the MySQL JDBC connector (mysql-connector-java-5.1.18-bin.jar) into the tomcat/lib directory.

Posgresql Note: If you want to install Posgresql it will be installed automatically using the installer but the command should be like this:

sudo ./alfresco-enterprise- --prefix /opt/alfresco \
--unattendedmodeui none --mode unattended --debuglevel 0 \
--enable-components javaalfresco,postgres,alfrescosharepoint,alfrescogoogledocs,libreofficecomponent \
--jdbc_url "jdbc:postgresql://localhost/dbname?useUnicode=yes&characterEncoding=UTF-8" \
--jdbc_driver org.postgresql.Driver --jdbc_database dbname --jdbc_username dbuser \
--jdbc_password dbpassword --alfresco_ftp_port 2121 \
--alfresco_admin_password alfrescoadminpassword --baseunixservice_install_as_service 0 \
--alfrescocustomstack_services_startup demand

In case of Postgresql none library has to be copied to tomcat/bin because is done by the installer.

Remember that it takes 1 or 2 minutes to finish the unattended installation, be patient.

More information and options? “–help” is your friend

./alfresco-enterprise- –help

Alfresco Tip: add more OpenOffice or LibreOffice processes instances to JodConverter

febrero 19th, 2014

Do you have a bottle neck on your transformations to PDF or any other format done by Libre or OpenOffice inside Alfresco?

This tip is thanks to a conversation with my colleague at Alfresco Antonio Soler. Due to the Alfresco Enterprise support for JodConverter this tip is not valid for the Community version.

Thanks to the JodConverter multiples LibreOffice or OpenOffice instances can be invoked to manage more transactions if needed. For example, one process can handle up to 200 transformations and then it is automatically restarted, if you need to manage more than this and add parallel processes  just add more ports comma separated in the JodConverter port option as seen below:

Screen Shot 2014-02-17 at 11.13.15 AM

After apply this change you can see three soffice processes:

Screen Shot 2014-02-17 at 11.12.52 AM

Remember, if you are using OpenOffice you will see “soffice.bin” process and “.soffice.bin” for LibreOffice.

If you want to know more about the new Admin Panel visit this blog post:

Alfresco Tip: got the control and customize your logs (alfresco.log, share.log and solr.log)

febrero 18th, 2014

Are you wondering about how to have full control on the Alfresco logs? If you are an Alfresco administrator I’m pretty sure you want to manage where the alfresco.log, share.log and solr.log are placed, right?

I asume you want to store all your alfresco logs in /opt/alfresco/tomcat/logs, which is the default logging directory for Tomcat and where you can find catalina.out log file as many other out-of-the-box logging files for this well known application server.

If you use the Alfresco installer or a default installation, logging files like alfresco.log, share.log and solr.log may be created where you run the “ start” script or where you start Tomcat. For example, in an installation placed in /opt/alfresco/, when you start Alfresco with ./ start (once you are in /opt/alfresco) those 3 files will be created in /opt/alfresco. If you are using the initd start/stop script for RedHat or Ubuntu you will see log files created in the root “/“ directory or maybe in the user home directory (it may depends).

Here you go how to manage all of these :
(Disclaimer: remember that after doing all said here, Alfresco will still logging some exception before override of the extension files take place).

  • Alfresco repository logs:

Valid for for any Alfresco version. Copy the original log4j properties from the alfresco deployed war file to the extension directory renamed as

cp /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/ /opt/alfresco/tomcat/shared/classes/alfresco/extension/

Edit the file and modify “log4j.appender.File.File” as your needs or like here:

 ###### File appender definition #######
 log4j.appender.File.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
  • Alfresco Share logs:

At the moment there is no extension mechanism for Share logs, then we can not do it in the same way as for Alfresco repository. In this case you only can edit /opt/alfresco/tomcat/webapps/share/WEB-INF/classes/ file and modify appender line as shown below:


The bad news with this method is that you will need to do it again when you upgrade Alfresco Share or redeploy share.war again.

  • Solr logs:

In Alfresco 4.2 (for previous versions see below): alf_data/solr/ you will find the configuration file, now change the line “log4j.appender.File.File” like below:

 # Set root logger level to error
 log4j.rootLogger=WARN, Console, File

 ###### Console appender definition #######

 # All outputs currently set to be a ConsoleAppender.

 log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n

 ###### File appender definition #######
 log4j.appender.File.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n

 ###### added Alfresco SOLR class logging #######

In previous Alfresco versions just bear in mind to copy the log file into the “solr/home” value defined in “{tomcat}/conf/Catalina/{hostname}/solr.xml”. You also may need to reload the Solr log4j resource from the Solr admin panel: https://localhost:8443/solr/admin/cores?action=LOG4J&
Also remember to use  https://localhost:8443/solr/alfresco/admin/logging to manage your Solr logs.

More info about Solr logs here: and here

  • Last step for any configuration about the logs configuration is to restart your application server.

If you want to see and manage the logging with a web tool, see the Alfresco Support Tools in action (for Alfresco Enterprise only) here: This is just an example about the logging section:

Screen Shot 2014-02-17 at 12.28.26 PM

If you want to know more about the new Admin Panel visit this blog post:

UPDATE! Feb 20th

As Cesar mentioned in the comments, the easiest way to have control about where your logs are located just add this line to your init.d script (take care about these variables):

su -c $ALF_USER “cd $ALF_LOGS && $ALF_HOME/ start”

Or even if you are using the script directly add next lines just before the “ERROR=0″ line:



Alfresco Tip: Enable video thumbnail and transformations with FFMPEG

febrero 17th, 2014

This is a quick tip to enable video thumbnail and transformations in Alfresco thanks to FFMPEG integration.  This feature can be integrated easily since Alfresco 4.X (for both Enterprise and Community).  The result on the thumbnail creation is something like this: Screen Shot 2014-02-14 at 3.13.19 PM Video format supported for the JPG thumbnail creation are: 3g2, 3gp, asf, avi, avx, flv, mov, movie, mp4, mpeg2, mpg, ogv and wmv. Other than that you will be able to create folder rules to transform between video formats, this is a sample rule to transform from MP4 to FLV: Screen Shot 2014-02-14 at 3.14.25 PM Thanks to the ffmpeg integration we will be able to transform video formats as shows below:

  • from 3g2 to flv
  • from 3gp to flv
  • from asf to flv
  • from avi to flv
  • from avx to flv
  • from mov to flv
  • from movie to flv
  • from mp4 to flv
  • from mpeg2 to flv
  • from mpg to flv
  • from ogv to flv
  • from wmv to flv
  • from 3g2 to mp4
  • from 3gp to mp4
  • from asf to mp4
  • from avx to mp4
  • from mov to mp4
  • from movie to mp4
  • from mpeg2 to mp4
  • from mpg to mp4
  • from wmv to mp4

By default in Alfresco, ffmpeg also supports next audio transformations:

  • from aiff to mp3
  • from au to mp3
  • from m4a to mp3
  • from oga to mp3
  • from wav to mp3

Now you may are wondering “does ffmpeg support mov to wmv video transformation?” No, it doesn’t do it by default with the out-of-the-box configuration. It only supports conversions TO mp4 and flv. You may add more formats using other tool than ffmpeg or customizing the existing transformers (see last paragraph of this post).

Installation: You already should have an Alfresco 4.2 up and running (it may works with 4.X and pretty similar for Windows and Linux). This procedure is very easy, just install ffmpeg, add some config lines to, rename a couple of files and restart Alfresco:

  • Install ffmpeg on your server. I have installed the static binary for 64 bits from
  • Copy the ffmpeg binary (if static) to a place like  /opt/alfresco/common/bin/
  • Once you have this, run the command from the command line to see if it works correctly: ./ffmpeg
  • Edit your and add next lines:

### Needed for video thumbnails ###
# ffmpeg.thumbnail
# ================

### Needed for video transformations ###
# ffmpeg.flv
# ==========

# ffmpeg.mp4
# ==========
# The avi and ogv to mp4 transformations did not work with ffmpeg 0.8.6
# Please check the latest ffmpeg documentation for the latest information
# content.transformer.avi.mp4.extensions.mpg.mp4.supported=true
# content.transformer.ogv.mp4.extensions.wmv.mp4.supported=true

# ffmpeg.mp3
# ==========

  • Find two files in your extension directory (tomcat/shared/clases/alfresco/extension) and rename them without the .sample extension: video-thumbnail-context.xml and video-transformation-context.xml
  • Restart the application server and done!

And what about if I want to do conversions to other formats? How can I do  transformation for changing resolution, size, quality and so forth? Just take a look to “video-transformation-context.xml” you will se how easy is to create a new commands using different options in the ffmpeg command.

This forum thread could be also helpful for you.

My talk about Alfresco Backup and Recovery Tool in the Alfresco Summit

diciembre 4th, 2013

All recorded videos has been published recently in the Alfresco Summit portal and here you go my talk “Alfresco Backup and Recovery Tool: A Real World Backup Solution” I gave in both Boston and Barcelona. I was the first public presentation about Alfresco BART.

Thanks to all who attended this session and made it one of the most-well attended and highest-rated in both cities. I’m looking forward to keep talking covering security topics as usual (I already have some “hack-ideas”…).

If you only want to see the demo, it starts at minute 33:

The presentation is published in Slideshare as well:

Remember you can download here the White Paper I mention during the talk.

If you only want to see the practical demo (best resolution in the talk video above), you can enjoy it here:

Any questions and comments are always welcome!

Running the Alfresco Solr backup from the command line

noviembre 18th, 2013

SOLR can be backed up by different ways. It uses a scheduled job by default but also can be triggered by the JMX interface in Alfresco Enterprise. Additionally can be done by direct using next URLs. Example for doing a backup of the alfresco solr core and only keep 1 backup:


For the archive core and only keep 1 backup:


In order to do the backup from the command line, you may use the “curl” command and run it like this (see comment about pem certificate below):

curl -k --cert /opt/alfresco/alf_data/keystore/browser.pem:alfresco "https://localhost:8443/solr/alfresco/replication?command=backup&location=/opt/alfresco/alf_data/solrBackup/alfresco&numberToKeep=1"


curl -k --cert /opt/alfresco/alf_data/keystore/browser.pem:alfresco "https://localhost:8443/solr/archive/replication?command=backup&location=/opt/alfresco/alf_data/solrBackup/archive&numberToKeep=1"

Please, note that “curl” does not support p12 certificates therefore you need to convert the default browser.p12 to browser.pem by running (password is alfresco):

openssl pkcs12 -in /opt/alfresco/alf_data/keystore/browser.p12 -out /opt/alfresco/alf_data/keystore/browser.pem –nodes

This option will be included in next version (0.3) of the Alfresco BART (Backup and Recovery Tool).

Next »

A %d blogueros les gusta esto: