Thursday, April 20, 2017

Downloading file from secured s3 over https


The following shell script can be used to download a file from secured Amazon s3 bucket over https.


#!/bin/sh
file=path/to/file/in/the/bucket
bucket=bucket-name
s3Key=XXXXXXXXXXXXXXXXXX
s3Secret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
###
resource="/${bucket}/${file}"
dateValue="`date +'%a, %d %b %Y %H:%M:%S %z'`"
stringToSign="GET\n\n\n\nx-amz-date:${dateValue}\n${resource}"
signature=`/bin/echo -en "$stringToSign" | openssl sha1 -hmac ${s3Secret} -binary | base64`
wget --header="Host: ${bucket}.s3.amazonaws.com" \
--header="x-amz-date: ${dateValue}" \
--header="Authorization: AWS ${s3Key}:${signature}" \
https://${bucket}.s3.amazonaws.com/${file}



Resources:

Wednesday, March 1, 2017

Decoding WebSphere's {xor} passwords


The following bash/sh commands can be used to decode WebSphere's {xor} passwords. Execute the commands on a host with WebSphere installed:

export WAS_HOME=/opt/ibm/bpm/85/AppServer_x64
export MYCLASSPATH=$WAS_HOME/plugins/com.ibm.ws.runtime.jar:$WAS_HOME/lib/bootstrap.jar:$WAS_HOME/plugins/com.ibm.ws.emf.jar:$WAS_HOME/lib/ffdc.jar:$WAS_HOME/plugins/org.eclipse.emf.ecore.jar:$WAS_HOME/plugins/org.eclipse.emf.common.jar
$WAS_HOME/java/bin/java -cp $MYCLASSPATH com.ibm.ws.security.util.PasswordDecoder {xor}NzozMzA=

Saturday, February 18, 2017

Docker cleanup commands


#delete ALL containers (your in-container data like instances will be lost)
docker rm $(docker ps -a -q)

#delete all 'untagged/dangling' () images
docker rmi $(docker images -q -f dangling=true)

#1.13+
#remove all stopped containers
docker container prune

#remove unused data (shrink Docker.qcow2)
docker system prune.

Wednesday, October 19, 2016

Polyglot Programming


Java and JavaScript as modern days' low lever "Assembler" languages. Interesting talk on the Polyglot Programming concept:
http://radar.oreilly.com/2013/11/polyglot-programming-what-is-it-and-why-should-you-be-using-it.html

Tuesday, March 31, 2015

Web Services Logging IBM BPM 8.0.1.3+

With use-jaxws=true the following logging should cover WS connector configuration, inbound/outbound request and response as well as serialization.

*=info: WLE.wle_outbnd_ws=all: WLE.wle_inbnd_ws=all: com.ibm.bpm.ws.jaxws.*=all

Tuesday, September 18, 2012

IBM BPM: Listing iFixes installed


From the following article
http://www-01.ibm.com/support/docview.wss?uid=swg21294769



For specific WAS_HOME the following method can be used:

/opt/IBM/BPM80/AppServer/bin/versionInfo.sh -ifixes

Wednesday, June 27, 2012

Converting GMT dates to local time zone

In TW 6.x the dates in LSW_TASK table are stored in GMT time zone. When querying the table directly (should be avoided in general) the dates can be converted to a given time zone similar to the following:

SELECT
    task_id,
    to_char(rcvd_datetime, 'yyyy/MM/dd HH24:mi:ss') AS rcvd_datetime,
    to_char(from_tz(CAST(rcvd_datetime AS TIMESTAMP),'GMT') AT TIME ZONE '+03:00', 'yyyy/MM/dd HH24:mi:ss') AS local_rcvd_datetime
    FROM
        lsw_task

In order to automate conversion and take into account Daylight Saving changes the query can use dbtimezone Oracle function (assuming the Oracle instance is configured correctly):

SELECT
    task_id,
    to_char(rcvd_datetime, 'yyyy/MM/dd HH24:mi:ss') AS rcvd_datetime,
    to_char(from_tz(CAST(rcvd_datetime AS TIMESTAMP),'GMT') AT TIME ZONE dbtimezone, 'yyyy/MM/dd HH24:mi:ss') AS local_rcvd_datetime
    FROM
        lsw_task


If the date needs to be displayed in TW's end user time zone, than the offset can be retrieved via tw.local.user_timeZoneOffset variable:

SELECT
    task_id,
    to_char(rcvd_datetime, 'yyyy/MM/dd HH24:mi:ss') AS rcvd_datetime,
    to_char(from_tz(CAST(rcvd_datetime AS TIMESTAMP),'GMT') AT TIME ZONE '<#= tw.local.user_timeZoneOffset #>', 'yyyy/MM/dd HH24:mi:ss') AS local_rcvd_datetime
    FROM
        lsw_task