28 June 2012

X11 session login with SLiM and no password

Basically task is to allow my mum login to home Linux-box and not to bother her with a password (or I would have to install Windoze again). At same time I want to still have access to same box with my own passworded account and to be able to login (with SLiM) to a X11 session.

I'm not going to dig into security considerations regarding passwordless users here.

So firstly let's create a user for my mum and deprive it a password:
# useradd -m -U username
# passwd -d username

Explanation:
-m force home directory creation
-U automatically creates a group with same name as username and assigns it as primary group for new user
passwd -d removes password from given account

Now you should be able to login with new user into physical terminal session. Though this depends on PAM configuration in your distro (I'm using ArchLinux). You won't be able to su to this user or login into SLiM yet.
To allow SLiM login you with empty password you need to edit /etc/pam.d/slim:
find
auth    required    pam_unix.so
and change to
auth    required    pam_unix.so nullok

That's it. Same instructions should apply to any login manager, not only SLiM.

12 June 2012

Debugging SSL traffic with socat

Often when developing a client for a remote service using HTTPS (or any SSL-tunneled protocol) it difficult to dig into the data being transferred over the network. That is the case for me and here is another cheat sheet for me:

# socat -v TCP-LISTEN:443,reuseaddr,debug,fork OPENSSL:remote.host.com:443,verify=0

This sets up a SSL tunnel, accepting non-encrypted traffic from one side, encrypting it and passing to remote host.
Then you should use localhost:443 as a connection endpoint from your piece of software and watch all the traffic being sent :)
For detail on socat option take a look at documentation.

07 June 2012

DSRA0080E Data Store Adapter exception on IBM WebSphere EJB client

More like a hint for myself :)


Exception like this:

...
Caused by: com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException: DSRA0080E: An exception was received by the Data Store Adapter. See original exception message: com/ibm/websphere/rsadapter/DataStoreHelper.doConnectionSetupPerGetConnection(Ljava/sql/Connection;ZLjava/lang/Object;)Z.
  at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.getConnection(WSRdbManagedConnectionImpl.java:3503)
  at com.ibm.ws.rsadapter.spi.WSDefaultConnectionManagerImpl.allocateConnection(WSDefaultConnectionManagerImpl.java:91)
  at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:646)
  ... 22 more
Caused by: java.lang.AbstractMethodError: com/ibm/websphere/rsadapter/DataStoreHelper.doConnectionSetupPerGetConnection(Ljava/sql/Connection;ZLjava/lang/Object;)Z
  at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.getConnection(WSRdbManagedConnectionImpl.java:3482)
  ... 24 more

may be caused by running EJB client application with different (e.g. non-IBM) Java VM.

24 April 2012

Screensharing in Linux with GoToMeeting

Screensharing appears to be a weak part of Linux desktop. Among solutions that do work I have successful experience with TeamViewer and Mikogo. Both of them are not perfect, but they run more or less natively on Linux.
These two were no the case for the event I needed to share my screen for :). Ideally I needed GoToMeeting and made it to share my screen! This instructions should work with most (if not any) of available screensharing solution for Windows.

Prerequisites:

In parenthesis I referred to software I was using.
  1. Windows running on either virtual machine (even non-virtual would work if you have spare one) (Windows XP on VirtualBox)
  2. VNC server running on your Linux desktop (x11vnc)
  3. VNC client on your Windows PC (TightVNC)

Basic idea:

You should have guessed what I'm going to do next :) I explain if not. You share the screen of you Windows PC with screensharing tool of your choice. But what the screen will display is fullscreen VNC client connected to your Linux desktop. I suppose there might be some video issues with the way how VNC client draws the picture and the way screensharing tool captures the screen, that's why I mentioned what software I was using.

Setup:

For sharing my desktop on Linux I ran x11vnc like that:
$ x11vnc -display :0 -auth ~/.Xauthority -forever -nap -noxdamage

Then I had to start another XServer instance to avoid effect of 'endless refraction' (e.g. VNC client shows your desktop running virtual machine with Windows with VNC client showing you desktop...) using:
$ startx -- :1

On the second XServer I ran VirtualBox, started my virtual Windows PC, ran TightVNC and connected to my host Linux box. (At this stage you VNC may not work smoothly, looks like XServer detects that it's not active at the moment and does not update the screen when you try to move windows from within VNC client.) Now start you screen sharing session and once it's started enter fullscreen mode in your VNC client. Now you could minimize you virtual PC window and switch to first XServer (Ctrl+Alt+F7 in my case, your may differ).
That's it and you may lead your presentation :)

Variations:

  • On dual-screen setup you could share only one screen with
    $ x11vnc -display :0 -auth ~/.Xauthority -forever -nap -noxdamage -clip 1680x1050+0+0
    and thus you may try to avoid switching between different XServer by running VirtualBox instance on second screen.
  • Gnome users may use vino instead of x11vnc, though I haven't tried this.

02 April 2012

Meaningful error message from IBM WebSphere

Seeing this on your WebSphere application server startup?
00000000 ContainerHelp E   WSVR0501E: Error creating component com.ibm.ws.cluster.runtime.ProcessRuntimeImpl
java.lang.NoClassDefFoundError: com.ibm.websphere.cluster.topography.DescriptionManagerFactory (initialization failure)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:140)
        at com.ibm.ws.cluster.runtime.ProcessRuntimeImpl.initialize(ProcessRuntimeImpl.java:366)
        at com.ibm.ws.runtime.component.ContainerHelper.initWsComponent(ContainerHelper.java:1166)
        at com.ibm.ws.runtime.component.ContainerHelper.initializeComponent(ContainerHelper.java:1073)
        at com.ibm.ws.runtime.component.ContainerHelper.initializeComponents(ContainerHelper.java:874)
        at com.ibm.ws.runtime.component.ContainerImpl.initializeComponents(ContainerImpl.java:780)
        at com.ibm.ws.runtime.component.ContainerImpl.initializeComponents(ContainerImpl.java:754)
        at com.ibm.ws.runtime.component.ServerImpl.initialize(ServerImpl.java:350)
        at com.ibm.ws.runtime.WsServerImpl.bootServerContainer(WsServerImpl.java:280)
        at com.ibm.ws.runtime.WsServerImpl.start(WsServerImpl.java:214)
        at com.ibm.ws.runtime.WsServerImpl.main(WsServerImpl.java:666)
        at com.ibm.ws.runtime.WsServer.main(WsServer.java:59)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:599)
        at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:213)
        at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:93)
        at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:74)
        at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:599)
        at org.eclipse.core.launcher.Main.invokeFramework(Main.java:340)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
        at org.eclipse.core.launcher.Main.run(Main.java:981)
        at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:330)
        at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:108)
Caused by: java.lang.IllegalStateException: java.lang.NullPointerException
        at com.ibm.ws.util.ImplFactory.loadImplFromClass(ImplFactory.java:354)
        at com.ibm.ws.util.ImplFactory.loadImplFromKey(ImplFactory.java:328)
        at com.ibm.ws.util.ImplFactory.loadImplFromKey(ImplFactory.java:332)
        at com.ibm.ws.wlm.Factory$4.run(Factory.java:141)
        at java.security.AccessController.doPrivileged(AccessController.java:251)
        at com.ibm.ws.wlm.Factory.loadImpl(Factory.java:139)
        at com.ibm.websphere.cluster.topography.DescriptionManagerFactory.(DescriptionManagerFactory.java:50)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
        at com.ibm.ws.cluster.service.ClusterManagementImpl.(ClusterManagementImpl.java:119)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:45)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:515)
        at com.ibm.wsspi.cluster.ClusterManagementFactory.(ClusterManagementFactory.java:62)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
        at com.ibm.ws.cluster.runtime.WLMDiagnosticModule.ffdcDumpDefaultClusterManagement(WLMDiagnosticModule.java:422)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:599)
        at com.ibm.ws.ffdc.DiagnosticModule.getDataForDirective(DiagnosticModule.java:305)
        at com.ibm.ws.ffdc.DiagnosticModule.getDataForDirectives(DiagnosticModule.java:279)
        at com.ibm.ws.ffdc.DiagnosticModule.dumpComponentData(DiagnosticModule.java:144)
        at com.ibm.ws.ffdc.impl.DMAdapter.processDM(DMAdapter.java:123)
        at com.ibm.ws.ffdc.impl.DMAdapter.formatTo(DMAdapter.java:114)
        at com.ibm.ffdc.util.provider.IncidentLogger.writeIncidentTo(IncidentLogger.java:63)
        at com.ibm.ws.ffdc.impl.FfdcProvider.logIncident(FfdcProvider.java:135)
        at com.ibm.ws.ffdc.impl.FfdcProvider.logIncident(FfdcProvider.java:92)
        at com.ibm.ffdc.util.provider.FfdcProvider.log(FfdcProvider.java:232)
        at com.ibm.ws.ffdc.impl.FfdcProvider.log(FfdcProvider.java:100)
        at com.ibm.ffdc.util.provider.IncidentEntry.log(IncidentEntry.java:96)
        at com.ibm.ffdc.util.provider.Ffdc.log(Ffdc.java:90)
        at com.ibm.ws.ffdc.FFDCFilter.processException(FFDCFilter.java:114)
        at com.ibm.ws.cluster.ProcessProperties.(ProcessProperties.java:281)
        at com.ibm.ws.cluster.ProcessProperties.(ProcessProperties.java:234)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
        at com.ibm.ws.cluster.runtime.ProcessRuntimeImpl.initialize(ProcessRuntimeImpl.java:307)
        ... 31 more
Caused by: java.lang.NullPointerException
        at com.ibm.ws.cluster.WLMCustomPropertyUtility.getBBCallbacksEnableWLMThreads(WLMCustomPropertyUtility.java:384)
        at com.ibm.ws.cluster.propagation.bulletinboard.BBDescriptionManager.(BBDescriptionManager.java:165)
        at java.lang.J9VMInternals.newInstanceImpl(Native Method)
        at java.lang.Class.newInstance(Class.java:1325)
        at com.ibm.ws.util.ImplFactory.loadImplFromClass(ImplFactory.java:349)
        ... 70 more

This should probably mean that your PC's hostname couldn't be resolved.