Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
7ee4ea24
Commit
7ee4ea24
authored
Apr 29, 2017
by
Aaron Ellington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lint fixes
parent
705cb988
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
23 deletions
+25
-23
caddy.go
caddy.go
+3
-3
caddyhttp/browse/browse.go
caddyhttp/browse/browse.go
+3
-3
caddyhttp/httpserver/mitm.go
caddyhttp/httpserver/mitm.go
+4
-3
caddyhttp/httpserver/replacer.go
caddyhttp/httpserver/replacer.go
+2
-2
caddytls/config.go
caddytls/config.go
+12
-12
plugins.go
plugins.go
+1
-0
No files found.
caddy.go
View file @
7ee4ea24
...
@@ -768,7 +768,7 @@ func IsLoopback(addr string) bool {
...
@@ -768,7 +768,7 @@ func IsLoopback(addr string) bool {
// be an IP or an IP:port combination.
// be an IP or an IP:port combination.
// Loopback addresses are considered false.
// Loopback addresses are considered false.
func
IsInternal
(
addr
string
)
bool
{
func
IsInternal
(
addr
string
)
bool
{
private
_n
etworks
:=
[]
string
{
private
N
etworks
:=
[]
string
{
"10.0.0.0/8"
,
"10.0.0.0/8"
,
"172.16.0.0/12"
,
"172.16.0.0/12"
,
"192.168.0.0/16"
,
"192.168.0.0/16"
,
...
@@ -786,8 +786,8 @@ func IsInternal(addr string) bool {
...
@@ -786,8 +786,8 @@ func IsInternal(addr string) bool {
if
ip
==
nil
{
if
ip
==
nil
{
return
false
return
false
}
}
for
_
,
private
_network
:=
range
private_n
etworks
{
for
_
,
private
Network
:=
range
privateN
etworks
{
_
,
ipnet
,
_
:=
net
.
ParseCIDR
(
private
_n
etwork
)
_
,
ipnet
,
_
:=
net
.
ParseCIDR
(
private
N
etwork
)
if
ipnet
.
Contains
(
ip
)
{
if
ipnet
.
Contains
(
ip
)
{
return
true
return
true
}
}
...
...
caddyhttp/browse/browse.go
View file @
7ee4ea24
...
@@ -156,10 +156,10 @@ func (l byNameDirFirst) Less(i, j int) bool {
...
@@ -156,10 +156,10 @@ func (l byNameDirFirst) Less(i, j int) bool {
// if both are dir or file sort normally
// if both are dir or file sort normally
if
l
.
Items
[
i
]
.
IsDir
==
l
.
Items
[
j
]
.
IsDir
{
if
l
.
Items
[
i
]
.
IsDir
==
l
.
Items
[
j
]
.
IsDir
{
return
strings
.
ToLower
(
l
.
Items
[
i
]
.
Name
)
<
strings
.
ToLower
(
l
.
Items
[
j
]
.
Name
)
return
strings
.
ToLower
(
l
.
Items
[
i
]
.
Name
)
<
strings
.
ToLower
(
l
.
Items
[
j
]
.
Name
)
}
else
{
// always sort dir ahead of file
return
l
.
Items
[
i
]
.
IsDir
}
}
// always sort dir ahead of file
return
l
.
Items
[
i
]
.
IsDir
}
}
// By Size
// By Size
...
...
caddyhttp/httpserver/mitm.go
View file @
7ee4ea24
...
@@ -161,11 +161,11 @@ func parseRawClientHello(data []byte) (info rawHelloInfo) {
...
@@ -161,11 +161,11 @@ func parseRawClientHello(data []byte) (info rawHelloInfo) {
if
len
(
data
)
<
42
{
if
len
(
data
)
<
42
{
return
return
}
}
sessionI
d
Len
:=
int
(
data
[
38
])
sessionI
D
Len
:=
int
(
data
[
38
])
if
sessionI
dLen
>
32
||
len
(
data
)
<
39
+
sessionId
Len
{
if
sessionI
DLen
>
32
||
len
(
data
)
<
39
+
sessionID
Len
{
return
return
}
}
data
=
data
[
39
+
sessionI
d
Len
:
]
data
=
data
[
39
+
sessionI
D
Len
:
]
if
len
(
data
)
<
2
{
if
len
(
data
)
<
2
{
return
return
}
}
...
@@ -598,6 +598,7 @@ var greaseCiphers = map[uint16]struct{}{
...
@@ -598,6 +598,7 @@ var greaseCiphers = map[uint16]struct{}{
0xFAFA
:
{},
0xFAFA
:
{},
}
}
// Define variables used for TLS communication
const
(
const
(
extensionOCSPStatusRequest
=
5
extensionOCSPStatusRequest
=
5
extensionSupportedCurves
=
10
// also called "SupportedGroups"
extensionSupportedCurves
=
10
// also called "SupportedGroups"
...
...
caddyhttp/httpserver/replacer.go
View file @
7ee4ea24
...
@@ -330,9 +330,9 @@ func (r *replacer) getSubstitution(key string) string {
...
@@ -330,9 +330,9 @@ func (r *replacer) getSubstitution(key string) string {
if
val
,
ok
:=
r
.
request
.
Context
()
.
Value
(
caddy
.
CtxKey
(
"mitm"
))
.
(
bool
);
ok
{
if
val
,
ok
:=
r
.
request
.
Context
()
.
Value
(
caddy
.
CtxKey
(
"mitm"
))
.
(
bool
);
ok
{
if
val
{
if
val
{
return
"likely"
return
"likely"
}
else
{
return
"unlikely"
}
}
return
"unlikely"
}
}
return
"unknown"
return
"unknown"
case
"{status}"
:
case
"{status}"
:
...
...
caddytls/config.go
View file @
7ee4ea24
...
@@ -232,8 +232,8 @@ func (c *Config) StorageFor(caURL string) (Storage, error) {
...
@@ -232,8 +232,8 @@ func (c *Config) StorageFor(caURL string) (Storage, error) {
// buildStandardTLSConfig converts cfg (*caddytls.Config) to a *tls.Config
// buildStandardTLSConfig converts cfg (*caddytls.Config) to a *tls.Config
// and stores it in cfg so it can be used in servers. If TLS is disabled,
// and stores it in cfg so it can be used in servers. If TLS is disabled,
// no tls.Config is created.
// no tls.Config is created.
func
(
c
fg
*
Config
)
buildStandardTLSConfig
()
error
{
func
(
c
*
Config
)
buildStandardTLSConfig
()
error
{
if
!
c
fg
.
Enabled
{
if
!
c
.
Enabled
{
return
nil
return
nil
}
}
...
@@ -243,35 +243,35 @@ func (cfg *Config) buildStandardTLSConfig() error {
...
@@ -243,35 +243,35 @@ func (cfg *Config) buildStandardTLSConfig() error {
curvesAdded
:=
make
(
map
[
tls
.
CurveID
]
struct
{})
curvesAdded
:=
make
(
map
[
tls
.
CurveID
]
struct
{})
// add cipher suites
// add cipher suites
for
_
,
ciph
:=
range
c
fg
.
Ciphers
{
for
_
,
ciph
:=
range
c
.
Ciphers
{
if
_
,
ok
:=
ciphersAdded
[
ciph
];
!
ok
{
if
_
,
ok
:=
ciphersAdded
[
ciph
];
!
ok
{
ciphersAdded
[
ciph
]
=
struct
{}{}
ciphersAdded
[
ciph
]
=
struct
{}{}
config
.
CipherSuites
=
append
(
config
.
CipherSuites
,
ciph
)
config
.
CipherSuites
=
append
(
config
.
CipherSuites
,
ciph
)
}
}
}
}
config
.
PreferServerCipherSuites
=
c
fg
.
PreferServerCipherSuites
config
.
PreferServerCipherSuites
=
c
.
PreferServerCipherSuites
// add curve preferences
// add curve preferences
for
_
,
curv
:=
range
c
fg
.
CurvePreferences
{
for
_
,
curv
:=
range
c
.
CurvePreferences
{
if
_
,
ok
:=
curvesAdded
[
curv
];
!
ok
{
if
_
,
ok
:=
curvesAdded
[
curv
];
!
ok
{
curvesAdded
[
curv
]
=
struct
{}{}
curvesAdded
[
curv
]
=
struct
{}{}
config
.
CurvePreferences
=
append
(
config
.
CurvePreferences
,
curv
)
config
.
CurvePreferences
=
append
(
config
.
CurvePreferences
,
curv
)
}
}
}
}
config
.
MinVersion
=
c
fg
.
ProtocolMinVersion
config
.
MinVersion
=
c
.
ProtocolMinVersion
config
.
MaxVersion
=
c
fg
.
ProtocolMaxVersion
config
.
MaxVersion
=
c
.
ProtocolMaxVersion
config
.
ClientAuth
=
c
fg
.
ClientAuth
config
.
ClientAuth
=
c
.
ClientAuth
config
.
NextProtos
=
c
fg
.
ALPN
config
.
NextProtos
=
c
.
ALPN
config
.
GetCertificate
=
c
fg
.
GetCertificate
config
.
GetCertificate
=
c
.
GetCertificate
// set up client authentication if enabled
// set up client authentication if enabled
if
config
.
ClientAuth
!=
tls
.
NoClientCert
{
if
config
.
ClientAuth
!=
tls
.
NoClientCert
{
pool
:=
x509
.
NewCertPool
()
pool
:=
x509
.
NewCertPool
()
clientCertsAdded
:=
make
(
map
[
string
]
struct
{})
clientCertsAdded
:=
make
(
map
[
string
]
struct
{})
for
_
,
caFile
:=
range
c
fg
.
ClientCerts
{
for
_
,
caFile
:=
range
c
.
ClientCerts
{
// don't add cert to pool more than once
// don't add cert to pool more than once
if
_
,
ok
:=
clientCertsAdded
[
caFile
];
ok
{
if
_
,
ok
:=
clientCertsAdded
[
caFile
];
ok
{
continue
continue
...
@@ -303,7 +303,7 @@ func (cfg *Config) buildStandardTLSConfig() error {
...
@@ -303,7 +303,7 @@ func (cfg *Config) buildStandardTLSConfig() error {
}
}
// store the resulting new tls.Config
// store the resulting new tls.Config
c
fg
.
tlsConfig
=
config
c
.
tlsConfig
=
config
return
nil
return
nil
}
}
...
...
plugins.go
View file @
7ee4ea24
...
@@ -217,6 +217,7 @@ func RegisterPlugin(name string, plugin Plugin) {
...
@@ -217,6 +217,7 @@ func RegisterPlugin(name string, plugin Plugin) {
// EventName represents the name of an event used with event hooks.
// EventName represents the name of an event used with event hooks.
type
EventName
string
type
EventName
string
// Define the event names for the startup and shutdown events
const
(
const
(
StartupEvent
EventName
=
"startup"
StartupEvent
EventName
=
"startup"
ShutdownEvent
EventName
=
"shutdown"
ShutdownEvent
EventName
=
"shutdown"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment