-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-system-integration.sh
More file actions
executable file
·142 lines (126 loc) · 3.97 KB
/
test-system-integration.sh
File metadata and controls
executable file
·142 lines (126 loc) · 3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/bash
#
# test-system-integration.sh - Test libssl1.1 system integration
#
# This script tests that libssl1.1 is properly integrated as system default
# and that applications can find and use the hardened DSSSL version.
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "Testing libssl1.1 system integration..."
echo "=========================================="
# Check if libssl libraries exist
echo "1. Checking library installation..."
if [[ -f "/usr/lib/libssl.so.1.1" ]] || [[ -f "/usr/lib64/libssl.so.1.1" ]]; then
echo "✓ libssl.so.1.1 found"
else
echo "✗ libssl.so.1.1 not found"
exit 1
fi
if [[ -f "/usr/lib/libcrypto.so.1.1" ]] || [[ -f "/usr/lib64/libcrypto.so.1.1" ]]; then
echo "✓ libcrypto.so.1.1 found"
else
echo "✗ libcrypto.so.1.1 not found"
exit 1
fi
# Check symlinks
echo ""
echo "2. Checking library symlinks..."
if [[ -L "/usr/lib/libssl.so" ]] || [[ -L "/usr/lib64/libssl.so" ]]; then
echo "✓ libssl.so symlink exists"
else
echo "⚠ libssl.so symlink not found"
fi
if [[ -L "/usr/lib/libcrypto.so" ]] || [[ -L "/usr/lib64/libcrypto.so" ]]; then
echo "✓ libcrypto.so symlink exists"
else
echo "⚠ libcrypto.so symlink not found"
fi
# Check headers
echo ""
echo "3. Checking header installation..."
if [[ -d "/usr/include/openssl-1.1" ]]; then
echo "✓ libssl1.1 headers found in /usr/include/openssl-1.1"
else
echo "✗ libssl1.1 headers not found"
exit 1
fi
if [[ -L "/usr/include/openssl" ]]; then
echo "✓ openssl header symlink exists"
elif [[ -d "/usr/include/openssl" ]]; then
echo "✓ openssl headers directory exists"
else
echo "⚠ openssl headers not accessible at standard location"
fi
# Check openssl binary
echo ""
echo "4. Checking openssl binary..."
if command -v openssl >/dev/null 2>&1; then
echo "✓ openssl command found"
VERSION=$(openssl version 2>/dev/null || echo "unknown")
echo " Version: $VERSION"
if echo "$VERSION" | grep -q "1.1.1"; then
echo "✓ Correct OpenSSL 1.1.1 version detected"
else
echo "⚠ Unexpected OpenSSL version (expected 1.1.1)"
fi
else
echo "✗ openssl command not found"
exit 1
fi
# Test compilation
echo ""
echo "5. Testing compilation against system libssl..."
cd "$SCRIPT_DIR"
if command -v gcc >/dev/null 2>&1; then
echo "Compiling test program..."
if gcc -o test-libssl-integration test-libssl-integration.c -lssl -lcrypto 2>/dev/null; then
echo "✓ Compilation successful"
else
echo "✗ Compilation failed"
exit 1
fi
else
echo "⚠ gcc not found, skipping compilation test"
fi
# Run test program
echo ""
echo "6. Running integration test..."
if [[ -x "./test-libssl-integration" ]]; then
echo "Running test program..."
if ./test-libssl-integration; then
echo "✓ Integration test passed"
else
echo "✗ Integration test failed"
exit 1
fi
else
echo "⚠ Test program not available, skipping runtime test"
fi
# Check library loading
echo ""
echo "7. Testing library loading..."
if command -v ldd >/dev/null 2>&1 && [[ -x "./test-libssl-integration" ]]; then
LIBSSL_LIB=$(ldd ./test-libssl-integration 2>/dev/null | grep libssl | head -1 | awk '{print $3}' || echo "")
if [[ -n "$LIBSSL_LIB" ]]; then
echo "✓ Application links to: $LIBSSL_LIB"
if echo "$LIBSSL_LIB" | grep -q "libssl.so.1.1"; then
echo "✓ Correctly using libssl.so.1.1"
else
echo "⚠ Not using expected libssl.so.1.1"
fi
else
echo "⚠ Could not determine linked library"
fi
fi
echo ""
echo "=========================================="
echo "System integration test completed!"
echo ""
echo "libssl1.1 is now the system default OpenSSL with DSSSL hardening."
echo "All applications will automatically use the hardened version."
echo "=========================================="
# Cleanup
if [[ -f "./test-libssl-integration" ]]; then
rm -f ./test-libssl-integration
fi