Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
alpine
awall
Commits
5c80fcb7
Commit
5c80fcb7
authored
Jan 26, 2019
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
host.resolve: properly handle CNAME records
parent
5d7327a3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
12 deletions
+15
-12
awall-cli
awall-cli
+2
-2
awall/host.lua
awall/host.lua
+13
-10
No files found.
awall-cli
View file @
5c80fcb7
...
...
@@ -2,7 +2,7 @@
--[[
Alpine Wall
Copyright (C) 2012-201
8
Kaarle Ritvanen
Copyright (C) 2012-201
9
Kaarle Ritvanen
See LICENSE file for license details
]]
--
...
...
@@ -20,7 +20,7 @@ if not table.unpack then table.unpack = unpack end
function
help
()
io.stderr
:
write
(
[[
Alpine Wall
Copyright (C) 2012-201
8
Kaarle Ritvanen
Copyright (C) 2012-201
9
Kaarle Ritvanen
This is free software with ABSOLUTELY NO WARRANTY,
available under the terms of the GNU General Public License, version 2
...
...
awall/host.lua
View file @
5c80fcb7
--[[
Host address resolver for Alpine Wall
Copyright (C) 2012-201
8
Kaarle Ritvanen
Copyright (C) 2012-201
9
Kaarle Ritvanen
See LICENSE file for license details
]]
--
...
...
@@ -30,16 +30,19 @@ function M.resolve(host, context)
if
not
dnscache
[
host
]
then
dnscache
[
host
]
=
{}
for
family
,
rtype
in
pairs
{
inet
=
'A'
,
inet6
=
'AAAA'
}
do
local
answer
for
rec
in
io.popen
(
'drill '
..
host
..
' '
..
rtype
):
lines
()
do
local
name
,
addr
=
rec
:
match
(
'^('
..
familypatterns
.
domain
..
')%s+%d+%s+IN%s+'
..
rtype
..
if
answer
then
if
rec
==
''
then
break
end
local
addr
=
rec
:
match
(
'^'
..
familypatterns
.
domain
..
'%s+%d+%s+IN%s+'
..
rtype
..
'%s+(.+)'
)
if
name
and
name
:
sub
(
1
,
host
:
len
()
+
1
)
==
host
..
'.'
then
if
addr
then
assert
(
getfamily
(
addr
,
context
)
==
family
)
table.insert
(
dnscache
[
host
],
{
family
,
addr
})
end
elseif
rec
==
';; ANSWER SECTION:'
then
answer
=
true
end
end
end
if
not
dnscache
[
host
][
1
]
then
...
...
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