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.