-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
663 lines (565 loc) · 19.7 KB
/
main.go
File metadata and controls
663 lines (565 loc) · 19.7 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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"embed"
"encoding/json"
"encoding/pem"
"fmt"
"html"
"io"
"log"
"math/big"
"net"
"net/http"
"os"
"os/exec"
"path/filepath"
"runtime"
"sort"
"strings"
"sync"
"sync/atomic"
"time"
)
// Credits info
var Credits = map[string]string{
"tool_name": "SecureDrop",
"tool_version": "1.0",
"developer": "benzoXdev",
"github": "github.com/benzoXdev/SecureDrop",
}
// Config JSON mapping
type Config struct {
Host string `json:"host"`
Port int `json:"port"`
}
// Global Variables
//go:embed Structure/Html.html Structure/Css.css Structure/Javascript.js Structure/Icone.ico file_cabinet.png
var embeddedFiles embed.FS
var (
baseDir string
storageDir string
configDir string
logsFile string
htmlTemplateStr string
filesData map[string]int64
filesMutex sync.RWMutex
nextID int64
)
// ─── Paths ───────────────────────────────────────────────────────────────────
func initPaths() {
exePath, err := os.Executable()
if err != nil {
log.Fatal(err)
}
baseDir = filepath.Dir(exePath)
// Fix for 'go run main.go' where exePath is in a Temp directory
if strings.Contains(baseDir, os.TempDir()) ||
strings.Contains(baseDir, `\Temp\`) ||
strings.Contains(baseDir, `/tmp/`) {
baseDir = "."
}
storageDir = filepath.Join(baseDir, "Storage")
configDir = filepath.Join(baseDir, "Config")
logsFile = filepath.Join(configDir, "Logs.json")
os.MkdirAll(storageDir, os.ModePerm)
os.MkdirAll(configDir, os.ModePerm)
if _, err := os.Stat(logsFile); os.IsNotExist(err) {
os.WriteFile(logsFile, []byte("{}"), 0644)
}
}
// safePath returns a validated path inside storageDir, or an error.
func safePath(filename string) (string, error) {
// Strip any directory components from the supplied filename
base := filepath.Base(filename)
clean := filepath.Join(storageDir, base)
// Resolve to absolute and make sure it still lives inside storageDir
abs, err := filepath.Abs(clean)
if err != nil {
return "", fmt.Errorf("invalid path")
}
storageAbs, _ := filepath.Abs(storageDir)
if !strings.HasPrefix(abs, storageAbs+string(filepath.Separator)) &&
abs != storageAbs {
return "", fmt.Errorf("path traversal detected")
}
return abs, nil
}
// ─── Logs (thread-safe) ──────────────────────────────────────────────────────
func loadLogs() {
filesMutex.Lock()
defer filesMutex.Unlock()
filesData = make(map[string]int64)
data, err := os.ReadFile(logsFile)
if err != nil {
log.Printf("[WARN] Could not read logs file: %v", err)
return
}
if err := json.Unmarshal(data, &filesData); err != nil {
log.Printf("[WARN] Logs.json is corrupted or empty, starting fresh: %v", err)
filesData = make(map[string]int64)
}
// Init nextID to max ID to avoid collisions
var max int64
for _, v := range filesData {
if v > max {
max = v
}
}
atomic.StoreInt64(&nextID, max)
}
func saveLogs() {
// Caller must hold filesMutex (write)
data, err := json.MarshalIndent(filesData, "", " ")
if err != nil {
log.Printf("[WARN] Failed to marshal logs: %v", err)
return
}
// Atomic write
tmpFile := logsFile + ".tmp"
if err := os.WriteFile(tmpFile, data, 0644); err != nil {
log.Printf("[WARN] Failed to write temp logs file: %v", err)
return
}
if err := os.Rename(tmpFile, logsFile); err != nil {
log.Printf("[WARN] Failed to rename temp logs: %v", err)
}
}
// ─── Config ──────────────────────────────────────────────────────────────────
func loadConfig() Config {
file, err := os.ReadFile(filepath.Join(configDir, "Config.json"))
if err != nil {
return Config{Host: "0.0.0.0", Port: 5000}
}
var c Config
if err := json.Unmarshal(file, &c); err != nil {
log.Printf("[WARN] Config.json is corrupted, using defaults: %v", err)
return Config{Host: "0.0.0.0", Port: 5000}
}
if c.Port == 0 {
c.Port = 5000
}
if c.Host == "" {
c.Host = "0.0.0.0"
}
return c
}
// ─── HTML template ───────────────────────────────────────────────────────────
func prepareHTML() {
css, _ := embeddedFiles.ReadFile("Structure/Css.css")
js, _ := embeddedFiles.ReadFile("Structure/Javascript.js")
htmlBytes, err := embeddedFiles.ReadFile("Structure/Html.html")
if err != nil {
log.Fatalf("Critical error: Cannot find Html.html template in Structure dir! %v", err)
}
h := string(htmlBytes)
h = strings.ReplaceAll(h, "/*%CSS%*/", string(css))
h = strings.ReplaceAll(h, "/*%JAVASCRIPT%*/", string(js))
title1 := fmt.Sprintf("%s v%s (by %s)", Credits["tool_name"], Credits["tool_version"], Credits["developer"])
h = strings.ReplaceAll(h, "/*%TITLE1%*/", title1)
h = strings.ReplaceAll(h, "/*%TITLE2%*/", Credits["tool_name"])
h = strings.ReplaceAll(h, "/*%GITHUB%*/", Credits["github"])
h = strings.ReplaceAll(h, "/*%DEVELOPER%*/", Credits["developer"])
h = strings.ReplaceAll(h, "/*%VERSION%*/", Credits["tool_version"])
htmlTemplateStr = h
}
// ─── Network & Crypto helpers ────────────────────────────────────────────────
func getLocalIP() string {
conn, err := net.Dial("udp", "8.8.8.8:80")
if err != nil {
return "127.0.0.1"
}
defer conn.Close()
return conn.LocalAddr().(*net.UDPAddr).IP.String()
}
func ensureCerts(certFile, keyFile, ip string) error {
if _, err := os.Stat(certFile); err == nil {
if _, err := os.Stat(keyFile); err == nil {
return nil // Certs exist
}
}
priv, err := rsa.GenerateKey(rand.Reader, 2048)
if err != nil {
return err
}
notBefore := time.Now()
notAfter := notBefore.Add(365 * 24 * time.Hour)
serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)
serialNumber, err := rand.Int(rand.Reader, serialNumberLimit)
if err != nil {
return err
}
template := x509.Certificate{
SerialNumber: serialNumber,
Subject: pkix.Name{Organization: []string{"SecureDrop Local Server"}},
NotBefore: notBefore,
NotAfter: notAfter,
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
BasicConstraintsValid: true,
}
template.IPAddresses = append(template.IPAddresses, net.ParseIP("127.0.0.1"))
if parsedIP := net.ParseIP(ip); parsedIP != nil {
template.IPAddresses = append(template.IPAddresses, parsedIP)
}
derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv)
if err != nil {
return err
}
cf, err := os.Create(certFile)
if err != nil {
return err
}
pem.Encode(cf, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes})
cf.Close()
kf, err := os.Create(keyFile)
if err != nil {
return err
}
pem.Encode(kf, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(priv)})
kf.Close()
return nil
}
// openBrowser opens the given URL in the default OS browser.
func openBrowser(url string, healthURL string) {
go func() {
// Ping until ready (max 30 attempts)
client := http.Client{
Timeout: 1 * time.Second,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
}
for i := 0; i < 30; i++ {
resp, err := client.Get(healthURL)
if err == nil && resp.StatusCode == 200 {
resp.Body.Close()
break
}
if resp != nil {
resp.Body.Close()
}
time.Sleep(200 * time.Millisecond)
}
var cmd *exec.Cmd
switch runtime.GOOS {
case "windows":
cmd = exec.Command("rundll32", "url.dll,FileProtocolHandler", url)
case "darwin":
cmd = exec.Command("open", url)
default: // linux, etc.
cmd = exec.Command("xdg-open", url)
}
_ = cmd.Start()
}()
}
// ─── CORS middleware (LAN-only) ───────────────────────────────────────────────
func corsMiddleware(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
origin := r.Header.Get("Origin")
// Only allow same-origin or local origins
if origin != "" {
// Allow localhost and LAN IPs
isLocal := strings.Contains(origin, "localhost") ||
strings.Contains(origin, "127.0.0.1") ||
strings.HasPrefix(origin, "https://192.168.") ||
strings.HasPrefix(origin, "https://10.") ||
strings.HasPrefix(origin, "https://172.")
if isLocal {
w.Header().Set("Access-Control-Allow-Origin", origin)
w.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
w.Header().Set("Vary", "Origin")
}
}
if r.Method == "OPTIONS" {
w.WriteHeader(http.StatusOK)
return
}
next.ServeHTTP(w, r)
}
}
// ─── Handlers ────────────────────────────────────────────────────────────────
func indexHandler(cfg Config) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if r.Method == "POST" {
if err := r.ParseMultipartForm(10 << 20); err != nil {
http.Error(w, "Upload malformed", http.StatusBadRequest)
return
}
file, handler, err := r.FormFile("file")
if err != nil {
http.Error(w, "No file provided", http.StatusBadRequest)
return
}
defer file.Close()
filename := handler.Filename
// ── Security: validate safe path ────────────────────────────────────
destPath, err := safePath(filename)
if err != nil {
http.Error(w, "Invalid filename", http.StatusBadRequest)
return
}
safeFilename := filepath.Base(filename)
// Reject duplicates silently to avoid overwriting existing data
filesMutex.RLock()
_, exists := filesData[safeFilename]
filesMutex.RUnlock()
if exists {
http.Error(w, "File already exists", http.StatusConflict)
return
}
out, err := os.Create(destPath)
if err != nil {
http.Error(w, "Cannot create file", http.StatusInternalServerError)
return
}
defer out.Close()
// Stream to disk — supports multi-GB files
if _, err = io.Copy(out, file); err != nil {
http.Error(w, "Write error", http.StatusInternalServerError)
return
}
fmt.Printf("\033[1;34m[+]\033[0m [%s] File received: \033[1;37m%s\033[0m\n", r.RemoteAddr, safeFilename)
newID := atomic.AddInt64(&nextID, 1)
filesMutex.Lock()
filesData[safeFilename] = newID
saveLogs()
filesMutex.Unlock()
}
// ── Build file list ─────────────────────────────────────────────────────
type fileItem struct {
Name string
Num int64
}
filesMutex.RLock()
var list []fileItem
for k, v := range filesData {
list = append(list, fileItem{k, v})
}
filesMutex.RUnlock()
sort.Slice(list, func(i, j int) bool { return list[i].Num < list[j].Num })
// ── Template rendering ──────────────────────────────────────────────────
lengthStr := fmt.Sprintf("%d", len(list))
h := strings.ReplaceAll(htmlTemplateStr, "{{ files|length }}", lengthStr)
if len(list) > 0 {
// Replace loop
loopStart := "{% for filename, number in files %}"
loopEnd := "{% endfor %}"
startIdx := strings.Index(h, loopStart)
endIdx := strings.Index(h, loopEnd)
if startIdx != -1 && endIdx != -1 {
templateItem := h[startIdx+len(loopStart) : endIdx]
var compiled string
for i, item := range list {
chunk := templateItem
escapedName := html.EscapeString(item.Name)
chunk = strings.ReplaceAll(chunk, "{{ loop.index0 * 0.06 }}", fmt.Sprintf("%.2f", float64(i)*0.06))
chunk = strings.ReplaceAll(chunk, "{{ number }}", fmt.Sprintf("%d", item.Num))
chunk = strings.ReplaceAll(chunk, "{{ '%04d' % number }}", fmt.Sprintf("%04d", item.Num))
chunk = strings.ReplaceAll(chunk, "{{ filename }}", escapedName)
compiled += chunk
}
h = h[:startIdx] + compiled + h[endIdx+len(loopEnd):]
}
// Keep `if` content, remove `else` content
elseIdx := strings.Index(h, "{% else %}")
endifIdx := strings.Index(h, "{% endif %}")
if elseIdx != -1 && endifIdx != -1 {
h = h[:elseIdx] + h[endifIdx+len("{% endif %}"):]
}
h = strings.ReplaceAll(h, "{% if files %}", "")
} else {
// Keep `else` content, remove `if` content
ifIdx := strings.Index(h, "{% if files %}")
elseIdx := strings.Index(h, "{% else %}")
if ifIdx != -1 && elseIdx != -1 {
h = h[:ifIdx] + h[elseIdx+len("{% else %}"):]
}
h = strings.ReplaceAll(h, "{% endif %}", "")
}
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Write([]byte(h))
}
}
func downloadHandler(w http.ResponseWriter, r *http.Request) {
rawName := strings.TrimPrefix(r.URL.Path, "/download/")
if rawName == "" {
http.Error(w, "Bad Request", http.StatusBadRequest)
return
}
filePath, err := safePath(rawName)
if err != nil {
http.Error(w, "Invalid filename", http.StatusBadRequest)
return
}
if _, err := os.Stat(filePath); os.IsNotExist(err) {
http.Error(w, "Not Found", http.StatusNotFound)
return
}
safeName := filepath.Base(filePath)
fmt.Printf("\033[1;34m[+]\033[0m [%s] File downloaded: \033[1;37m%s\033[0m\n", r.RemoteAddr, safeName)
w.Header().Set("Content-Disposition", `attachment; filename="`+safeName+`"`)
http.ServeFile(w, r, filePath)
}
func deleteHandler(w http.ResponseWriter, r *http.Request) {
if r.Method != "POST" {
http.Error(w, "Method Not Allowed", http.StatusMethodNotAllowed)
return
}
rawName := strings.TrimPrefix(r.URL.Path, "/delete/")
if rawName == "" {
http.Error(w, "Bad Request", http.StatusBadRequest)
return
}
filePath, err := safePath(rawName)
if err != nil {
http.Error(w, "Invalid filename", http.StatusBadRequest)
return
}
stat, err := os.Stat(filePath)
if err != nil {
http.Error(w, "Not Found", http.StatusNotFound)
return
}
fmt.Printf("\033[1;33m[WARN] Overwrite is best-effort. SSDs/NVMe with wear-leveling do not guarantee data erasure.\033[0m\n")
// Overwrite with zeros (best-effort)
size := stat.Size()
f, err := os.OpenFile(filePath, os.O_WRONLY, 0)
if err == nil {
zeros := make([]byte, 4096)
var written int64
for written < size {
n, _ := f.Write(zeros)
if n == 0 {
break
}
written += int64(n)
}
f.Sync()
f.Close()
}
os.Remove(filePath)
safeName := filepath.Base(filePath)
filesMutex.Lock()
delete(filesData, safeName)
saveLogs()
filesMutex.Unlock()
fmt.Printf("\033[1;34m[+]\033[0m [%s] File wiped & deleted: \033[1;37m%s\033[0m\n", r.RemoteAddr, safeName)
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write([]byte(`{"status":"deleted"}`))
}
func faviconHandler(w http.ResponseWriter, r *http.Request) {
data, err := embeddedFiles.ReadFile("Structure/Icone.ico")
if err != nil {
http.NotFound(w, r)
return
}
w.Header().Set("Content-Type", "image/x-icon")
w.Write(data)
}
// fileCabinetHandler serves the file_cabinet.png image from the base directory.
func fileCabinetHandler(w http.ResponseWriter, r *http.Request) {
data, err := embeddedFiles.ReadFile("file_cabinet.png")
if err != nil {
http.NotFound(w, r)
return
}
w.Header().Set("Content-Type", "image/png")
w.Write(data)
}
func apiFilesHandler(w http.ResponseWriter, r *http.Request) {
type fileItem struct {
Name string `json:"filename"`
Num int64 `json:"id"`
Size int64 `json:"size_bytes"`
}
filesMutex.RLock()
var list []fileItem
for k, v := range filesData {
var size int64
if stat, err := os.Stat(filepath.Join(storageDir, k)); err == nil {
size = stat.Size()
}
list = append(list, fileItem{Name: k, Num: v, Size: size})
}
filesMutex.RUnlock()
sort.Slice(list, func(i, j int) bool { return list[i].Num < list[j].Num })
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(list)
}
func healthHandler(w http.ResponseWriter, r *http.Request) {
filesMutex.RLock()
count := len(filesData)
filesMutex.RUnlock()
w.Header().Set("Content-Type", "application/json")
fmt.Fprintf(w, `{"status":"ok","files":%d,"ts":"%s"}`, count, time.Now().UTC().Format(time.RFC3339))
}
// ─── Main ────────────────────────────────────────────────────────────────────
func main() {
initPaths()
loadLogs()
cfg := loadConfig()
prepareHTML()
mux := http.NewServeMux()
route := func(path string, fn http.HandlerFunc) {
mux.HandleFunc(path, corsMiddleware(fn))
}
route("/health", healthHandler)
route("/api/files", apiFilesHandler)
route("/favicon.ico", faviconHandler)
route("/file_cabinet.png", fileCabinetHandler)
route("/download/", downloadHandler)
route("/delete/", deleteHandler)
route("/", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/" {
indexHandler(cfg)(w, r)
} else {
http.NotFound(w, r)
}
})
ip := getLocalIP()
networkURL := fmt.Sprintf("https://%s:%d", ip, cfg.Port)
localURL := fmt.Sprintf("https://localhost:%d", cfg.Port)
certFile := filepath.Join(configDir, "cert.pem")
keyFile := filepath.Join(configDir, "key.pem")
if err := ensureCerts(certFile, keyFile, ip); err != nil {
log.Fatalf("Failed to generate HTTPS certs: %v", err)
}
fmt.Printf("\n\033[1;31m")
fmt.Println(` /$$$$$$ /$$$$$$$$ /$$$$$$ /$$ /$$ /$$$$$$$ /$$$$$$$$ /$$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$
/$$__ $$| $$_____/ /$$__ $$| $$ | $$| $$__ $$| $$_____/| $$__ $$| $$__ $$ /$$__ $$| $$__ $$
| $$ \__/| $$ | $$ \__/| $$ | $$| $$ \ $$| $$ | $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$
| $$$$$$ | $$$$$ | $$ | $$ | $$| $$$$$$$/| $$$$$ | $$ | $$| $$$$$$$/| $$ | $$| $$$$$$$/
\____ $$| $$__/ | $$ | $$ | $$| $$__ $$| $$__/ | $$ | $$| $$__ $$| $$ | $$| $$____/
/$$ \ $$| $$ | $$ $$| $$ | $$| $$ \ $$| $$ | $$ | $$| $$ \ $$| $$ | $$| $$
| $$$$$$/| $$$$$$$$| $$$$$$/| $$$$$$/| $$ | $$| $$$$$$$$| $$$$$$$/| $$ | $$| $$$$$$/| $$
\______/ |________/ \______/ \______/ |__/ |__/|________/|_______/ |__/ |__/ \______/ |__/
`)
fmt.Println()
fmt.Printf("\033[1;37m ╔═══ SecureDrop v%s by %s ═══╗\033[0m\n\n", Credits["tool_version"], Credits["developer"])
fmt.Printf("\033[1;31m[ACCESS]\033[0m\n")
fmt.Printf(" ▸ Local : %s\n", localURL)
fmt.Printf(" ▸ Network : %s\n", networkURL)
fmt.Printf(" ▸ Health : %s/health\n", localURL)
fmt.Printf(" ▸ API : %s/api/files\n", localURL)
fmt.Printf("\033[1;31m[CONFIG]\033[0m\n")
fmt.Printf(" ▸ Max upload : Unlimited\n")
fmt.Printf(" ▸ Storage : %s\n\n", storageDir)
// Block-free browser open after ping passes
openBrowser(networkURL, localURL+"/health")
addr := fmt.Sprintf("%s:%d", cfg.Host, cfg.Port)
srv := &http.Server{
Addr: addr,
Handler: mux,
ReadTimeout: 30 * time.Second,
WriteTimeout: 0, // 0 for huge downloads
IdleTimeout: 120 * time.Second,
}
log.Fatal(srv.ListenAndServeTLS(certFile, keyFile))
}