Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
23744c59
Commit
23744c59
authored
Nov 05, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: prune unused bogons scripting #1248
parent
d908e000
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
40 deletions
+6
-40
rc.update_bogons
src/etc/rc.update_bogons
+6
-40
No files found.
src/etc/rc.update_bogons
View file @
23744c59
...
...
@@ -4,11 +4,10 @@
proc_error
=
""
# Download and extract if necessary
process_url
()
{
process_url
()
{
local
file
=
$1
local
url
=
$2
local
filename
=
${
url
##*/
}
local
ext
=
${
filename
#*.
}
/usr/bin/fetch
-a
-T
30
-q
-o
$file
"
${
url
}
"
...
...
@@ -16,36 +15,6 @@ process_url() {
echo
"Could not download
${
url
}
"
| logger
proc_error
=
"true"
fi
case
"
$ext
"
in
tar
)
mv
$file
$file
.tmp
/usr/bin/tar
-xf
$file
.tmp
-O
>
$file
2> /dev/null
;;
tar.gz
)
mv
$file
$file
.tmp
/usr/bin/tar
-xzf
$file
.tmp
-O
>
$file
2> /dev/null
;;
tgz
)
mv
$file
$file
.tmp
/usr/bin/tar
-xzf
$file
.tmp
-O
>
$file
2> /dev/null
;;
tar.bz2
)
mv
$file
$file
.tmp
/usr/bin/tar
-xjf
$file
.tmp
-O
>
$file
2> /dev/null
;;
*
)
;;
esac
if
[
-f
$file
.tmp
]
;
then
rm
$file
.tmp
fi
if
[
!
-f
$file
]
;
then
echo
"Could not extract
${
filename
}
"
| logger
proc_error
=
"true"
fi
}
echo
"rc.update_bogons is starting up."
| logger
...
...
@@ -60,11 +29,8 @@ fi
echo
"rc.update_bogons is beginning the update cycle."
| logger
# Set default values if not overriden
v4url
=
${
v4url
:-
"https://pkg.opnsense.org/bogons/fullbogons-ipv4.txt"
}
v6url
=
${
v6url
:-
"https://pkg.opnsense.org/bogons/fullbogons-ipv6.txt"
}
v4urlcksum
=
${
v4urlcksum
:-
"
${
v4url
}
.md5"
}
v6urlcksum
=
${
v6urlcksum
:-
"
${
v6url
}
.md5"
}
v4url
=
"https://pkg.opnsense.org/bogons/fullbogons-ipv4.txt"
v6url
=
"https://pkg.opnsense.org/bogons/fullbogons-ipv6.txt"
process_url /tmp/bogons
"
${
v4url
}
"
process_url /tmp/bogonsv6
"
${
v6url
}
"
...
...
@@ -75,9 +41,9 @@ if [ "$proc_error" != "" ]; then
exit
fi
BOGON_V4_CKSUM
=
`
/usr/bin/fetch
-T
30
-q
-o
-
"
${
v4url
cksum
}
"
|
awk
'{ print $4 }'
`
BOGON_V4_CKSUM
=
`
/usr/bin/fetch
-T
30
-q
-o
-
"
${
v4url
}
.md5
"
|
awk
'{ print $4 }'
`
ON_DISK_V4_CKSUM
=
`
md5 /tmp/bogons |
awk
'{ print $4 }'
`
BOGON_V6_CKSUM
=
`
/usr/bin/fetch
-T
30
-q
-o
-
"
${
v6url
cksum
}
"
|
awk
'{ print $4 }'
`
BOGON_V6_CKSUM
=
`
/usr/bin/fetch
-T
30
-q
-o
-
"
${
v6url
}
.md5
"
|
awk
'{ print $4 }'
`
ON_DISK_V6_CKSUM
=
`
md5 /tmp/bogonsv6 |
awk
'{ print $4 }'
`
if
[
"
$BOGON_V4_CKSUM
"
=
"
$ON_DISK_V4_CKSUM
"
]
||
[
"
$BOGON_V6_CKSUM
"
=
"
$ON_DISK_V6_CKSUM
"
]
;
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