N00b boyfriend
Tuesday, January 12th, 2010My friend, einar, found this hilarious video on youtube (unfortunately embedded video has been disabled by those that published it): N00b boyfriend
My friend, einar, found this hilarious video on youtube (unfortunately embedded video has been disabled by those that published it): N00b boyfriend
and again… and numerous times more.
In the Norwegian newspaper, Aftenposten, one can read about Malin who were told that her name had been used for selling viagra, cars etc. through emails (also known as spam). “This is the easiest form of id theft” states Christian Meyer, senior advisor at NORSIS and suggest there may be a need for a national ID center for dealing with issues related to identity.
I have experienced that not only my name, but my domain (klungvik.com) has been used for spam and there’s not a damn thing I can do about it. It’s the hazard I take by (just existing as a human being and) having an online presence with full credentials. I even once experienced that an obscure US law firm sent me a warning and letting me know that I was banned from their services. A warning I easily ignored since I don’t think I ever will use them, and because they revealed their technical ignorance just by sending me a warning.
Sending spam is easy if one looks at how it’s done technically. Forging email identity is really easy and I don’t think there’s much a national ID center can do about it. What makes spam and online forging of ID even more difficult is that it usually spans country borders – it’s an international problem.
It’s far worse if one’s identity have been used for making loans, purchasing goods etc. My current house loan I managed to get without ever showing up at the bank. All they wanted was a copy of my passport and a signature, and it was all done through the phone and postal system. They never saw me in person. A copy of my passport, and anybody can take up a loan on my behalf.
Stealing credit card details are also easy if one person have tried to purchase goods at the wrong website (and how anybody dare buying goods from spam is beyond my understanding). But all it requires is to cancel ones credit card and order a new one.
A national center for dealing with these kinds of issues can be a good idea and not only for electronic reasons. A national center can be used for dealing with issues related to immigrants that gives wrong name or deny telling their identity at our borders.
But couldn’t online id theft be managed by The Data Inspectorate (datatilsynet), and immigrants managed by The Ministry of Foreign Affairs (UD)? They certainly have the knowledge and resources needed. May be what we need isn’t a new national center (which we have for every thinkable issue anyway), but expanding the area of responsibility of existing agencies. Or may be NORSIS wants to do this themselves?
Requirements:
Likewise-open is installed and working.
Likewise-open plug in to pam to authenticate Windows AD users on a linux box. pam-mount will mount shared drives at login time using the login credentials. There is no need for samba to do this, and no need to write down your username and password in a file.
<!-- Volume definitions -->
<!-- <volume fstype="cifs" server="server ip adress" user="*" path="to_shared_folder" mountpoint="shared_folder_name" /> -->
<volume fstype="cifs" server="192.168.140.00" user="*" path="felles" mountpoint="/media/server_felles" /> sudo gedit /etc/pam.d/gdm@include common-pammount
Reboot and log in again. The shared drive should be available.
Resources:
wiki.ubuntu.com
When installing Alfresco on an Ubuntu machine, CIFS doesn’t work out of the box.
First question: is Samba installed?
sudo apt-get install samba smbfs
The configuration files for file-server setups:
$ALFRESCO_HOME/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/file-servers.xml
$ALFRESCO_HOME/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/file-servers.properties
Uncomment these lines in file-servers.xml (though to make sure this is permanent – create file-servers-custom.xml):
<tcpipSMB port="1445" ipv6="${cifs.ipv6}" platforms="linux,solaris,macosx"/>
<netBIOSSMB sessionPort="1139" namePort="1137" datagramPort="1138" platforms="linux,solaris,macosx"/>
Set iptable rules:
sudo su
echo 1 > /proc/sys/net/ipv4/ip_forward
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 REDIRECT --to-ports 1445
iptables -t nat -A PREROUTING -p tcp --dport 139 -j REDIRECT --to-ports 1139
iptables -t nat -A PREROUTING -p udp --dport 137 -j REDIRECT --to-ports 1137
iptables -t nat -A PREROUTING -p udp --dport 138 -j REDIRECT --to-ports 1138
Check iptable rules:
sudo iptables -t nat -L
Troubleshooting options:
To check what ports are listened to:
netstat -a
Look for:
tcp6 0 0 [::]:1445 [::]:* LISTEN
tcp6 0 0 [::]:1139 [::]:* LISTEN
To see who listens at what port:
$ sudo lsof -i :1139 -n
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
java 11881 alfresco 296u IPv6 60400 TCP *:1139 (LISTEN)
Another way to check if the port is listened to:
$ telnet localhost 1139
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Resources:
http://wiki.alfresco.com/wiki/File_Server_Configuration
CIFS Linux
http://wiki.alfresco.com/wiki/Troubleshooting
CIFS Troubleshooting
In this post I will set up the basic settings to create an Alfresco Module Package (AMP). Ant needs to be installed to make this work. This creates a skeleton AMP module that does nothing except being a module. So the first step is to create a new project in your favorite IDE.
In the Alfresco SDK there are some great examples, and one of them is named SDK Basic AMP. AMP’s have a specific directory structure that it’s wise to use. When deploying AMP’s the Module Management Tool (mmt) maps the files to specific locations in the alfresco tree. This can be a bit confusing when dealing with configuration files and if the SDK samples have solved a problem in a specific way, it’s wise to just follow that road.
1. Create a module.properties file containing these lines:
# Skeleton AMP Module
module.id=skeleton
module.title=Skeleton
module.description=Add a skeleton amp to Alfresco
module.version=1.0
This file contain module information and is to be located in the root of the amp. Usually the file is located in the IDE at config/alfresco/module/modulename/module.properties. (IDE) config/alfresco maps to alfresco_dir/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/.
2. Create a config/alfresco/module/skeleton/module.context file:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
</beans>
This is where one puts bean initializations, bootstrap resource bundles, adds webclient configuration files etc. when needed.
3. Place class files (if you have any) in source/java/my/namespace/*.java
4. Sample build.xml for ant:
<?xml version="1.0"?>
<project name="Skeleton" default="deploy-war" basedir=".">
<!-- Project directories, REPLACE WITH YOUR SETTINGS -->
<property name="project.dir" value="."/>
<property name="build.dir" value="${project.dir}/build"/>
<property name="jar.file" value="${build.dir}/lib/skeleton.jar" />
<property name="amp.file" value="${build.dir}/dist/skeleton.amp"/>
<property name="tomcat.dir" value="/opt/Alfresco/tomcat" />
<property name="war.file" value="${tomcat.dir}/webapps/alfresco.war"/>
<property name="lib.dir" value="/opt/alfresco-sdk2.9/lib/server" />
<!-- Path to essential libraries -->
<path id="class.path">
<dirset dir="${build.dir}" />
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<!-- Creates a build directory where the amp and jar files will be located -->
<target name="mkdirs">
<mkdir dir="${build.dir}/dist" />
<mkdir dir="${build.dir}/lib" />
</target>
<target name="package-jar" depends="compile">
<delete file="${jar.file}" />
<jar destfile="${jar.file}">
<fileset dir="${build.dir}" includes="**/faces-config.xml, **/*.class" />
</jar>
</target>
<target name="package-amp" depends="mkdirs, package-jar" description="Packages the amp">
<zip destfile="${amp.file}">
<fileset dir="${project.dir}/build" includes="lib/*.jar" />
<fileset dir="${project.dir}" includes="module.properties" />
<fileset dir="${project.dir}" includes="config/**/*.*" />
</zip>
</target>
<!-- Use when checking what deployment of an AMP will do without actually committing the deployment -->
<target name="preview-install">
<echo>Preview installation of AMP</echo>
<java dir="." fork="true" classname="org.alfresco.repo.module.tool.ModuleManagementTool">
<classpath refid="class.path" />
<arg line="install ${amp.file} ${war.file} -preview -force -verbose"/>
</java>
</target>
<!-- Deploys the war to Alfresco -->
<target name="deploy-war" depends="package-amp">
<java dir="." fork="true" classname="org.alfresco.repo.module.tool.ModuleManagementTool">
<classpath refid="class.path" />
<arg line="install ${amp.file} ${war.file} -force -verbose"/>
</java>
</target>
</project>
An AMP file is a zipped archive, so if you would like to know the content of the amp then:
unzip skeleton.amp
To view the content of a jar file:
jar -tvf skeleton.jar
SDK Basic AMP example – This is the basic AMP taken from the SDK.
Resources:
Alfresco Module Packages
Alfresco SDK
http://wiki.alfresco.com/wiki/Module_Management_Tool
Requiem is an application that works on all platforms and it removes the DRM on (purchased) videos and music in ITunes. The application can be downloaded from this torrent. This is of course something Apple is not happy about, so therefore each version of ITunes works on a specific Requiem version. Thankfully the developer of Requiem updates the application to match changes made by Apple.
Now, the torrent link will soon be outdated as new versions of ITunes and Requiem is released, so therefore I also supply the search that will find the latest release of Requiem. Enjoy!
The last couple of weeks I have learned some lessons the hard way.
1. When doing changes to faces-config(-custom).xml, put it in a jar-file.
This is stated in Developing an Alfresco Module, but it’s very easy to forget because so many places one can read about extending Alfresco using faces-config-custom.xml.
There are two options for making changes to faces-config:
- Add a faces-config-custom.xml in the AMP.
In an IDE it would typically ble places in web/WEB-INF/faces-config-custom.xml. When deploying the amp to Alfresco, it doesn’t overwrite the WEB-INF/faces-config-custom.xml on the server as one would expect, it’s as if the changes were never made. In reality Alfresco does some magic, and the changes are available in alfresco, but not in any extensions you have made. So if you try to create a managed bean and access it from within alfresco jsp-files, life is good. But in most cases, extending Alfresco is the best way to go and then the managed bean is suddenly not available. Therefore the next choice is the best way.
- Add faces-config.xml to the jar-file.
Yes, no need for a faces-config-custom.xml here, and the declarations are available all over alfresco, including any third-party extensions. Inside the jar the file is located at META-INF/faces-config.xml.
Alfresco is simply a bit touchy when dealing with faces-config files.
2. Use (unique) IDs on faces components no matter what
I came up in the situation that I had one jsp that only contained two lines:
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<r:webScript scriptUrl="/service/mwsearch" />
With just two lines to maintain, one would think it would be difficult to make mistakes… Wrong! It doesn’t matter that even the taglib documentation state that id isn’t required, because it’s simply not true. ID’s are required unless you want erratic behaviour – IllegalStateExceptions (like seen below) that occurs at random, but will definitly stop the show:
javax.faces.FacesException: java.lang.IllegalStateException: Client-id : _idJsp13 is duplicated in the faces tree. Component : browse:_idJsp13, path: {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/browse/browse.jsp][Class: javax.faces.component.html.HtmlForm,Id: browse][Class: org.alfresco.web.ui.common.component.UIPanel,Id: spaces-panel][Class: org.alfresco.web.ui.common.component.data.UIRichList,Id: spacesList][Class: org.alfresco.web.ui.common.component.data.UIColumn,Id: col1][Class: org.alfresco.web.ui.common.component.UIActionLink,Id: col1-act1][Class: javax.faces.component.UIParameter,Id: _idJsp13]}
3. Any files in the AMP will override files in the Data Dictionary
I had a webscript where I needed to make an url configurable. Now, configurations can be added in a modulename.get.config.xml as stated in the documentation. I removed the file from my AMP, and added the file in Alfresco DM –> Company Home –> Data Dictionary –> Web Scripts Extentions –> Modulefolder –> modulename.get.config.xml. And voila, my Freemarker templates caught on the config changes after a restart of Alfresco.
Hopefully this will have saved at least one person from hours of frustration.