Artifact
a96bc3e641babaae6131d76c795b3048290424cc62cff12a4e3e5e03be9db37e:
0000: 23 21 2f 75 73 72 2f 62 69 6e 2f 65 6e 76 20 74 #!/usr/bin/env t
0010: 63 6c 73 68 0a 0a 73 65 74 20 61 75 74 6f 5f 70 clsh..set auto_p
0020: 61 74 68 20 5b 6c 69 6e 73 65 72 74 20 24 61 75 ath [linsert $au
0030: 74 6f 5f 70 61 74 68 20 30 20 5b 66 69 6c 65 20 to_path 0 [file
0040: 6e 6f 72 6d 61 6c 69 7a 65 20 5b 66 69 6c 65 20 normalize [file
0050: 6a 6f 69 6e 20 5b 66 69 6c 65 20 64 69 72 6e 61 join [file dirna
0060: 6d 65 20 5b 69 6e 66 6f 20 73 63 72 69 70 74 5d me [info script]
0070: 5d 20 2e 2e 5d 5d 5d 0a 70 61 63 6b 61 67 65 20 ] ..]]].package
0080: 70 72 65 66 65 72 20 6c 61 74 65 73 74 0a 70 61 prefer latest.pa
0090: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 74 6c ckage require tl
00a0: 73 0a 0a 70 72 6f 63 20 63 72 65 61 64 61 62 6c s..proc creadabl
00b0: 65 20 7b 73 7d 20 7b 0a 20 20 20 20 70 75 74 73 e {s} {. puts
00c0: 20 22 4c 49 4e 45 3d 5b 67 65 74 73 20 24 73 5d "LINE=[gets $s]
00d0: 22 0a 20 20 20 20 61 66 74 65 72 20 32 30 30 30 ". after 2000
00e0: 0a 20 20 20 20 66 69 6c 65 20 64 65 6c 65 74 65 . file delete
00f0: 20 2d 66 6f 72 63 65 20 24 3a 3a 6b 65 79 66 69 -force $::keyfi
0100: 6c 65 0a 20 20 20 20 66 69 6c 65 20 64 65 6c 65 le. file dele
0110: 74 65 20 2d 66 6f 72 63 65 20 24 3a 3a 63 65 72 te -force $::cer
0120: 74 66 69 6c 65 0a 20 20 20 20 65 78 69 74 0a 7d tfile. exit.}
0130: 0a 0a 70 72 6f 63 20 6d 79 73 65 72 76 20 7b 73 ..proc myserv {s
0140: 20 61 72 67 73 7d 20 7b 0a 20 20 20 20 66 69 6c args} {. fil
0150: 65 65 76 65 6e 74 20 24 73 20 72 65 61 64 61 62 eevent $s readab
0160: 6c 65 20 5b 6c 69 73 74 20 63 72 65 61 64 61 62 le [list creadab
0170: 6c 65 20 24 73 5d 0a 7d 0a 0a 63 6c 6f 73 65 20 le $s].}..close
0180: 5b 66 69 6c 65 20 74 65 6d 70 66 69 6c 65 20 6b [file tempfile k
0190: 65 79 66 69 6c 65 20 6b 65 79 66 69 6c 65 5d 0a eyfile keyfile].
01a0: 63 6c 6f 73 65 20 5b 66 69 6c 65 20 74 65 6d 70 close [file temp
01b0: 66 69 6c 65 20 63 65 72 74 66 69 6c 65 20 63 65 file certfile ce
01c0: 72 74 66 69 6c 65 5d 0a 0a 74 6c 73 3a 3a 6d 69 rtfile]..tls::mi
01d0: 73 63 20 72 65 71 20 31 30 32 34 20 24 6b 65 79 sc req 1024 $key
01e0: 66 69 6c 65 20 24 63 65 72 74 66 69 6c 65 20 5b file $certfile [
01f0: 6c 69 73 74 20 43 20 43 43 43 20 53 54 20 53 54 list C CCC ST ST
0200: 54 54 20 4c 20 4c 4c 4c 4c 20 4f 20 4f 4f 4f 4f TT L LLLL O OOOO
0210: 20 4f 55 20 4f 55 55 55 55 20 43 4e 20 43 4e 4e OU OUUUU CN CNN
0220: 4e 4e 20 45 6d 61 69 6c 20 73 6f 6d 65 40 65 6d NN Email some@em
0230: 61 69 6c 2e 63 6f 6d 20 64 61 79 73 20 37 33 30 ail.com days 730
0240: 20 73 65 72 69 61 6c 20 31 32 5d 0a 0a 74 6c 73 serial 12]..tls
0250: 3a 3a 73 6f 63 6b 65 74 20 2d 72 65 71 75 69 72 ::socket -requir
0260: 65 20 30 20 2d 6b 65 79 66 69 6c 65 20 24 6b 65 e 0 -keyfile $ke
0270: 79 66 69 6c 65 20 2d 63 65 72 74 66 69 6c 65 20 yfile -certfile
0280: 24 63 65 72 74 66 69 6c 65 20 2d 73 65 72 76 65 $certfile -serve
0290: 72 20 6d 79 73 65 72 76 20 31 32 33 30 30 0a 0a r myserv 12300..
02a0: 70 75 74 73 20 22 4e 6f 77 20 72 75 6e 20 6b 65 puts "Now run ke
02b0: 79 74 65 73 74 32 2e 74 63 6c 22 0a 76 77 61 69 ytest2.tcl".vwai
02c0: 74 20 66 6f 72 65 76 65 72 0a 0a t forever..