Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
This page replaces the articles below.
Please refer to these if configuring the file servers in Alfresco versions prior to 4.0:
File Server Subsystem
The File Server Subsystem allows access to the Alfresco data stores through the SMB/CIFS, FTP and NFS protocols. This allows you to browse to the server using Windows Explorer or create a Network Place, for example. As with any other Alfresco Subsystem, the File Server Subsytem exposes all of its configuration options as properties that can easily be controlled through one of the mechanisms described in Configuring Subsystems. The sections that follow describe each of the configurable properties supported by the File Server Subsystem, and for development/debugging purposes some advanced configuration changes that can be made through Spring bean definition overrides.
New in Alfresco 4 is the ability to cluster the filesystem protocols
Configuring Hazelcast for JLAN clustering
The server includes Java socket based implementations of the SMB/CIFS protocol that can be used on any platform. The server can listen for SMB traffic over the TCP protocol (native SMB), supported by Windows 2000 and later versions, and the NetBIOS over TCP (NBT) protocol, supported by all Windows versions. There is also a Windows specific interface that uses Win32 NetBIOS API calls via JNI code. This allows the Alfresco CIFS server to run alongside the native Windows file server.
The default configuration will use the JNI based code under Windows and the Java socket based code under Linux, Solaris and Mac OS X.
The following properties can be configured for the SMB/CIFS server. See Configuring Subsystems.
Unless enabled on Windows via advanced Spring bean definition overrides (see below), the following properties will only take effect on non-Windows servers, where the Java-based SMB implementation is used.
The following property will only take effect on Windows servers, where by default a JNI-based CIFS implementation is in use.
It is more involved to setup alfresco cifs on a windows server than on a Linux server. This is because generally a Linux server does not have any cifs service running before the installation of alfresco whereas a windows server will typically already have its own cifs service running.
For the Netbios protocol, Windows layer can be a front-end layer: a Netbios request sent to the windows server will be redirected by the windows layer to the windows file service or to the alfresco file service, depending on the name sent with the request. The alfresco JNI code allows alfresco Netbios to run while Windows Netbios runs.
However, for native SMB, the JNI there is no alfresco JNI code. That means that alfresco needs to bind to a network interface to its port 445. That means that you have either to deactivate windows native cifs (port 445) or block using a firewall traffic to port 445, or create a virtual network interface and bind alfresco to it. The best solution depends on the version of the OS. See paragraphs Turning off windows native SMB and Turning off windows native SMB on Vista And Windows 2008 for fore information.
On Unix-like systems such as linux, Solaris, Mac OS X, the default Alfresco setup must be run using the root user account so that the CIFS server can bind to the privileged ports (TCP 139/445 UDP 137/138). The CIFS server can be configured to run using non-privileged ports and then use firewall rules to forward requests from the privileged ports to the non-privileged ports.
To configure the CIFS server to use non-privileged ports use the following property settings (See Configuring Subsystems).
cifs.tcpipSMB.port=1445
cifs.netBIOSSMB.namePort=1137
cifs.netBIOSSMB.datagramPort=1138
cifs.netBIOSSMB.sessionPort=1139
Other port numbers can be used but must be above 1024 to be in the non-privileged range.
The firewall rules should then be set up to forward requests on TCP ports 139/445 to TCP 1139/1445 and UDP ports 137/138 to UDP 1137/1138.
On Mac OS X the following commands can be used - also refer to installing on Mac OS X:
sysctl -w net.inet.ip.fw.enable=1
sysctl -w net.inet.ip.forwarding=1
sysctl -w net.inet.ip.fw.verbose=1
sysctl -w net.inet.ip.fw.debug=0
ipfw flush
ipfw add 100 allow ip from any to any via lo0
# Forward native SMB and NetBIOS sessions to non-privileged ports
ipfw add 200 fwd <local-ip>,1445 tcp from any to me dst-port 445
ipfw add 300 fwd <local-ip>,1139 tcp from any to me dst-port 139
# Forward NetBIOS datagrams to non-privileged ports (does not currently work)
ipfw add 400 fwd <local-ip>,1137 udp from any to me dst-port 137
ipfw add 500 fwd <local-ip>,1138 udp from any to me dst-port 138
Replace '<local-ip>' with the IP address of the server that Alfresco is running on.
On Linux, the following commands can be used to get started, but be aware these commands will delete all existing firewall and NAT rules and could be a security risk:
modprobe iptable_nat
iptables -F
iptables -t nat -F
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -A PREROUTING -p tcp --dport 445 -j DNAT --to-destination :1445
iptables -t nat -A PREROUTING -p tcp --dport 139 -j DNAT --to-destination :1139
iptables -t nat -A PREROUTING -p tcp --dport 137:139 -j DNAT --to-destination :1137-1139
iptables -t nat -A PREROUTING -p udp --dport 137:139 -j DNAT --to-destination :1137-1139
As the REDIRECT target doesn't deal with broacasts packets properly, and thus break the NetBIOS name lookups, it is better to use a traditionnal DNAT.
On Solaris 10, ipfilter can be used out of the box:
rdr nge0 192.168.244.25/32 port 445 -> 192.168.244.25 port 1445
rdr nge0 192.168.244.25/32 port 137 -> 192.168.244.25 port 1137
rdr nge0 192.168.244.25/32 port 138 -> 192.168.244.25 port 1138
rdr nge0 192.168.244.25/32 port 139 -> 192.168.244.25 port 1139
$ svcadm restart network/pfil
$ svcadm restart ipfilter
$ ipnat -l
More info @ http://www.obfuscation.org/ipf/ipf-howto.html
The SMB/CIFS server beans are declared in the file-servers-context.xml file in WEB-INF/classes/alfresco/subsystems/fileServers/default/file-servers-context.xml. Using the subsystem extension classpath mechanism, site specific customisation of these default values can be placed in a Spring bean file in /tomcat/shared/classes/alfresco/extension/subsystems/fileServers/default/default/custom-file-servers-context.xml (note that the default/default part of the path is intentional).
The main bean that drives the CIFS server configuration is called cifsServerConfig. This has several properties that can be populated with 'child' beans that control various optional SMB implementations
When one of the above properties is not set, it deactives support for the corresponding protocol implementation.
The tcpipSMB and netBIOSSMB beans have a platforms property that allow their configuration to be targeted to Alfresco servers running on specific platforms. The property is formatted as a comma-separated list of platform IDs. Valid platform IDs are windows, linux, solaris, macosx and aix.
For detailed instructions, see Running Java socket code on Windows.
To run the native SMB over TCP/IP protocol (port 445) under Windows 2003 one possible method is to disable Windows from using the port by editing, or creating, the following registry key:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters]
'SMBDeviceEnabled'=dword:00000000
To enable the Java socket based NetBIOS implementation (ports 137, 138, 139) under Windows requires that NetBIOS is disabled on one or all network adapters. This can be done via the Network Connections control panel in the advanced TCP/IP properties for each adapter.
The serverComment of the cifsServerConfig bean controls the comment that is displayed in various Windows information dialogs.
The sessionDebugFlags property of the cifsServerConfig bean sets debug output levels for CIFS debugging from JLAN. The value should be in the form of a comma-separated list of the flag names in the table below.
Flag | Description |
---|---|
NetBIOS | NetBIOS layer |
State | Session state changes |
Tree | Filesystem connection/disconnection |
Search | Folder searches |
Info | File information requests |
File | File open/close |
FileIO | File read/write |
Tran | Transaction requests |
Echo | Echo requests |
Errors | Responses returning an error status |
IPC | IPC$ named pipe |
Lock | File byte range lock/unlock |
Pkttype | Received packet type |
Dcerpc | DCE/RPC requests |
Statecache | File state caching |
Notify | Change notifications |
Streams | NTFS streams |
Socket | NetBIOS/native SMB socket connections |
PktPool | Memory pool allocations/de-allocations |
PktStats | Memory pool statistics dumped at server shutdown |
ThreadPool | Thread pool |
Those flags will make JLAN produce debug information which is logged by Alfresco.
Alfresco's log4j configuration instructions are below.
The log4j.properties file must also have SMB/CIFS protocol debug output enabled using:
log4j.logger.org.alfresco.smb.protocol=debug
The following logging level must also be enabled to log debug output from the JLAN file server code:
log4j.logger.org.alfresco.fileserver=debug
A default Linux install will use the Java CIFS socket code.
A default Windows install will use the JNI CIFS code. (Note that you have two JNI api: winsock and netbios. On 64bit Windows the Winsock NetBIOS code doesn't exist within the Windows core so you have to force the older Netbios API call.)
However, it is possible to run the Java CIFS socket code, even on Windows. This is usefull as a workaround for JNI related bugs, see eg:
https://issues.alfresco.com/jira/browse/ETHREEOH-2881
https://issues.alfresco.com/jira/browse/JLAN-59
https://issues.alfresco.com/jira/browse/ALF-569
https://issues.alfresco.com/jira/browse/JLAN-91
or if you want to use native SMB protocol (port 445). Indeed, the JNI CIFS code only provides the older Netbios SMB protocol (port 137, 138, 139).
The technique to use alfresco Java CIFS socket code on windows is always the same:
The details however depend on the version of alfresco and the version of the windows server.
For alfresco version 3.2 or after, you need to cifs.disableNativeCode=true in the alfresco-global.properties file to turn off any call to windows netbios DLLs using JNI.
Optionally, for alfresco version 3.2 can use cifs.disableNIO=true in the alfresco-global.properties file.
You also need to add the windows keyword to the list of platforms in the beans tcpipSMB and netBIOSSMB to the platforms property overloading the beans defined in alfresco/WEB-INF/classes/alfresco/subsystems/fileServers/default/file-servers-context.xml i.e change:
<property name='platforms'>
<value>linux,solaris,macosx</value>
</property>
with
<property name='platforms'>
<value>linux,solaris,macosx,windows</value>
</property>
Note: The <property name='platforms'> appears twice in file alfresco/WEB-INF/classes/alfresco/subsystems/fileServers/default/file-servers-context.xml, once for each protocol. It is important you change both properties to get the java socket code for netbios (port 137, 138, 139) and native cifs (port 445).
If you use the Alfresco-dedicated network interface method below, then you will also need tell alfresco to bind the native cifs service (port 445) and the netbios services (ports 137, 138, 139) to this second IP. To do this:
On Windows 2008 server, you basically have only one choice:
deactivate windows cifs (port 445) to allow alfresco java socket code to bind to it.
You can bind alfresco to port 445 using the following method:
On Windows 2003 server, you can use one of the two methods:
Switch off Windows NetBIOS and native SMB, see the [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NetBT\Parameters] described below
This method is usually to be preferred as it allows to have the server serve windows share in parallel of serving alfresco shares.
Use an alias TCP/IP address and bind the Alfresco CIFS/NetBIOS code to that address, as Windows doesn't use the alias address. To add an alias address (or virtual interface) go into the Control Panel -> Network Connections-> LAN Connections -> Properties -> Internet Protocol (TCP/IP) -> Properties -> Advanced -> IP Settings -> IP addresses -> Add, then add another IP address in there. This IP will be used to bind alfresco cifs services to.
You can make sure that no windows services is running on the new nertwork interface using the command netstat -nao: nothing should be listening on ports 445, 137, 138 and 139 of the alfresco dedicated interface before you have started alfresco. This is to allow alfresco to bind to those ports. If you see something listening on this interface before you have started alfresco, then this means that you probably have to deactivate the windows cifs services on that interface (see Turning off netbios in windows 2003). If you start alfresco while a windows service is already running on that interface, you will get an error could not bind to interface, service already in use at boot time.
Make sure you also tell alfresco to bind to this new IP following Alfresco configuration changes above.
The following properties can be configured for the FTP server. See Configuring Subsystems.
The ftp.keyStore, ftp.trustStore, and ftp.passphrase values must all be specified to enable FTPS support. Currently only explicit FTP over SSL/TLS mode is supported, and encrypted data sessions are not currently supported.
To setup the keystore and truststore files follow the instructions from the Java6 JSSE Reference Guide.
You can force all connections to use FTPS by setting
ftp.requireSecureSession=true.
As mentionned above the Java6 JSSE Reference Guide describes how to generate the keystore and truststore in JKS format
We present here an alternative that uses opnssl for the CA, keys and CERT generation.
We use keytool only at the latest step which i to generate the stores in the proprietary JKS format. This scenario may correspond better to the keys and certificate and PKI you have in place.
The keystore allows clients to encryot the communication with the server public key and they can also check the authenticity of the public key using the Certicate Authority.
# Create the CA Key and Certificate for signing Client Certs
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt -subj '/CN=Alex CA'
# Create the Server Key, CSR, and Certificate
openssl genrsa -des3 -out server.key 1024
(or
openssl genrsa -out server.key 1024)
openssl req -new -key server.key -out server.csr -subj '/CN=server1.foo'
# We're self signing our own server cert here. This is a no-no in production.
openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt
# generate a keystore format PKCS12 containing key + certificate
openssl pkcs12 -export -in server.crt -inkey server.key -out keystore.p12 -name serveralias -CAfile ca.crt
# convert keystore from PKCS12 format to JKS format
keytool -importkeystore -deststorepass mypass -destkeypass mypass -destkeystore keystore.jks -srckeystore keystore.p12 -srcstoretype PKCS12 -srcstorepass mypass -alias serveralias
The truststore contains certificates from other parties that you expect to communicate with, or from Certificate Authorities that you trust to identify other parties.
As we created our our CA, we nned to tell Alfresco about it:
keytool -import -alias caalias -file ca.crt -keystore ca.jks
There is debug output that can be enabled by setting the 'SSL' debug flag via
ftp.sessionDebug=SSL
and enabling the
log4j.logger.org.alfresco.fileserver=debug
log4j output.
see also ALF-4488
A good FTPS client is 'filezilla'.
The URL to connect to is
ftpes://server1.foo
where the 'e' in ftpes stands for explicit (that is the client will isssues a AUTH TLS command over the standard FTP port 21)
The FTP server beans are declared in the file-servers-context.xml file in WEB-INF/classes/alfresco/subsystems/fileServers/default/file-servers-context.xml. Using the subsystem extension classpath mechanism, site specific customisation of these default values can be placed in a Spring bean file in /tomcat/shared/classes/alfresco/extension/subsystems/fileServers/default/default/custom-file-servers-context.xml (note that the default/default part of the path is intentional).
The following properties are overridable on the ftpServerConfig bean
In addition, the debugFlags property enables debug output levels for FTP server debugging. The value should be a comma-separated list of flag names from the following table:
Flag | Description |
---|---|
State | Session state changes |
Search | Folder searches |
Info | File information requests |
File | File open/close |
FileIO | File read/write |
Error | Errors |
Pkttype | Received packet type |
Timing | Time packet processing |
Dataport | Data port |
Directory | Directory commands |
SSL | FTPS specific processing |
Configure logging levels for the FTP server in $ALF_HOME/tomcat/webapps/alfresco/WEB-INF/classes/log4j.properties using:
log4j.logger.org.alfresco.ftp.protocol=debug
log4j.logger.org.alfresco.ftp.server=debug
The NFS Server functionality is deprecated in Alfresco 5.0, and likely to be removed in a future release.
It is recommended that TCP connections are used to connect to the Alfresco NFS server. Using a read/write size of 32K will also help to optimize the performance.
The following properties can be configured for the NFS server. See Configuring Subsystems.
For example, the following configuration gives admin a uid and gid of 0 and auser a uid and gid of 501.
nfs.user.mappings=admin,auser
nfs.user.mappings.value.admin.uid=0
nfs.user.mappings.value.admin.gid=0
nfs.user.mappings.value.auser.uid=501
nfs.user.mappings.value.auser.gid=501
The NFS server beans are declared in the file-servers-context.xml file in WEB-INF/classes/alfresco/subsystems/fileServers/default/file-servers-context.xml. Using the subsystem extension classpath mechanism, site specific customisation of these default values can be placed in a Spring bean file in /tomcat/shared/classes/alfresco/extension/subsystems/fileServers/default/default/custom-file-servers-context.xml (note that the default/default part of the path is intentional).
The following properties are overridable on the nfsServerConfig bean
In addition, the debugFlags property enables debug output levels for NFS server debugging. The value should be in the form of a comma-separated list of the flag names in the table below.
Flag | Description |
---|---|
RxData | Request data details |
TxData | Response data details |
DumpData | Hex dump request/response data |
Search | Folder searches |
Info | File information requests |
File | File open/close |
FileIO | File read/write |
Error | Error responses |
Directory | Directory requests (readdir/readdirplus) |
Timing | Request timing |
Session | Session creation/deletion |
The log4j.properties file must also have NFS protocol debug output enabled using:
log4j.logger.org.alfresco.nfs.server=debug
The following logging level must also be enabled to log debug output from the core file server code:
log4j.logger.org.alfresco.fileserver=debug
There are also the following log4j output options for the NFS/mount/portmapper services:
log4j.logger.org.alfresco.nfs.protocol=debug
Output server level debug information from the NFS, mount and portmapper services.
log4j.logger.org.alfresco.nfs.protocol.auth=debug
Output RPC authentication debugging.
NFSServerPort
property is not given it defaults to 2049. This will likely conflict with the a native NFS server, if any. The portmapper daemon when properly used removes any dependency upon a well known port number, however neither Alfresco nor any native NFS server seem to employ this functionality.nfs-utils-1.0.10
version on Linux, mount.nfs
will defer to the portmapper for the port-number, version-number and protocol of the NFS server in question. Only if all three of these are supplied on the command line will the mount command directly contact the Alfresco NFS server. Failing this, mount.nfs
will fail, as it cannot find the server you have described in the portmapper table. You must therefore configure both MountServerPort
and NFSServerPort
to known values above 1024. Afterward the following command line should succeed...mount -onolock,port=yourNfsPort,mountport=yourMountPort,proto=tcp yourFfsServerName:/alfresco /mnt/alfresco/
NB: the proto
option may be either tcp or udp. In retrospect it appears desirable to have functionality to resolve the NFS server required by the volume requested. As it stands this doesn't happen, and the portmapper only searches for the NFS server on the version and protocol.
Alfresco NFS does not implement NFS locks.
That means that you should mount alfresco NFS using a no lock option.
On Linux this means using -o nolock, for instance:
mount -vvvvv -t nfs -o nolock localhost:/alfresco /mnt/
On (Open)Solaris this means using -o llock (local locking):
mount -F nfs -o llock 10.69.69.1:/alfresco /mnt/
It is possible to control access to all JLAN mounted filesystems [CIFS, FTP and NFS only] though global access controls. A filesystem access control defines the level of access that should apply to requests that fall within a certain scope. Access controls may be defined for multiple scopes, meaning that different user subsets can have different levels of access.
The filesystem access control configuration is a similar concept to the *nix command mount which may specify ro for read-only and rw for read-write access.
Filesystem access controls operate in addition to any repository level access control. So, for example, even if the ftp filesystem is configured to be read/write, the user may still be denied read or write access to a particular file by the repository.
The levels and scopes that may be defined for a filesystem access control are explained in the following subsections.
Access controls may be defined with the following scopes:
Filesystem access controls provide another level of access control above that provided by the alfresco repository. So for example you could configure that all ftp access is read only even though usually the configured user would have read/write access to the content.
This is an additional layer of security so for example if the repository is read only then nothing in the filesystem configuration will be able to over-ride that to read/write access. Or if a node cannot be read by the current user then nothing in the filesystem configuration will be able to grant read access.
The filesystem access controls are configured by composite properties which are added to either alfresco-global.properties or on Alfresco Enterprise via the JMX console.
Filesystem access controls can be defined using the following composite properties:
The example below defines Read level access for DOMAIN1 and Write level access for DOMAIN2.
filesystem.acl.global.domainAccessControls=DOMAIN1,DOMAIN2
filesystem.acl.global.domainAccessControls.value.DOMAIN1.accessType=Read
filesystem.acl.global.domainAccessControls.value.DOMAIN2.accessType=Write
The example below defines Read level access for NFS and Write level access for CIFS and FTP.
filesystem.acl.global.protocolAccessControls=nfs,others
filesystem.acl.global.protocolAccessControls.value.nfs.accessType=Read
filesystem.acl.global.protocolAccessControls.value.nfs.checkList=NFS
filesystem.acl.global.protocolAccessControls.value.others.accessType=Write
filesystem.acl.global.protocolAccessControls.value.others.checkList=CIFS,FTP
The example below defines Read level access for user1 and Write level access for user2.
filesystem.acl.global.userAccessControls=user1,user2
filesystem.acl.global.userAccessControls.value.user1.accessType=Read
filesystem.acl.global.userAccessControls.value.user2.accessType=Write
filesystem.acl.global.ipAddressAccessControls=ip1
filesystem.acl.global.ipAddressAccessControls.value.ip1.accessType=Read
filesystem.acl.global.ipAddressAccessControls.value.ip1.subnet=192.168.1.0
filesystem.acl.global.ipAddressAccessControls.value.ip1.netMask=255.255.255.0
Most common configuration of the file server subsystem can be done though adding properties to alfresco-global.properties however the filesystem is also configurable through spring for extension and customisation.
The fileystem server settings are configured via the file-servers-context.xml file in WEB-INF/classes/alfresco/subsystems/fileServers/default/file-servers-context.xml. Using the subsystem extension classpath mechanism, specific customisation of the default settings can be placed in a Spring bean file in /tomcat/shared/classes/alfresco/extension/subsystems/fileServers/default/default/custom-file-servers-context.xml (note that the default/default part of the path is intentional).
The default configuration creates a single filesystem for the spaces store. You can customize this filesystem configuration by overriding the filesystemContexts list bean, which declares the list of filesystems mounted by the file servers.
The repository filesystems (such as the default) are configured using the org.alfresco.filesys.repo.ContentContext class.
The class org.alfresco.filesys.repo.ContentContext declares a repository filesystem.
Repository filesystems require a storeName and rootPath. The default configuration creates an Alfresco filesystem using the name and root path of the spaces store.
The optional relativePath property can be specified to set the root of the filesystem at a particular folder. The relative path can be specified using forward or back slashes, and may contain multiple levels.
The repository filesystem supports the adding of two types of 'pseudo file' into the folders of the filesystem.
The disableNodeMonitor property is used to disable the monitoring of node service events for this filesystem. Node service monitoring is used to generate CIFS change notifications and update the file state cache when nodes are added, deleted, updated outside of the file server, this includes rule processing where files may be moved or new files generated.
You can set the shareMapper property of the fileSecurityConfig bean to an instance of one of the classes described below in order to control the dynamic generation of extra filesystems, in addition to any of those listed in filesystemContexts.
The org.alfresco.filesys.alfresco.HomeShareMapper class creates a dynamic repository filesystem that maps to the logged on users home space.
The homeShareName property specifies the name of the filesystem. The default home folder filesystem name is HOME.
Using SMB/CIFS this will be the name of the share. Using FTP this will be a folder in the root area.
Desktop actions allow a client-side application on the Alfresco CIFS server to trigger a server-side action. The action is run in the context of the folder the application is running in. Files and/or folders may be dragged onto the client-side application, these are then passed as parameters to the server-side action.
The desktop action applications are added to a folder using pseudo files. The same application executable appears as different files that are then mapped to different actions on the server.
In order to run a desktop action you must have connected to an Alfresco CIFS server, this creates an authenticated session to the server. The desktop action is called by passing the request over the CIFS session so it is executed as the connected user.
The clients-side application performs various pre-processing tasks for the action. The action indicates whether it accepts files and/or folders to be dragged onto the application. The files/folders may be in the same folder as the application, in a seperate folder on the Alfresco network drive or on a drive that is local to the client. The action indicates which combinations of files/folders are acceptable via a set of attributes.
If the action accepts files/folders that are on a drive local to the client then the files/folders will be copied to the Alfresco folder in order to be accessible to the server-side action. There is an option to only allow copying of files that match a working copy in the destination folder.
Files/folders are copied to the Alfresco folder using the Windows shell, larger transfers will display the standard progress dialog and file overwrites will display a dialog allowing the user to continue or cancel.
The client-side application can display a message to confirm if the action should be run or not.
Once the client-side pre-processing is completed any target files/folders that were dropped onto the application will now be on the Alfresco file server. A list of the files/folders is passed to the server-side action indicating if the file is a copy or already existed on the Alfresco server. Before calling the server-side action code the file/folder paths are converted to their NodeRef.
The server-side action runs in the context of the authenticated CIFS user. The action returns a status and optional message to the client.
The action response can return a URL for the client-side application to launch a web browser, or a commandline for the client-side application to run.
Desktop actions are configured on a per filesystem basis by overriding the filesystem definition in file-servers-context.xml. The default file-servers-context.xml file contains a commented out section with a sample desktop actions configuration.
The following configuration enables the sample desktop actions (Echo, URL, CmdLine, CheckInOut, Javascript):
<bean class='org.alfresco.filesys.repo.ContentContext'>
<property name='deviceName'>
<value>${filesystem.name}</value>
</property>
<property name='storeName'>
<value>${spaces.store}</value>
</property>
<property name='rootPath'>
<value>/${spaces.company_home.childname}</value>
</property>
<property name='URLFileName'>
<value>__Alfresco.url</value>
</property>
<property name='URLPrefix'>
<value>${cifs.urlfile.prefix}</value>
</property>
<property name='offlineFiles'>
<value>true</value>
</property>
<property name='globalDesktopActionConfig'>
<bean class='org.alfresco.filesys.config.GlobalDesktopActionConfigBean'>
<property name='path'>
<value>alfresco/desktop/Alfresco.exe</value>
</property>
<property name='webpath'>
<value>${cifs.urlfile.prefix}</value>
</property>
</bean>
</property>
<property name='desktopActionList'>
<list>
<bean class='org.alfresco.filesys.repo.desk.EchoDesktopAction'>
<property name='name'>
<value>Echo</value>
</property>
<property name='filename'>
<value>__AlfrescoEcho.exe</value>
</property>
</bean>
<bean class='org.alfresco.filesys.repo.desk.URLDesktopAction'>
<property name='name'>
<value>URL</value>
</property>
<property name='filename'>
<value>__AlfrescoURL.exe</value>
</property>
</bean>
<bean class='org.alfresco.filesys.repo.desk.CmdLineDesktopAction'>
<property name='name'>
<value>CmdLine</value>
</property>
<property name='filename'>
<value>__AlfrescoCmd.exe</value>
</property>
</bean>
<bean class='org.alfresco.filesys.repo.desk.CheckInOutDesktopAction'>
<property name='name'>
<value>CheckInOut</value>
</property>
<property name='filename'>
<value>__CheckInOut.exe</value>
</property>
</bean>
<bean class='org.alfresco.filesys.repo.desk.JavaScriptDesktopAction'>
<property name='name'>
<value>JavaScript</value>
</property>
<property name='filename'>
<value>__AlfrescoScript.exe</value>
</property>
<property name='scriptName'>
<value>alfresco/desktop/dumpRequest.js</value>
</property>
<property name='attributeList'>
<value>anyFiles, multiplePaths, allowNoParams</value>
</property>
<property name='preprocess'>
<value>confirm, copyToTarget</value>
</property>
</bean>
</list>
</property>
</bean>
The globalDesktopActionConfig property holds a org.alfresco.filesys.config.GlobalDesktopActionConfigBean containing settings and overrides that apply to all the defined actions. The path property specifies the location of the executable that is used by the action pseduo files. The file should be on the classpath. The default path value is alfresco/desktop/Alfresco.exe. The webpath property specifies the URL of the Alfresco web application. The ${localname} token in the web application URL is replaced with the local host DNS name or TCP/IP address. To switch off action confirmations the noConfirm propery can be set to switch off confirmations for all actions. This overrides the preprocess property of all org.alfresco.filesys.repo.desk.JavaScriptDesktopAction desktop actions as if confirm was removed from the preprocessing action list in their preprocess properties. See Writing A Javascript Desktop Action.
The desktopActionList property lists the individual desktop actions. These must be of a class that extends the org.alfresco.filesys.smb.server.repo.DesktopAction class. The available classes are demonstrated in the configuration above.
All action classes have name, filename and debug properties. The name property specifies the action name. The filename property specifies the name of the file that will appear in the folder listing. The debug property will enable debug output for the action.
A desktop action only requires the server-side code to be implemented, the same client-side application is used for all actions. The client-side application uses information from the server-side action to determine how to validate parameters, display confirmations, launch the web browser etc.
A desktop action must be derived from the org.alfresco.filesys.alfresco.DesktopAction abstract class.
The attributes property is a combination of bit flags that specify:
Any of the following values can be combined (with a bitwise OR operation '|').
Java Constant | Description |
---|---|
AttrTargetFolders | Accepts sub-folders from the same folder as the application |
AttrClientFiles | Accepts files from a client local drive. Files will be copied to the target folder on the Alfresco filesystem. |
AttrClientFolders | Accepts folders from a client local drive. Folders will be copied to the target folder on the Alfresco filesystem. |
AttrAlfrescoFiles | Accepts files from another folder on the same Alfresco filesystem |
AttrAlfrescoFolders | Accepts folders from another folder on the same Alfresco filesystem |
AttrMultiplePaths | Indicates that the action accepts all parameter paths in one call to the server-side action. If not set the action will be called multiple times with one path per call. |
AttrAllowNoParams | Indicates that file/folder parameters are optional. Used in combination with the AttrTarget/AttrClient/AttrAlfresco attributes. |
The following convenience values can be used to specify the file/folder types that the action accepts. They are combinations of the above flags.
Java Constant | Attribute Combination |
---|---|
AttrAnyFiles | AttrTargetFiles AttrClientFiles AttrAlfrescoFiles |
AttrAnyFolders | AttrTargetFolders AttrClientFolders AttrAlfrescoFolders |
AttrAnyFilesFolders | AttrAnyFiles AttrAnyFolders |
The preProcessActions property is a combination of bit flags that specify processing that the client-side application performs before calling the server-side action.
Any of the following values can be combined (with a bitwise OR operation '|').
Java Constant | Description |
---|---|
PreCopyToTarget | Copy files/folders from another Alfresco folder to the target folder |
PreConfirmAction | Display a dialog box allowing the user to abort the action. The confirmation message is supplied by the server-side action. |
PreLocalToWorkingCopy | Files copied from a local drive must have a matching file in the target folder that is a working copy. |
When the ServerConfigurationBean is initialized by the Spring container on startup, the initializeAction(AlfrescoDiskDriver, AlfrescoContext) method of each file context's actions is called. The default implementation completes initialization of an action by associating it with a driver and context and validating properties have valid values. If you need to do further initialization, such as setting action attributes and preprocessing actions, you can override this method to do so.
The main action method that must be implemented is the runAction(DesktopParams) method. The DesktopParams class contains the details of the parameters passed from the client-side application plus details of the target folder node and folder file.
The details of each file/folder parameter is contained within a DesktopTarget object. The DesktopParams class holds a list of DesktopTarget objects. If the AttrMultiplePaths attribute was not specified the parameter list will only contain one value.
Each DesktopTarget object contains the path to the file/folder, the NodeRef of the file/folder and a type value. the type value indicates if the file/folder was copied during the client-side pre-processing.
The runAction() method should return a DesktopResponse object, this contains the status and optional status message. The following status codes may be returned:
Status Code | Description |
---|---|
StsSuccess | Action completed normally. Optional message will cause an information dialog to be displayed on the client. |
StsError | Action error. Error message will be displayed in a dialog on the client. |
StsFileNotFound | File not found error. Optional message can give more details of the problem path. |
StsAccessDenied | Access denied. |
StsBadParameter | Bad parameter. |
StsNotWorkingCopy | File is not a working copy. |
StsNoSuchAction | Action not found. |
StsLaunchURL | Launch a web browser using the URL specified in the status message. |
StsCommandLine | Launch an application using the command line specified in the status message. |
If the PreConfirmAction pre-processing action has been enabled for the action then the String getConfirmationString() method should be used to provide the message displayed in the confirmation dialog. If no string is provided the default message of 'Run Action ?' is used. The dialog diaplayed has Ok and Cancel buttons.
If the desktop action returns the StsLaunchURL status the URL can be built using the DesktopParams.getWebPath() method to get the base URL of the Alfresco web application. To bypass the user having to login when the web browser is launched on the client an authentication ticket can be appended to the URL in the format ?ticket=<authticket>. The authentication ticket string for the user can be retrieved from the DesktopParams object using the getTicket() method.
The command line may contain environment variable tokens that are expanded by the client-side application. The tokens are in the format %<env-var-name>%, eg. %SystemRoot%\Notepad.exe would launch the Notepad application from the Windows system folder.
A special token of %AlfrescoDir% is expanded to the working directory that the client-side application is running from.
The following code is a very simple desktop action that echoes a message with the current date/time, the message is then displayed by the client-side application.
/**
* Echo Desktop Action Class
*
* Simple desktop action that echoes back a test message with the current date/time.
*
* @author gkspencer
*/
public class EchoDesktopAction extends DesktopAction {
/**
* Class constructor
*
* Action does not take any parameters (attributes = 0) and requires confirmation
* before running.
*/
public EchoDesktopAction()
{
super( 0, PreConfirmAction);
}
/**
* Return the confirmation string displayed by the client
*
* @return String
*/
public String getConfirmationString() {
return 'Run echo action';
}
/**
* Run the action, return a message to be displayed by the client application
*
* @param params DesktopParams
* @return DesktopResponse
*/
public DesktopResponse runAction(DesktopParams params) {
// Return a text message
return new DesktopResponse(StsSuccess, 'Test message from echo action at ' new Date());
}
}
The JavaScriptDesktopActionallows a desktop action to be scripted without needing to compile, and install, a Java class. The JavaScript desktop actions have the same capabilities as the Java based actions.
For a JavaScript desktop action the attributes and pre-processing flags are specified as strings via special properties, along with the path to the script file. The script file must exist on the classpath, this should be a normal file on the local filesystem as the JavaScript desktop action will open the script file as a file stream, i.e. the script cannot be stored in a Jar file. The JavaScript action will also check if the script file has been updated and automatically reload the updated script.
To configure a JavaScript desktop action the following bean is added to the list of beans configured for as the desktopActionList property of a filesystem context.
<bean class='org.alfresco.filesys.repo.desk.JavaScriptDesktopAction'>
<property name='name'>
<value>JavaScript</value>
</property>
<property name='filename'>
<value>__AlfrescoScript.exe</value>
</property>
<property name='scriptName'>
<value>alfresco/desktop/dumpRequest.js</value>
</property>
<property name='attributeList'>
<value>anyFiles, multiplePaths, allowNoParams</value>
</property>
<property name='preprocess'>
<value>confirm, copyToTarget</value>
</property>
</bean>
In this example the script file, dumpRequest.js, will be located in the WEB-INF/classes/alfresco/desktop folder.
The attributeList property may contain a combination of the following flags, as a comma separated list:
Flag | Description |
---|---|
targetFiles | Accepts files from the same folder as the application |
targetFolders | Accepts sub-folders from the same folder as the application |
clientFiles | Accepts files from a client local drive. Files will be copied to the target folder on the Alfresco filesystem. |
clientFolders | Accepts folders from a client local drive. Folders will be copied to the target folder on the Alfresco filesystem. |
alfrescoFiles | Accepts files from another folder on the same Alfresco filesystem |
alfrescoFolders | Accepts folders from another folder on the same Alfresco filesystem |
multiplePaths | Indicates that the action accepts all parameter paths in one call to the server-side action. If not set the action will be called multiple times with one path per call. |
allowNoParams | Indicates that file/folder parameters are optional. Used in combination with the target/client/alfresco attributes. |
anyFiles | targetFiles clientFiles alfrescoFiles |
anyFolders | targetFolders clientFolders alfrescoFolders |
anyFilesFolders | anyFiles anyFolders |
The preprocess propery may contain a combination of the following flags, as a comma separated list:
Flag | Description |
---|---|
copyToTarget | Copy files/folders from another Alfresco folder to the target folder |
confirmAction | Display a dialog box allowing the user to abort the action. The confirmation message is supplied by the server-side action. |
localToWorkingCopy | Files copied from a local drive must have a matching file in the target folder that is a working copy. |
The script is called by the JavaScriptDesktopAction with the target parameters from the client available as script objects. The following objects are available:
JavaScript Object | Description |
---|---|
deskParams | The desktop action parameters |
webURL | URL of the Alfresco web application, in the format http://serverort/webapp/ |
actions | Allows access to the public services |
logger | Script debug logging |
The deskParams object contains the details of the folder the action is running from and the target files/folders for the action. The target list may be empty if the action has the allowNoParams attribute. The list will only contain a single target if the multiplePaths attribute is not set, although the client-side application will accept multiple paths it will call the action with a single target at a time.
The following methods are available on the deskParams object:
Method | Description |
---|---|
getFolderNode() | Returns the NodeRef of the folder the action is running from |
getFolder() | Returns the NetworkFile of the folder. Use getFullName() to return the share relative path of the folder. |
numberOfTargetNodes() | Return the count of desktop targets for this request |
getTarget(int) | Return the specified desktop target object |
getTicket() | Return the authentication ticket string that can be used in URLs by appending ?ticket=<authticket> |
The desktop target object returned by the deskParams.getTarget(n) method has the following methods:
Method | Description |
---|---|
getType() | Returns the target type |
getTypeAsString() | Returns the target type as a string. The value is 'File', 'Folder', 'File Copy', 'Folder Copy' or 'NodeRef' |
getTarget() | Returns the share relative path to the target file/folder |
getNode() | Return the NodeRef of the target file/folder |
The script may return a status string if an error occurs or one of the special status codes is being used, such as to pass a URL to the client or a commandline. A null return indicates that the script was successful.
The following status strings are available. They are encoded in the format <status-code>,<message text>.
Status String | Description |
---|---|
0,message | Success status with an informational message for the client to display |
1,error | General error status |
2,message | File not found status |
3,message | Access denied status |
4,message | Bad parameter status |
5,message | Not a working copy status |
6,message | No such action status |
7,URL | Launch a URL on the client via the Windows shell |
8,cmdline | Launch an application on the client using the specified command line |
In version 3.0 of the Alfresco JLAN Server code the CIFS server component was changed to use a thread pool and memory pool along with NIO socket based code. A new coreServerConfigBean propery has been added to the fileServerConfiguration bean to allow the thread pool and memory pool to be tuned. This optional property holds an instance of type org.alfresco.filesys.config.CoreServerConfigBean whose properties are described below.
The thread pool settings allow the initial and maximum number of threads to be specified, via the threadPoolInit and threadPoolMax properties. The default thread pool size is 25 initial threads with a maximum of 50 threads. This setting should be sufficient to handle up to 500 concurrent connections, depending on how active the connections are. The maximum number of threads that can be configured to the thread pool is 250 threads.
There is also thread pool debugging output available via the threadPoolDebug property.
The memoryPacketSizes property allows control over the size, initial allocation and maximum allocation of the packets in the memory pool. It contains a list of org.alfresco.filesys.config.MemoryPacketConfigBean beans, each of which posses the following properties
Unless you fully understand the implications of changing the memory pool parameters it is advised to use the default settings. Incorrect setup of the memory pool will impact the performance of the CIFS server and can cause errors.
<bean id='fileServerConfiguration' class='org.alfresco.filesys.config.ServerConfigurationBean' parent='fileServerConfigurationBase'>
<property name='cifsConfigBean'>
<ref bean='cifsServerConfig' />
</property>
<property name='ftpConfigBean'>
<ref bean='ftpServerConfig' />
</property>
<property name='nfsConfigBean'>
<ref bean='nfsServerConfig' />
</property>
<property name='filesystemContexts'>
<ref bean='filesystemContexts' />
</property>
<property name='securityConfigBean'>
<ref bean='fileSecurityConfig' />
</property>
<property name='coreServerConfigBean'>
<bean class='org.alfresco.filesys.config.CoreServerConfigBean'>
<property name='threadPoolInit'>
<value>25</value>
</property>
<property name='threadPoolMax'>
<value>50</value>
</property>
<property name='threadPoolDebug'>
<value>false</value>
</property>
<property name='memoryPacketSizes'>
<list>
<bean class='org.alfresco.filesys.config.MemoryPacketConfigBean'>
<property name='size'>
<value>256</value>
</property>
<property name='init'>
<value>20</value>
</property>
<property name='max'>
<value>100</value>
</property>
</bean>
<bean class='org.alfresco.filesys.config.MemoryPacketConfigBean'>
<property name='size'>
<value>4000</value>
</property>
<property name='init'>
<value>20</value>
</property>
<property name='max'>
<value>50</value>
</property>
</bean>
<bean class='org.alfresco.filesys.config.MemoryPacketConfigBean'>
<property name='size'>
<value>16000</value>
</property>
<property name='init'>
<value>5</value>
</property>
<property name='max'>
<value>50</value>
</property>
</bean>
<bean class='org.alfresco.filesys.config.MemoryPacketConfigBean'>
<property name='size'>
<value>64000</value>
</property>
<property name='init'>
<value>5</value>
</property>
<property name='max'>
<value>50</value>
</property>
</bean>
</list>
</property>
</bean>
</property>
</bean>
Sometimes, when connecting to an Alfresco share, the login dialog appears several times until finally taking effect. This problem can be caused by the client connecting to the Windows file server that is running on native SMB/port 445 rather than trying to connect via NetBIOS.
Native SMB can be disabled by adding the following registry key:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters]
'SMBDeviceEnabled'=dword:00000000
A reboot is required after creating this key. Setting the value to one or deleting the registry key will restore native SMB support.
In Windows 2000,2003,2008 - Port 445 is bound by default to \device\ - all devices.
Use the following registry key to unbind port 445 and allow for binding by Alfresco:
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NetBT\Parameters]
WARNING: Changing this setting may leave you unable to login to your server using Remote Desktop.
1. In the right-hand side of the window find an option called 'TransportBindName'.
2. Double click that value, and then delete the default value, thus giving it a blank value.
3. Close the registry editor.
4. Reboot your computer.
After rebooting open a command prompt and in it type 'netstat -an'
See that it no longer listens to port 445.
The SMBDeviceEnabled registry key does not seem to be recognized on Vista and Windows 2008. In order to stop native SMB being used when the Alfresco CIFS server is being run under Vista or Windows 2008 the firewall rules can be updated to block inbound connections on port 445.
To setup the Windows firewall on the system running the Alfresco CIFS server:
In some cases you may need to disable smb 2.0 on windows 2008
When you use the java socket code on windows 2003 and have two network interfaces, you can tell windows to stop running the netbios servers (netstat -nao shows:
TCP 160.55.51.228:139 0.0.0.0:0 LISTENING 4
UDP 160.55.51.228:137 *:* 4
UDP 160.55.51.228:138 *:* 4
using the method described at:
http://www.petri.co.il/disable_netbios_in_w2k_xp_2003.htm
ie.e:
change is immediate and you do not need to reboot the windows server.
Try installing http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID...
Alfresco supports NTLMv2 when it is acting as the authoritative authentication provider. However, the NTLMv2 protocol does not allow Alfresco to pass authentication credentials through to Active Directory. When synchronizing with Active Directory, Alfresco does not import passwords because they are encrypted. Since Alfresco does not contain the Active Directory authentication credentials, it cannot implement NTLMv2 which protects against such man-in-the-middle scenarios. Alfresco recommends using Kerberos for situations where you might consider NTLMv2.
Additional information is on Alfresco_Authentication_Subsystems#Configuring_against_Active_Directory
An alternative is to authenticate using NTLMv1 and passthrough. See
http://technet.microsoft.com/en-us/library/cc960646.aspx
on how to setup the client to use NTLMv1
NOTE: Alfresco Enterprise 3.2+ is NOT supported on Java 1.5, but we provide this information for Community users who are running Alfresco on Java 1.5 and want to connect to CIFS using Kerberos from Windows 7 or 2008 client.
As per https://issues.alfresco.com/jira/browse/ETHREEOH-3225?focusedCommentId=53568&page=com.atlassian.jira... ,
Java 1.5 does not support RC4-HMAC encryption. To overcome this, while setting up the Alfresco Kerberos account you need to select 'Use Kerberos DES encryption types for this account' to allow DES to be used for Kerberos encryption.
This configuration though won't work by default on Windows 7 and 2008 ( see http://support.microsoft.com/kb/977321 ) because the DES encryption is disabled by default. In order to have this working you'll need to enable the DES encryption by setting the following group policies (or local registry settings):
OR
Back to Server Configuration