yxchng commited on
Commit
53c10d3
·
1 Parent(s): 25fbe5a
Files changed (2) hide show
  1. app.py +1 -0
  2. install.sh +0 -731
app.py CHANGED
@@ -4,6 +4,7 @@ import subprocess
4
 
5
  import os
6
  print("A")
 
7
  os.system("sh install.sh -y")
8
  print("B")
9
  os.system('pip install tokenizers==0.8.1rc1')
 
4
 
5
  import os
6
  print("A")
7
+ os.system("curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > install.sh")
8
  os.system("sh install.sh -y")
9
  print("B")
10
  os.system('pip install tokenizers==0.8.1rc1')
install.sh DELETED
@@ -1,731 +0,0 @@
1
- #!/bin/sh
2
- # shellcheck shell=dash
3
-
4
- # This is just a little script that can be downloaded from the internet to
5
- # install rustup. It just does platform detection, downloads the installer
6
- # and runs it.
7
-
8
- # It runs on Unix shells like {a,ba,da,k,z}sh. It uses the common `local`
9
- # extension. Note: Most shells limit `local` to 1 var per line, contra bash.
10
-
11
- if [ "$KSH_VERSION" = 'Version JM 93t+ 2010-03-05' ]; then
12
- # The version of ksh93 that ships with many illumos systems does not
13
- # support the "local" extension. Print a message rather than fail in
14
- # subtle ways later on:
15
- echo 'rustup does not work with this ksh93 version; please try bash!' >&2
16
- exit 1
17
- fi
18
-
19
-
20
- set -u
21
-
22
- # If RUSTUP_UPDATE_ROOT is unset or empty, default it.
23
- RUSTUP_UPDATE_ROOT="${RUSTUP_UPDATE_ROOT:-https://static.rust-lang.org/rustup}"
24
-
25
- # NOTICE: If you change anything here, please make the same changes in setup_mode.rs
26
- usage() {
27
- cat <<EOF
28
- rustup-init 1.26.0 (577bf51ae 2023-04-05)
29
- The installer for rustup
30
-
31
- USAGE:
32
- rustup-init [OPTIONS]
33
-
34
- OPTIONS:
35
- -v, --verbose
36
- Enable verbose output
37
-
38
- -q, --quiet
39
- Disable progress output
40
-
41
- -y
42
- Disable confirmation prompt.
43
-
44
- --default-host <default-host>
45
- Choose a default host triple
46
-
47
- --default-toolchain <default-toolchain>
48
- Choose a default toolchain to install. Use 'none' to not install any toolchains at all
49
-
50
- --profile <profile>
51
- [default: default] [possible values: minimal, default, complete]
52
-
53
- -c, --component <components>...
54
- Component name to also install
55
-
56
- -t, --target <targets>...
57
- Target name to also install
58
-
59
- --no-update-default-toolchain
60
- Don't update any existing default toolchain after install
61
-
62
- --no-modify-path
63
- Don't configure the PATH environment variable
64
-
65
- -h, --help
66
- Print help information
67
-
68
- -V, --version
69
- Print version information
70
- EOF
71
- }
72
-
73
- main() {
74
- downloader --check
75
- need_cmd uname
76
- need_cmd mktemp
77
- need_cmd chmod
78
- need_cmd mkdir
79
- need_cmd rm
80
- need_cmd rmdir
81
-
82
- get_architecture || return 1
83
- local _arch="$RETVAL"
84
- assert_nz "$_arch" "arch"
85
-
86
- local _ext=""
87
- case "$_arch" in
88
- *windows*)
89
- _ext=".exe"
90
- ;;
91
- esac
92
-
93
- local _url="${RUSTUP_UPDATE_ROOT}/dist/${_arch}/rustup-init${_ext}"
94
-
95
- local _dir
96
- if ! _dir="$(ensure mktemp -d)"; then
97
- # Because the previous command ran in a subshell, we must manually
98
- # propagate exit status.
99
- exit 1
100
- fi
101
- local _file="${_dir}/rustup-init${_ext}"
102
-
103
- local _ansi_escapes_are_valid=false
104
- if [ -t 2 ]; then
105
- if [ "${TERM+set}" = 'set' ]; then
106
- case "$TERM" in
107
- xterm*|rxvt*|urxvt*|linux*|vt*)
108
- _ansi_escapes_are_valid=true
109
- ;;
110
- esac
111
- fi
112
- fi
113
-
114
- # check if we have to use /dev/tty to prompt the user
115
- local need_tty=yes
116
- for arg in "$@"; do
117
- case "$arg" in
118
- --help)
119
- usage
120
- exit 0
121
- ;;
122
- *)
123
- OPTIND=1
124
- if [ "${arg%%--*}" = "" ]; then
125
- # Long option (other than --help);
126
- # don't attempt to interpret it.
127
- continue
128
- fi
129
- while getopts :hy sub_arg "$arg"; do
130
- case "$sub_arg" in
131
- h)
132
- usage
133
- exit 0
134
- ;;
135
- y)
136
- # user wants to skip the prompt --
137
- # we don't need /dev/tty
138
- need_tty=no
139
- ;;
140
- *)
141
- ;;
142
- esac
143
- done
144
- ;;
145
- esac
146
- done
147
-
148
- if $_ansi_escapes_are_valid; then
149
- printf "\33[1minfo:\33[0m downloading installer\n" 1>&2
150
- else
151
- printf '%s\n' 'info: downloading installer' 1>&2
152
- fi
153
-
154
- ensure mkdir -p "$_dir"
155
- ensure downloader "$_url" "$_file" "$_arch"
156
- ensure chmod u+x "$_file"
157
- if [ ! -x "$_file" ]; then
158
- printf '%s\n' "Cannot execute $_file (likely because of mounting /tmp as noexec)." 1>&2
159
- printf '%s\n' "Please copy the file to a location where you can execute binaries and run ./rustup-init${_ext}." 1>&2
160
- exit 1
161
- fi
162
-
163
- if [ "$need_tty" = "yes" ] && [ ! -t 0 ]; then
164
- # The installer is going to want to ask for confirmation by
165
- # reading stdin. This script was piped into `sh` though and
166
- # doesn't have stdin to pass to its children. Instead we're going
167
- # to explicitly connect /dev/tty to the installer's stdin.
168
- if [ ! -t 1 ]; then
169
- err "Unable to run interactively. Run with -y to accept defaults, --help for additional options"
170
- fi
171
-
172
- ignore "$_file" "$@" < /dev/tty
173
- else
174
- ignore "$_file" "$@"
175
- fi
176
-
177
- local _retval=$?
178
-
179
- ignore rm "$_file"
180
- ignore rmdir "$_dir"
181
-
182
- return "$_retval"
183
- }
184
-
185
- check_proc() {
186
- # Check for /proc by looking for the /proc/self/exe link
187
- # This is only run on Linux
188
- if ! test -L /proc/self/exe ; then
189
- err "fatal: Unable to find /proc/self/exe. Is /proc mounted? Installation cannot proceed without /proc."
190
- fi
191
- }
192
-
193
- get_bitness() {
194
- need_cmd head
195
- # Architecture detection without dependencies beyond coreutils.
196
- # ELF files start out "\x7fELF", and the following byte is
197
- # 0x01 for 32-bit and
198
- # 0x02 for 64-bit.
199
- # The printf builtin on some shells like dash only supports octal
200
- # escape sequences, so we use those.
201
- local _current_exe_head
202
- _current_exe_head=$(head -c 5 /proc/self/exe )
203
- if [ "$_current_exe_head" = "$(printf '\177ELF\001')" ]; then
204
- echo 32
205
- elif [ "$_current_exe_head" = "$(printf '\177ELF\002')" ]; then
206
- echo 64
207
- else
208
- err "unknown platform bitness"
209
- fi
210
- }
211
-
212
- is_host_amd64_elf() {
213
- need_cmd head
214
- need_cmd tail
215
- # ELF e_machine detection without dependencies beyond coreutils.
216
- # Two-byte field at offset 0x12 indicates the CPU,
217
- # but we're interested in it being 0x3E to indicate amd64, or not that.
218
- local _current_exe_machine
219
- _current_exe_machine=$(head -c 19 /proc/self/exe | tail -c 1)
220
- [ "$_current_exe_machine" = "$(printf '\076')" ]
221
- }
222
-
223
- get_endianness() {
224
- local cputype=$1
225
- local suffix_eb=$2
226
- local suffix_el=$3
227
-
228
- # detect endianness without od/hexdump, like get_bitness() does.
229
- need_cmd head
230
- need_cmd tail
231
-
232
- local _current_exe_endianness
233
- _current_exe_endianness="$(head -c 6 /proc/self/exe | tail -c 1)"
234
- if [ "$_current_exe_endianness" = "$(printf '\001')" ]; then
235
- echo "${cputype}${suffix_el}"
236
- elif [ "$_current_exe_endianness" = "$(printf '\002')" ]; then
237
- echo "${cputype}${suffix_eb}"
238
- else
239
- err "unknown platform endianness"
240
- fi
241
- }
242
-
243
- get_architecture() {
244
- local _ostype _cputype _bitness _arch _clibtype
245
- _ostype="$(uname -s)"
246
- _cputype="$(uname -m)"
247
- _clibtype="gnu"
248
-
249
- if [ "$_ostype" = Linux ]; then
250
- if [ "$(uname -o)" = Android ]; then
251
- _ostype=Android
252
- fi
253
- if ldd --version 2>&1 | grep -q 'musl'; then
254
- _clibtype="musl"
255
- fi
256
- fi
257
-
258
- if [ "$_ostype" = Darwin ] && [ "$_cputype" = i386 ]; then
259
- # Darwin `uname -m` lies
260
- if sysctl hw.optional.x86_64 | grep -q ': 1'; then
261
- _cputype=x86_64
262
- fi
263
- fi
264
-
265
- if [ "$_ostype" = SunOS ]; then
266
- # Both Solaris and illumos presently announce as "SunOS" in "uname -s"
267
- # so use "uname -o" to disambiguate. We use the full path to the
268
- # system uname in case the user has coreutils uname first in PATH,
269
- # which has historically sometimes printed the wrong value here.
270
- if [ "$(/usr/bin/uname -o)" = illumos ]; then
271
- _ostype=illumos
272
- fi
273
-
274
- # illumos systems have multi-arch userlands, and "uname -m" reports the
275
- # machine hardware name; e.g., "i86pc" on both 32- and 64-bit x86
276
- # systems. Check for the native (widest) instruction set on the
277
- # running kernel:
278
- if [ "$_cputype" = i86pc ]; then
279
- _cputype="$(isainfo -n)"
280
- fi
281
- fi
282
-
283
- case "$_ostype" in
284
-
285
- Android)
286
- _ostype=linux-android
287
- ;;
288
-
289
- Linux)
290
- check_proc
291
- _ostype=unknown-linux-$_clibtype
292
- _bitness=$(get_bitness)
293
- ;;
294
-
295
- FreeBSD)
296
- _ostype=unknown-freebsd
297
- ;;
298
-
299
- NetBSD)
300
- _ostype=unknown-netbsd
301
- ;;
302
-
303
- DragonFly)
304
- _ostype=unknown-dragonfly
305
- ;;
306
-
307
- Darwin)
308
- _ostype=apple-darwin
309
- ;;
310
-
311
- illumos)
312
- _ostype=unknown-illumos
313
- ;;
314
-
315
- MINGW* | MSYS* | CYGWIN* | Windows_NT)
316
- _ostype=pc-windows-gnu
317
- ;;
318
-
319
- *)
320
- err "unrecognized OS type: $_ostype"
321
- ;;
322
-
323
- esac
324
-
325
- case "$_cputype" in
326
-
327
- i386 | i486 | i686 | i786 | x86)
328
- _cputype=i686
329
- ;;
330
-
331
- xscale | arm)
332
- _cputype=arm
333
- if [ "$_ostype" = "linux-android" ]; then
334
- _ostype=linux-androideabi
335
- fi
336
- ;;
337
-
338
- armv6l)
339
- _cputype=arm
340
- if [ "$_ostype" = "linux-android" ]; then
341
- _ostype=linux-androideabi
342
- else
343
- _ostype="${_ostype}eabihf"
344
- fi
345
- ;;
346
-
347
- armv7l | armv8l)
348
- _cputype=armv7
349
- if [ "$_ostype" = "linux-android" ]; then
350
- _ostype=linux-androideabi
351
- else
352
- _ostype="${_ostype}eabihf"
353
- fi
354
- ;;
355
-
356
- aarch64 | arm64)
357
- _cputype=aarch64
358
- ;;
359
-
360
- x86_64 | x86-64 | x64 | amd64)
361
- _cputype=x86_64
362
- ;;
363
-
364
- mips)
365
- _cputype=$(get_endianness mips '' el)
366
- ;;
367
-
368
- mips64)
369
- if [ "$_bitness" -eq 64 ]; then
370
- # only n64 ABI is supported for now
371
- _ostype="${_ostype}abi64"
372
- _cputype=$(get_endianness mips64 '' el)
373
- fi
374
- ;;
375
-
376
- ppc)
377
- _cputype=powerpc
378
- ;;
379
-
380
- ppc64)
381
- _cputype=powerpc64
382
- ;;
383
-
384
- ppc64le)
385
- _cputype=powerpc64le
386
- ;;
387
-
388
- s390x)
389
- _cputype=s390x
390
- ;;
391
- riscv64)
392
- _cputype=riscv64gc
393
- ;;
394
- loongarch64)
395
- _cputype=loongarch64
396
- ;;
397
- *)
398
- err "unknown CPU type: $_cputype"
399
-
400
- esac
401
-
402
- # Detect 64-bit linux with 32-bit userland
403
- if [ "${_ostype}" = unknown-linux-gnu ] && [ "${_bitness}" -eq 32 ]; then
404
- case $_cputype in
405
- x86_64)
406
- if [ -n "${RUSTUP_CPUTYPE:-}" ]; then
407
- _cputype="$RUSTUP_CPUTYPE"
408
- else {
409
- # 32-bit executable for amd64 = x32
410
- if is_host_amd64_elf; then {
411
- echo "This host is running an x32 userland; as it stands, x32 support is poor," 1>&2
412
- echo "and there isn't a native toolchain -- you will have to install" 1>&2
413
- echo "multiarch compatibility with i686 and/or amd64, then select one" 1>&2
414
- echo "by re-running this script with the RUSTUP_CPUTYPE environment variable" 1>&2
415
- echo "set to i686 or x86_64, respectively." 1>&2
416
- echo 1>&2
417
- echo "You will be able to add an x32 target after installation by running" 1>&2
418
- echo " rustup target add x86_64-unknown-linux-gnux32" 1>&2
419
- exit 1
420
- }; else
421
- _cputype=i686
422
- fi
423
- }; fi
424
- ;;
425
- mips64)
426
- _cputype=$(get_endianness mips '' el)
427
- ;;
428
- powerpc64)
429
- _cputype=powerpc
430
- ;;
431
- aarch64)
432
- _cputype=armv7
433
- if [ "$_ostype" = "linux-android" ]; then
434
- _ostype=linux-androideabi
435
- else
436
- _ostype="${_ostype}eabihf"
437
- fi
438
- ;;
439
- riscv64gc)
440
- err "riscv64 with 32-bit userland unsupported"
441
- ;;
442
- esac
443
- fi
444
-
445
- # Detect armv7 but without the CPU features Rust needs in that build,
446
- # and fall back to arm.
447
- # See https://github.com/rust-lang/rustup.rs/issues/587.
448
- if [ "$_ostype" = "unknown-linux-gnueabihf" ] && [ "$_cputype" = armv7 ]; then
449
- if ensure grep '^Features' /proc/cpuinfo | grep -q -v neon; then
450
- # At least one processor does not have NEON.
451
- _cputype=arm
452
- fi
453
- fi
454
-
455
- _arch="${_cputype}-${_ostype}"
456
-
457
- RETVAL="$_arch"
458
- }
459
-
460
- say() {
461
- printf 'rustup: %s\n' "$1"
462
- }
463
-
464
- err() {
465
- say "$1" >&2
466
- exit 1
467
- }
468
-
469
- need_cmd() {
470
- if ! check_cmd "$1"; then
471
- err "need '$1' (command not found)"
472
- fi
473
- }
474
-
475
- check_cmd() {
476
- command -v "$1" > /dev/null 2>&1
477
- }
478
-
479
- assert_nz() {
480
- if [ -z "$1" ]; then err "assert_nz $2"; fi
481
- }
482
-
483
- # Run a command that should never fail. If the command fails execution
484
- # will immediately terminate with an error showing the failing
485
- # command.
486
- ensure() {
487
- if ! "$@"; then err "command failed: $*"; fi
488
- }
489
-
490
- # This is just for indicating that commands' results are being
491
- # intentionally ignored. Usually, because it's being executed
492
- # as part of error handling.
493
- ignore() {
494
- "$@"
495
- }
496
-
497
- # This wraps curl or wget. Try curl first, if not installed,
498
- # use wget instead.
499
- downloader() {
500
- local _dld
501
- local _ciphersuites
502
- local _err
503
- local _status
504
- local _retry
505
- if check_cmd curl; then
506
- _dld=curl
507
- elif check_cmd wget; then
508
- _dld=wget
509
- else
510
- _dld='curl or wget' # to be used in error message of need_cmd
511
- fi
512
-
513
- if [ "$1" = --check ]; then
514
- need_cmd "$_dld"
515
- elif [ "$_dld" = curl ]; then
516
- check_curl_for_retry_support
517
- _retry="$RETVAL"
518
- get_ciphersuites_for_curl
519
- _ciphersuites="$RETVAL"
520
- if [ -n "$_ciphersuites" ]; then
521
- _err=$(curl $_retry --proto '=https' --tlsv1.2 --ciphers "$_ciphersuites" --silent --show-error --fail --location "$1" --output "$2" 2>&1)
522
- _status=$?
523
- else
524
- echo "Warning: Not enforcing strong cipher suites for TLS, this is potentially less secure"
525
- if ! check_help_for "$3" curl --proto --tlsv1.2; then
526
- echo "Warning: Not enforcing TLS v1.2, this is potentially less secure"
527
- _err=$(curl $_retry --silent --show-error --fail --location "$1" --output "$2" 2>&1)
528
- _status=$?
529
- else
530
- _err=$(curl $_retry --proto '=https' --tlsv1.2 --silent --show-error --fail --location "$1" --output "$2" 2>&1)
531
- _status=$?
532
- fi
533
- fi
534
- if [ -n "$_err" ]; then
535
- echo "$_err" >&2
536
- if echo "$_err" | grep -q 404$; then
537
- err "installer for platform '$3' not found, this may be unsupported"
538
- fi
539
- fi
540
- return $_status
541
- elif [ "$_dld" = wget ]; then
542
- if [ "$(wget -V 2>&1|head -2|tail -1|cut -f1 -d" ")" = "BusyBox" ]; then
543
- echo "Warning: using the BusyBox version of wget. Not enforcing strong cipher suites for TLS or TLS v1.2, this is potentially less secure"
544
- _err=$(wget "$1" -O "$2" 2>&1)
545
- _status=$?
546
- else
547
- get_ciphersuites_for_wget
548
- _ciphersuites="$RETVAL"
549
- if [ -n "$_ciphersuites" ]; then
550
- _err=$(wget --https-only --secure-protocol=TLSv1_2 --ciphers "$_ciphersuites" "$1" -O "$2" 2>&1)
551
- _status=$?
552
- else
553
- echo "Warning: Not enforcing strong cipher suites for TLS, this is potentially less secure"
554
- if ! check_help_for "$3" wget --https-only --secure-protocol; then
555
- echo "Warning: Not enforcing TLS v1.2, this is potentially less secure"
556
- _err=$(wget "$1" -O "$2" 2>&1)
557
- _status=$?
558
- else
559
- _err=$(wget --https-only --secure-protocol=TLSv1_2 "$1" -O "$2" 2>&1)
560
- _status=$?
561
- fi
562
- fi
563
- fi
564
- if [ -n "$_err" ]; then
565
- echo "$_err" >&2
566
- if echo "$_err" | grep -q ' 404 Not Found$'; then
567
- err "installer for platform '$3' not found, this may be unsupported"
568
- fi
569
- fi
570
- return $_status
571
- else
572
- err "Unknown downloader" # should not reach here
573
- fi
574
- }
575
-
576
- check_help_for() {
577
- local _arch
578
- local _cmd
579
- local _arg
580
- _arch="$1"
581
- shift
582
- _cmd="$1"
583
- shift
584
-
585
- local _category
586
- if "$_cmd" --help | grep -q 'For all options use the manual or "--help all".'; then
587
- _category="all"
588
- else
589
- _category=""
590
- fi
591
-
592
- case "$_arch" in
593
-
594
- *darwin*)
595
- if check_cmd sw_vers; then
596
- case $(sw_vers -productVersion) in
597
- 10.*)
598
- # If we're running on macOS, older than 10.13, then we always
599
- # fail to find these options to force fallback
600
- if [ "$(sw_vers -productVersion | cut -d. -f2)" -lt 13 ]; then
601
- # Older than 10.13
602
- echo "Warning: Detected macOS platform older than 10.13"
603
- return 1
604
- fi
605
- ;;
606
- 11.*)
607
- # We assume Big Sur will be OK for now
608
- ;;
609
- *)
610
- # Unknown product version, warn and continue
611
- echo "Warning: Detected unknown macOS major version: $(sw_vers -productVersion)"
612
- echo "Warning TLS capabilities detection may fail"
613
- ;;
614
- esac
615
- fi
616
- ;;
617
-
618
- esac
619
-
620
- for _arg in "$@"; do
621
- if ! "$_cmd" --help "$_category" | grep -q -- "$_arg"; then
622
- return 1
623
- fi
624
- done
625
-
626
- true # not strictly needed
627
- }
628
-
629
- # Check if curl supports the --retry flag, then pass it to the curl invocation.
630
- check_curl_for_retry_support() {
631
- local _retry_supported=""
632
- # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc.
633
- if check_help_for "notspecified" "curl" "--retry"; then
634
- _retry_supported="--retry 3"
635
- if check_help_for "notspecified" "curl" "--continue-at"; then
636
- # "-C -" tells curl to automatically find where to resume the download when retrying.
637
- _retry_supported="--retry 3 -C -"
638
- fi
639
- fi
640
-
641
- RETVAL="$_retry_supported"
642
- }
643
-
644
- # Return cipher suite string specified by user, otherwise return strong TLS 1.2-1.3 cipher suites
645
- # if support by local tools is detected. Detection currently supports these curl backends:
646
- # GnuTLS and OpenSSL (possibly also LibreSSL and BoringSSL). Return value can be empty.
647
- get_ciphersuites_for_curl() {
648
- if [ -n "${RUSTUP_TLS_CIPHERSUITES-}" ]; then
649
- # user specified custom cipher suites, assume they know what they're doing
650
- RETVAL="$RUSTUP_TLS_CIPHERSUITES"
651
- return
652
- fi
653
-
654
- local _openssl_syntax="no"
655
- local _gnutls_syntax="no"
656
- local _backend_supported="yes"
657
- if curl -V | grep -q ' OpenSSL/'; then
658
- _openssl_syntax="yes"
659
- elif curl -V | grep -iq ' LibreSSL/'; then
660
- _openssl_syntax="yes"
661
- elif curl -V | grep -iq ' BoringSSL/'; then
662
- _openssl_syntax="yes"
663
- elif curl -V | grep -iq ' GnuTLS/'; then
664
- _gnutls_syntax="yes"
665
- else
666
- _backend_supported="no"
667
- fi
668
-
669
- local _args_supported="no"
670
- if [ "$_backend_supported" = "yes" ]; then
671
- # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc.
672
- if check_help_for "notspecified" "curl" "--tlsv1.2" "--ciphers" "--proto"; then
673
- _args_supported="yes"
674
- fi
675
- fi
676
-
677
- local _cs=""
678
- if [ "$_args_supported" = "yes" ]; then
679
- if [ "$_openssl_syntax" = "yes" ]; then
680
- _cs=$(get_strong_ciphersuites_for "openssl")
681
- elif [ "$_gnutls_syntax" = "yes" ]; then
682
- _cs=$(get_strong_ciphersuites_for "gnutls")
683
- fi
684
- fi
685
-
686
- RETVAL="$_cs"
687
- }
688
-
689
- # Return cipher suite string specified by user, otherwise return strong TLS 1.2-1.3 cipher suites
690
- # if support by local tools is detected. Detection currently supports these wget backends:
691
- # GnuTLS and OpenSSL (possibly also LibreSSL and BoringSSL). Return value can be empty.
692
- get_ciphersuites_for_wget() {
693
- if [ -n "${RUSTUP_TLS_CIPHERSUITES-}" ]; then
694
- # user specified custom cipher suites, assume they know what they're doing
695
- RETVAL="$RUSTUP_TLS_CIPHERSUITES"
696
- return
697
- fi
698
-
699
- local _cs=""
700
- if wget -V | grep -q '\-DHAVE_LIBSSL'; then
701
- # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc.
702
- if check_help_for "notspecified" "wget" "TLSv1_2" "--ciphers" "--https-only" "--secure-protocol"; then
703
- _cs=$(get_strong_ciphersuites_for "openssl")
704
- fi
705
- elif wget -V | grep -q '\-DHAVE_LIBGNUTLS'; then
706
- # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc.
707
- if check_help_for "notspecified" "wget" "TLSv1_2" "--ciphers" "--https-only" "--secure-protocol"; then
708
- _cs=$(get_strong_ciphersuites_for "gnutls")
709
- fi
710
- fi
711
-
712
- RETVAL="$_cs"
713
- }
714
-
715
- # Return strong TLS 1.2-1.3 cipher suites in OpenSSL or GnuTLS syntax. TLS 1.2
716
- # excludes non-ECDHE and non-AEAD cipher suites. DHE is excluded due to bad
717
- # DH params often found on servers (see RFC 7919). Sequence matches or is
718
- # similar to Firefox 68 ESR with weak cipher suites disabled via about:config.
719
- # $1 must be openssl or gnutls.
720
- get_strong_ciphersuites_for() {
721
- if [ "$1" = "openssl" ]; then
722
- # OpenSSL is forgiving of unknown values, no problems with TLS 1.3 values on versions that don't support it yet.
723
- echo "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384"
724
- elif [ "$1" = "gnutls" ]; then
725
- # GnuTLS isn't forgiving of unknown values, so this may require a GnuTLS version that supports TLS 1.3 even if wget doesn't.
726
- # Begin with SECURE128 (and higher) then remove/add to build cipher suites. Produces same 9 cipher suites as OpenSSL but in slightly different order.
727
- echo "SECURE128:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS-ALL:-CIPHER-ALL:-MAC-ALL:-KX-ALL:+AEAD:+ECDHE-ECDSA:+ECDHE-RSA:+AES-128-GCM:+CHACHA20-POLY1305:+AES-256-GCM"
728
- fi
729
- }
730
-
731
- main "$@" || exit 1