惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
T
The Exploit Database - CXSecurity.com
MyScale Blog
MyScale Blog
D
Docker
GbyAI
GbyAI
MongoDB | Blog
MongoDB | Blog
Y
Y Combinator Blog
C
Check Point Blog
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
Vercel News
Vercel News
Engineering at Meta
Engineering at Meta
月光博客
月光博客
Microsoft Azure Blog
Microsoft Azure Blog
Google DeepMind News
Google DeepMind News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Hugging Face - Blog
Hugging Face - Blog
Scott Helme
Scott Helme
C
Cybersecurity and Infrastructure Security Agency CISA
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Archives - TechRepublic
Security Archives - TechRepublic
I
Intezer
P
Proofpoint News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Simon Willison's Weblog
Simon Willison's Weblog
阮一峰的网络日志
阮一峰的网络日志
Project Zero
Project Zero
人人都是产品经理
人人都是产品经理
A
About on SuperTechFans
AWS News Blog
AWS News Blog
T
Tor Project blog
Know Your Adversary
Know Your Adversary
B
Blog
美团技术团队
A
Arctic Wolf
IT之家
IT之家
G
GRAHAM CLULEY
P
Privacy International News Feed
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Cisco Blogs
博客园 - 【当耐特】
V
Visual Studio Blog
T
Threat Research - Cisco Blogs
L
LINUX DO - 热门话题
H
Hacker News: Front Page
PCI Perspectives
PCI Perspectives
Jina AI
Jina AI
腾讯CDC

博客园 - ricks

解决VS Code安装golang相关插件失败问题 努力就会成功(转自左耳朵耗子) 最全科普!你一定要了解的NB-IoT LTE - NAS 驻网流程概括 PLMN概念和应用设置 3GPP R14中的6大NB-IoT增强技术 与程序员相关的CPU缓存知识 IoT协议LwM2M MQTT与CoAP 别让自己“墙”了自己(转自耗子叔) NB-IoT的介绍最终版 !看明白了吗?(转自 top-iot) C语言函数sscanf()的用法 GPRS骨干网逻辑结构 GSM与GPRS的区别 SA vs NSA 打造高效的工作环境 – SHELL 篇 linux下怎么清理缓存 清理系统缓存 iptables禁止某个mac地址上网 iptables的MAC地址过滤
使用iptables基于MAC地址进行访控
ricks · 2019-01-12 · via 博客园 - ricks

近日完成一台基于CentOS的SVN服务器配置,由于该服务器上的文件非常重要,仅部分用户需要访问,最后决定采用iptables来做访控,并且是根据MAC地址来限制,为了便于后期维护,防火墙的配置是通过一个bash脚本来完成的,该脚本内容如下:

#!/bin/bash
iptables=/sbin/iptables
#Flush chains
$iptables –F
#Change the INPUT chains
$iptables -A INPUT -m state --state INVALID -j DROP
$iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
#Read allowed mac from file /root/allow_mac
for i in $(grep -v '^#' /root/allow_mac)
do
    $iptables -A INPUT -m mac --mac-source $i -j ACCEPT
done
#Change the INPUT chain's default Policy to DROP
$iptables -P INPUT DROP

   把允许访问的机器的MAC地址放入文件/root/allow_mac中,每个mac独占一行,然后编辑/etc/rc.local文件让系统在启动的时候执行该防火墙脚本即可。
---------------------
作者:windowsxpwyd
来源:CSDN
原文:https://blog.csdn.net/windowsxpwyd/article/details/6253307
版权声明:本文为博主原创文章,转载请附上博文链接!