Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
FulvioValenza committed Nov 11, 2016
1 parent e328b40 commit d5ee0d5
Show file tree
Hide file tree
Showing 571 changed files with 83,905 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*~
*.class
*.pyc
*.o
28 changes: 28 additions & 0 deletions 0001-HisAppraiser-Fixed-reading-of-host-name-from-the-rep.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 0a317e92fc67fd6171ea1de011b72c77b0074680 Mon Sep 17 00:00:00 2001
From: Nicola Barresi <[email protected]>
Date: Fri, 4 Apr 2014 12:29:45 +0200
Subject: [PATCH] HisAppraiser: Fixed reading of host name from the report ID

This patch fixes a bug in the reading of the host name from the report
ID; it was executed not considering host names containing the character
"-".
---
.../integrityReport/HisReportValidator.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Source/HisAppraiser/src/gov/niarl/hisAppraiser/integrityReport/HisReportValidator.java b/Source/HisAppraiser/src/gov/niarl/hisAppraiser/integrityReport/HisReportValidator.java
index 62696b3..16202cb 100755
--- a/Source/HisAppraiser/src/gov/niarl/hisAppraiser/integrityReport/HisReportValidator.java
+++ b/Source/HisAppraiser/src/gov/niarl/hisAppraiser/integrityReport/HisReportValidator.java
@@ -341,7 +341,7 @@ public class HisReportValidator {
return;
}

- String hostName = splittedReportId[0];
+ String hostName = report.getID().split("-[^-]*-[^-]*$")[0];
AuditLog lastAuditLog = new HisAuditDao().getLastAuditLog(hostName);

if (!FIRST_IR && !lastAuditLog.getPcrIMLMask().equals(this.currentPcrIMLMask)) {
--
1.7.9.5

509 changes: 509 additions & 0 deletions OAT-Appraiser-Base.spec

Large diffs are not rendered by default.

79 changes: 79 additions & 0 deletions OpenAttestation/CommandTool/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@

^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
^* CERT ^*
^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
bash oat_cert -h his8

^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
^* OEM ^*
^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
bash oat_oem -a -h his8 '{"Name":"OEM1","Description":"Newdescription"}'

bash oat_oem -e -h his8 '{"Name":"OEM1","Description":"Mooooooooodify"}'

bash oat_oem -d -h his8 '{"Name":"OEM1"}'

^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
^* OS ^*
^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
bash oat_os -a -h his8 '{"Name":"OS1","Version":"v1","Description":"Test1"}'

bash oat_os -e -h his8 '{"Name":"OS1","Version":"v1","Description":"Mooooooooodify"}'

bash oat_os -d -h his8 '{"Name":"OS1","Version":"v1"}'

^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
^* MLE ^*
^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
#VMM
bash oat_mle -a -h his8 '{"Name":"NewMLE2","Version":"v123","OsName":"OS1","OsVersion":"v1","Attestation_Type": "PCR","MLE_Type":"VMM","Description":"Test","MLE_Manifests": [{"Name": "18", "Value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"}]}'

#BIOS
bash oat_mle -a -h his8 '{"Name":"NewMLE1","Version":"v123","OemName":"OEM1","Attestation_Type": "PCR","MLE_Type":"BIOS","Description":"MLETest1111","MLE_Manifests": [{"Name": "0", "Value": "31B97D97B4679917EC3C1D943635693FFBAB4143"}]}'

bash oat_mle -e -h his8 '{"Name":"NewMLE1","Version":"v123","OemName":"OEM1","Attestation_Type": "PCR","MLE_Type":"BIOS","Description":"03JR84","MLE_Manifests": [{"Name": "0", "Value": "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"}]}'

bash oat_mle -d -h his8 '{"mleName":"NewMLE1","mleVersion":"v123","oemName":"OEM1"}'

^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
^* HOST ^*
^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
bash oat_host -a -h his8 '{"HostName":"his8","IPAddress":"192.168.1.1","Port":"9999","BIOS_Name":"NewMLE1","BIOS_Version":"v123","BIOS_Oem":"OEM1","VMM_Name":"NewMLE2","VMM_Version":"v123","VMM_OSName":"OS1","VMM_OSVersion":"v1","Email":"","AddOn_Connection_String":"","Description":""}'

bash oat_host -e -h his8 '{"HostName":"his8","IPAddress":"192.168.1.1","Port":"9999","BIOS_Name":"NewMLE1","BIOS_Version":"v123","BIOS_Oem":"OEM1","VMM_Name":"NewMLE2","VMM_Version":"v123","VMM_OSName":"OS1","VMM_OSVersion":"v1","Email":"[email protected]","AddOn_Connection_String":"Moooooodify","Description":"Y"}'

bash oat_host -d -h his8 '{"hostName":"his8"}'

bash oat_host -s -h his8 '{rhel}'

^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
^* POLLHOSTS ^*
^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
bash oat_pollhosts -h his8 '{"hosts":["his8"]}'

^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
^* PCR_WHITE_LIST ^*
^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
#oem
bash oat_pcrwhitelist -a -h his8 '{"pcrName":"8","pcrDigest":"DE1343582097C9BC739C9311D60B5B5F5603A", "mleName":"NewMLE1","mleVersion":"v123", "oemName": "OEM1"}'
bash oat_pcrwhitelist -e -h his8 '{"pcrName":"8","pcrDigest":"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "mleName":"NewMLE1","mleVersion":"v123", "oemName": "OEM1"}'
bash oat_pcrwhitelist -d -h his8 '{"pcrName":"8","mleName":"NewMLE1","mleVersion":"v123","oemName":"OEM1"}'

#os
bash oat_pcrwhitelist -a -h his8 '{"pcrName":"5","pcrDigest":"DE1343582097C9BC739C9311D60B5B5F5603A","mleName":"NewMLE2","mleVersion":"v123","osName":"OS1","osVersion":"v1"}'
bash oat_pcrwhitelist -e -h his8 '{"pcrName":"5","pcrDigest":"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "mleName":"NewMLE2","mleVersion":"v123","osName":"OS1","osVersion":"v1"}'
bash oat_pcrwhitelist -d -h his8 '{"pcrName":"5","mleName":"NewMLE2","mleVersion":"v123","osName":"OS1","osVersion":"v1"}'

^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
^* VIEW ^*
^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*

bash oat_view_os -h his8
bash oat_view_oem -h his8
bash oat_view_mle -h his8 '{"mleName":"NewMLE1","mleVersion":"v123","oemName":"OEM1"}'

^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*
^* MLE_SEARCH ^*
^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*

bash oat_mle_search -h his8 '{OEM1}'
22 changes: 22 additions & 0 deletions OpenAttestation/CommandTool/add_NED.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#! /bin/bash

OAT=$1
HOST=$2
HOSTIP=$3
HOSTPCR0=$4
HOSTDISTRO=$5
HOSTCERTDGST=$6

if [ -z "$OAT" ] || [ -z "$HOST" ] || [ -z "$HOSTIP" ] || [ -z "$HOSTPCR0" ] || [ -z "$HOSTDISTRO" ] || [ -z "$HOSTCERTDGST" ]; then
echo "Missing parameters"
exit 1
fi

set -x

bash oat_mle -a -h $OAT '{"Name":"'$HOST'-'$HOSTDISTRO'","Version":"123","OsName":"'$HOSTDISTRO'","OsVersion":"v1234","Attestation_Type": "PCR","MLE_Type":"VMM","Description":"Test ad"}'
bash oat_host -a -h $OAT '{"HostName":"'$HOST'","IPAddress":"'$HOSTIP'","Port":"9999","VMM_Name":"'$HOST'-'$HOSTDISTRO'","VMM_Version":"123","VMM_OSName":"'$HOSTDISTRO'","VMM_OSVersion":"v1234","Email":"","AddOn_Connection_String":"","Description":"'$HOSTCERTDGST'"}'
bash oat_pcrwhitelist -a -h $OAT '{"pcrName":"0","pcrDigest":"'$HOSTPCR0'","mleName":"'$HOST'-'$HOSTDISTRO'","mleVersion":"123", "osName":"'$HOSTDISTRO'", "osVersion":"v1234"}'


set +x
30 changes: 30 additions & 0 deletions OpenAttestation/CommandTool/configure_oat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#! /bin/bash

OAT=$1
HOST=$2
HOSTIP=$3
HOSTPCR0=$4
HOSTDISTRO=$5
RAPATH=$6
DBIP=$7
HOSTCERTDGST=$8

if [ -z "$OAT" ] || [ -z "$HOST" ] || [ -z "$HOSTIP" ] || [ -z "$HOSTPCR0" ] || [ -z "$HOSTDISTRO" ] || [ -z "$RAPATH" ] || [ -z "$DBIP" ] || [ -z "$HOSTCERTDGST" ]; then
echo "Missing parameters"
exit 1
fi

set -x

#bash oat_cert -h $OAT
bash oat_oem -a -h $OAT '{"Name":"OEM1","Description":"Test id"}'
bash oat_os -a -h $OAT '{"Name":"'$HOSTDISTRO'","Version":"v1234","Description":"Test1"}'
bash oat_mle -a -h $OAT '{"Name":"'$HOST'-'$HOSTDISTRO'","Version":"123","OsName":"'$HOSTDISTRO'","OsVersion":"v1234","Attestation_Type": "PCR","MLE_Type":"VMM","Description":"Test ad"}'
bash oat_host -a -h $OAT '{"HostName":"'$HOST'","IPAddress":"'$HOSTIP'","Port":"9999","VMM_Name":"'$HOST'-'$HOSTDISTRO'","VMM_Version":"123","VMM_OSName":"'$HOSTDISTRO'","VMM_OSVersion":"v1234","Email":"","AddOn_Connection_String":"","Description":"'$HOSTCERTDGST'"}'
bash oat_pcrwhitelist -a -h $OAT '{"pcrName":"0","pcrDigest":"'$HOSTPCR0'","mleName":"'$HOST'-'$HOSTDISTRO'","mleVersion":"123", "osName":"'$HOSTDISTRO'", "osVersion":"v1234"}'
bash oat_analysisType -a -h $OAT '{"name":"load-time+check-cert","module":"RAVerifier","version":2,"url":"'$RAPATH' -H '$DBIP'"}'
bash oat_analysisType -a -h $OAT '{"name":"VALIDATE_PCR;load-time+check-cert","module":"RAVerifier","version":2,"url":"'$RAPATH' -H '$DBIP'"}'
bash oat_analysisType -a -h $OAT '{"name":"load-time","module":"RAVerifier","version":2,"url":"'$RAPATH' -H '$DBIP'"}'


set +x
82 changes: 82 additions & 0 deletions OpenAttestation/CommandTool/oat_analysisType
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/bin/bash
#create mles script

ADD_PARM="-a"
DEL_PARM="-d"
GET_PARM="-g"
HOST_PARM="-h"
HOST_NAME=""
INFO=""
PORT=8443
ShowAnalysisTypeExample()
{
echo "AnalysisType Example:"
echo -e "Add AnalysisType example:\n\033[31;49;5;1m bash oat_analysisType -a -h HOSTNAME_OF_OAT-APPRAISER '{\"name\":\"ANALYSIS_NAME\",\"module\":\"MODULE_NAME\",\"version\":VERSION_NUMBER,\"url\":\"SCRIPT_URL\",\"requiredPcrMask\":\"HEX_PCR_MASK\"}' \033[0m"
echo -e "Del AnalysisType example:\n\033[31;49;5;1m bash oat_analysisType -d -h HOSTNAME_OF_OAT-APPRAISER '{\"name\":\"ANALYSIS_NAME\"}'\033[0m"
echo -e "Get AnalysisType example:\n\033[31;49;5;1m bash oat_analysisType -g -h HOSTNAME_OF_OAT-APPRAISER\033[0m"
}

if [ $# -lt 3 ];then
echo "parm num error!"
ShowAnalysisTypeExample
exit 0
fi

if [ ! -z $OAT_CERTFILE ] && [ -e $OAT_CERTFILE ];then
echo " "
else
OAT_CERTFILE="certfile.cer"
fi

if [ $2 != $HOST_PARM ];then
echo "-h parm error!"
ShowAnalysisTypeExample
exit 1
else
HOST_NAME="$3"
fi

if [ $1 == $DEL_PARM ];then
INFO="`echo "$4" | awk -F{ '{print $2}'| awk -F} '{print $1}'\
| sed 's/\"//g' | sed 's/:/=/g' | sed 's/,/\&/g'| sed 's/ /%20/g' | sed 's/\+/%2B/g'`"
else
INFO="$4"
fi

addAnalysisType()
{
curl --cacert $OAT_CERTFILE -H "Content-Type: application/json" \
-X POST -d "$INFO" "https://$HOST_NAME:$PORT/WLMService/resources/analysisTypes"
}

delAnalysisType()
{
curl --cacert $OAT_CERTFILE \
-X DELETE "https://$HOST_NAME:$PORT/WLMService/resources/analysisTypes?$INFO"
}

getAnalysisType()
{
curl --cacert $OAT_CERTFILE \
-X GET "https://$HOST_NAME:$PORT/WLMService/resources/analysisTypes" | python -mjson.tool
}

case $1 in
$ADD_PARM)
echo "add AnalysisType:"
addAnalysisType
;;
$DEL_PARM)
echo "del AnalysisType:"
delAnalysisType
;;
$GET_PARM)
echo "get AnalysisType:"
getAnalysisType
;;
*)
echo "Usage oat_AnalysisTypes {-a|-d|-g}"
ShowAnalysisTypeExample
exit 3
esac
echo -e "\n"
32 changes: 32 additions & 0 deletions OpenAttestation/CommandTool/oat_cert
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
#create oat cert
PARM="-h"
PORT="8443"
ShowExample()
{
echo -e "Create cert example:\033[31;49;5;1m$1\033[0m"
}

if [ $# -lt 2 ];then
echo "parm num error!"
ShowExample "bash oat_cert -h HOSTNAME_OF_OAT-APPRAISER"
exit 0
fi

if [ ! -z $OAT_CERTFILE ];then
echo " "
else
OAT_CERTFILE="certfile.cer"
fi

if [ $1 != $PARM ];then
echo "parm error!"
ShowExample "bash oat_cert -h HOSTNAME_OF_OAT-APPRAISER"
exit 0
fi
if [ -e ./$OAT_CERTFILE ];then
rm -f $OAT_CERTFILE
fi

HOST_NAME="$2"
openssl s_client -connect "$HOST_NAME":$PORT -cipher DHE-RSA-AES256-SHA|tee $OAT_CERTFILE
100 changes: 100 additions & 0 deletions OpenAttestation/CommandTool/oat_host
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/bin/bash
#create mles/whitelist/pcr script
ADD_PARM="-a"
EDIT_PARM="-e"
DEL_PARM="-d"
HOST_PARM="-h"
SEARCH_PARM="-s"
HOST_NAME=""
INFO=""
PORT=8443

ShowHostExample()
{
echo "Host Example:"
echo -e "Add Host example:\n\033[31;49;5;1m bash oat_host -a -h HOSTNAME_OF_OAT-APPRAISER '{\"HostName\":\"HOSTNAME-CLIENT\",\"IPAddress\":\"IP_ADDRESS\",\"Port\":\"PORT\",\"BIOS_Name\":\"MLE_NAME_OF_BIOS_TYPE\",\"BIOS_Version\":\"MLE_VERSION\",\"BIOS_Oem\":\"OEM_NAME\",\"VMM_Name\":\"MLE_NAME_OF_VMM_TYPE\",\"VMM_Version\":\"MLE_VERSION\",\"VMM_OSName\":\"OS_NAME\",\"VMM_OSVersion\":\"OS_VERSION\",\"Email\":\"\",\"AddOn_Connection_String\":\"\",\"Description\":\"\"}'\033[0m"

echo -e "Edit Host example:\n\033[31;49;5;1m bash oat_host -e -h HOSTNAME_OF_OAT-APPRAISER '{\"HostName\":\"HOSTNAME-CLIENT\",\"IPAddress\":\"IP_ADDRESS\",\"Port\":\"PORT\",\"BIOS_Name\":\"MLE_NAME_OF_BIOS_TYPE\",\"BIOS_Version\":\"MLE_VERSION\",\"BIOS_Oem\":\"OEM_NAME\",\"VMM_Name\":\"MLE_NAME_OF_VMM_TYPE\",\"VMM_Version\":\"MLE_VERSION\",\"VMM_OSName\":\"OS_NAME\",\"VMM_OSVersion\":\"OS_VERSION\",\"Email\":\"E-MAIL\",\"AddOn_Connection_String\":\"Moooooodify\",\"Description\":\"Moooooodify\"}'\033[0m"

echo -e "Del Host example:\n\033[31;49;5;1m bash oat_host -d -h HOSTNAME_OF_OAT-APPRAISER '{\"hostName\":\"HOSTNAME-CLIENT\"}'\033[0m"
echo -e "Host Search example:\n\033[31;49;5;1m bash oat_host -s -h HOSTNAME_OF_OAT-APPRAISER '{KEY}' \033[0m"
}

if [ $# -lt 4 ];then
echo "parm num error!"
ShowHostExample
exit 0
fi

if [ ! -z $OAT_CERTFILE ] && [ -e $OAT_CERTFILE ];then
echo " "
else
OAT_CERTFILE="certfile.cer"
fi

if [ $2 != $HOST_PARM ];then
echo "-h parm error!"
ShowHostExample
exit 1
else
HOST_NAME="$3"
fi

if [ $1 == $DEL_PARM ];then
INFO="`echo $4 | awk -F{ '{print $2}' | awk -F} '{print $1}' | sed 's/\"//g' | \
sed 's/:/=/g' | sed 's/,/\&/g' | sed 's/ /%20/g'`"
elif [ $1 == $SEARCH_PARM ]; then
INFO="`echo $4 | awk -F{ '{print $2}' | awk -F} '{print $1}' | sed 's/ /%20/g'`"
else
INFO="$4"
fi

echo $INFO

addHOST()
{
curl --cacert $OAT_CERTFILE -H "Content-Type: application/json" \
-X POST -d "$INFO" "https://$HOST_NAME:$PORT/AttestationService/resources/hosts"
}

editHOST()
{
curl --cacert $OAT_CERTFILE -H "Content-Type: application/json" \
-X PUT -d "$INFO" "https://$HOST_NAME:$PORT/AttestationService/resources/hosts"
}

delHOST()
{
curl --cacert $OAT_CERTFILE \
-X DELETE "https://$HOST_NAME:$PORT/AttestationService/resources/hosts?$INFO"
}

searchHOST()
{
curl --cacert $OAT_CERTFILE -H "Content-Type: application/json" \
-X GET "https://$HOST_NAME:$PORT/AttestationService/resources/hosts?searchCriteria=$INFO"
}

case $1 in
$ADD_PARM)
echo "add HOST:"
addHOST
;;
$EDIT_PARM)
echo "edit HOST:"
editHOST
;;
$DEL_PARM)
echo "del HOST:"
delHOST
;;
$SEARCH_PARM)
echo "search HOST:"
searchHOST
;;
*)
echo "Usage oat_host {-a|-e|-d|-s}"
ShowHostExample
exit 3
esac
echo -e "\n"
Loading

0 comments on commit d5ee0d5

Please sign in to comment.