-
Notifications
You must be signed in to change notification settings - Fork 315
/
Copy pathcurl-rustls.yaml
172 lines (152 loc) · 4.21 KB
/
curl-rustls.yaml
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
package:
name: curl-rustls
version: "8.12.1"
epoch: 0
description: "URL retrieval utility and library"
copyright:
- license: MIT
dependencies:
runtime:
- libcurl-rustls4
checks:
disabled:
- empty # curl-rustls is expected to be empty, it brings in a runtime dep on libcurl-rustls4
environment:
contents:
packages:
- autoconf
- automake
- brotli-dev
- build-base
- busybox
- ca-certificates-bundle
- libpsl-dev
- libtool
- nghttp2-dev
- openssl-dev
- perl
- rustls-ffi-dev
- wolfi-base
- zlib-dev
var-transforms:
- from: ${{package.version}}
match: \.
replace: _
to: mangled-package-version
pipeline:
- uses: git-checkout
with:
repository: https://github.com/curl/curl.git
tag: curl-${{vars.mangled-package-version}}
expected-commit: 57495c64871d18905a0941db9196ef90bafe9a29
- runs: autoreconf -vif
- uses: autoconf/configure
with:
opts: |
--enable-ipv6 \
--enable-unix-sockets \
--without-openssl \
--with-rustls \
--with-nghttp2 \
--with-pic \
--disable-ldap \
--without-libssh2
- uses: autoconf/make
- runs: |
make install DESTDIR="/home/build/curl-rustls"
subpackages:
- name: "libcurl-rustls4"
description: "curl library (rustls backend)"
dependencies:
provider-priority: 10
pipeline:
- runs: |
mkdir -p "${{targets.subpkgdir}}"/usr/lib
mv "/home/build/curl-rustls"/usr/lib/libcurl.so.* "${{targets.subpkgdir}}"/usr/lib/
strip "${{targets.subpkgdir}}"/usr/lib/libcurl.so.*
test:
pipeline:
- uses: test/tw/ldd-check
update:
enabled: true
version-separator: _
github:
identifier: curl/curl
strip-prefix: curl-
test:
environment:
contents:
packages:
- build-base
- gcc
- ca-certificates-bundle
- libcurl-rustls4
- curl-dev
pipeline:
- name: "Test library linking"
runs: |
cat > test.c << 'EOF'
#include <curl/curl.h>
#include <stdio.h>
int main() {
CURL *curl = curl_easy_init();
if (!curl) return 1;
printf("CURL Version: %s\n", curl_version());
curl_easy_cleanup(curl);
return 0;
}
EOF
gcc test.c -o test -lcurl
./test
- name: "Verify rustls backend"
runs: |
cat > ssl_backend.c << 'EOF'
#include <curl/curl.h>
#include <stdio.h>
#include <string.h>
int main() {
CURL *curl = curl_easy_init();
if (!curl) {
return 1;
}
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
if (data->ssl_version && strstr(data->ssl_version, "rustls")) {
printf("SSL backend: %s\n", data->ssl_version);
curl_easy_cleanup(curl);
return 0;
}
fprintf(stderr, "Expected rustls backend, got: %s\n",
data->ssl_version ? data->ssl_version : "none");
curl_easy_cleanup(curl);
return 1;
}
EOF
gcc ssl_backend.c -o ssl_backend -lcurl
./ssl_backend
- name: "Verify rustls backend behavior"
runs: |
cat > test.c << 'EOF'
#include <curl/curl.h>
#include <stdio.h>
int main(void) {
CURL *curl = curl_easy_init();
CURLcode res;
if (!curl) {
return 1;
}
// Try to force TLS 1.1 - this should fail with rustls
curl_easy_setopt(curl, CURLOPT_URL, "https://wolfi.dev");
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1);
res = curl_easy_perform(curl);
// rustls should reject TLS 1.1
if (res != CURLE_SSL_CONNECT_ERROR) {
fprintf(stderr, "Expected TLS 1.1 to fail with rustls\n");
curl_easy_cleanup(curl);
return 0;
}
curl_easy_cleanup(curl);
return 1;
}
EOF
gcc test.c -o test -lcurl
./test