{"id":43365,"date":"2026-08-27T11:21:01","date_gmt":"2026-08-27T04:21:01","guid":{"rendered":"https:\/\/interdata.vn\/blog\/?p=43365"},"modified":"2026-08-27T11:21:01","modified_gmt":"2026-08-27T04:21:01","slug":"cai-dat-fail2ban-tren-linux","status":"publish","type":"post","link":"https:\/\/interdata.vn\/blog\/cai-dat-fail2ban-tren-linux\/","title":{"rendered":"H\u01b0\u1edbng D\u1eabn C\u00e0i \u0110\u1eb7t V\u00e0 C\u1ea5u H\u00ecnh Fail2ban Tr\u00ean Linux Ch\u1ed1ng T\u1ea5n C\u00f4ng Brute-Force"},"content":{"rendered":"<p style=\"text-align: justify;\"><span style=\"font-size: 100%;\"><strong>C\u00e0i \u0111\u1eb7t Fail2ban tr\u00ean Linux<\/strong> l\u00e0 gi\u1ea3i ph\u00e1p thi\u1ebft y\u1ebfu \u0111\u1ec3 ng\u0103n ch\u1eb7n tin t\u1eb7c qu\u00e9t c\u1ed5ng v\u00e0 d\u00f2 m\u1eadt kh\u1ea9u h\u1ec7 th\u1ed1ng. Khi v\u1eeba tri\u1ec3n khai m\u00e1y ch\u1ee7, c\u1ed5ng SSH m\u1eb7c \u0111\u1ecbnh th\u01b0\u1eddng xuy\u00ean b\u1ecb t\u1ea5n c\u00f4ng d\u00f2 qu\u00e9t li\u00ean t\u1ee5c khi\u1ebfn t\u00e0i nguy\u00ean qu\u00e1 t\u1ea3i v\u00e0 t\u0103ng r\u1ee7i ro l\u1ed9 quy\u1ec1n qu\u1ea3n tr\u1ecb. B\u00e0i vi\u1ebft n\u00e0y t\u1eeb \u0111\u1ed9i ng\u0169 k\u1ef9 thu\u1eadt <a href=\"https:\/\/interdata.vn\/\" target=\"_blank\" rel=\"noopener\">InterData<\/a> s\u1ebd h\u01b0\u1edbng d\u1eabn chi ti\u1ebft t\u1eebng b\u01b0\u1edbc thi\u1ebft l\u1eadp v\u00e0 c\u1ea5u h\u00ecnh Fail2ban \u0111\u1ec3 b\u1ea3o v\u1ec7 h\u1ea1 t\u1ea7ng m\u00e1y ch\u1ee7 c\u1ee7a b\u1ea1n an to\u00e0n.<\/span><\/p>\n<div style=\"background-color: #eff6ff; padding: 20px; border: 1.5px solid #BFDBFE; border-radius: 12px; margin-bottom: 40px; box-shadow: 0 8px 20px rgba(37,99,235,0.05);\">\n<p style=\"font-family: 'Be Vietnam Pro', sans-serif; font-weight: bold; font-size: 18px; margin: 0 0 15px; color: #1e3a8a;\">N\u1ed8I DUNG B\u00c0I VI\u1ebeT<\/p>\n<ul style=\"list-style-type: none; padding-left: 0; margin: 0;\">\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section1\">1. Fail2ban l\u00e0 g\u00ec v\u00e0 c\u01a1 ch\u1ebf ch\u1eb7n brute-force tr\u00ean Linux?<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section2\">2. Y\u00eau c\u1ea7u chu\u1ea9n b\u1ecb tr\u01b0\u1edbc khi c\u00e0i \u0111\u1eb7t Fail2ban<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section3\">3. H\u01b0\u1edbng d\u1eabn c\u00e0i \u0111\u1eb7t Fail2ban tr\u00ean Linux: Ubuntu v\u00e0 Debian<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section4\">4. H\u01b0\u1edbng d\u1eabn c\u00e0i \u0111\u1eb7t Fail2ban tr\u00ean Linux: CentOS, RHEL v\u00e0 AlmaLinux<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section5\">5. C\u1ea5u h\u00ecnh sau khi c\u00e0i \u0111\u1eb7t Fail2ban tr\u00ean Linux: T\u00f9y bi\u1ebfn jail.local<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section6\">6. C\u1ea5u h\u00ecnh Fail2ban n\u00e2ng cao: Recidive, Custom Filter v\u00e0 Email Alert<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section7\">7. Qu\u1ea3n l\u00fd tr\u1ea1ng th\u00e1i v\u00e0 x\u1eed l\u00fd s\u1ef1 c\u1ed1 th\u01b0\u1eddng g\u1eb7p<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section8\">8. So s\u00e1nh Fail2ban v\u00e0 CSF Firewall<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section9\">9. Checklist b\u1ea3o m\u1eadt m\u00e1y ch\u1ee7 sau khi c\u1ea5u h\u00ecnh Fail2ban<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#faq\">FAQ \u2014 C\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p<\/a><\/li>\n<\/ul>\n<\/div>\n\n\n<style>\n.interdata-plan-carousel,.interdata-plan-carousel *{box-sizing:border-box}\n.interdata-plan-carousel{--blue:#005bea;--blue-dark:#004dcc;--text:#071832;--muted:#516173;--border:#d8e6fb;--bg:#f3f8ff;--shadow:0 5px 14px rgba(0,62,145,.08);background:var(--bg);padding:14px 56px 18px;position:relative;overflow:hidden;border-radius:20px;}\n.interdata-carousel-heading{color:#f00;font-family:Roboto,sans-serif;font-size:18px;line-height:1.35;font-weight:800;text-align:center;margin:0 0 14px}\n.interdata-plan-viewport{overflow:hidden;width:100%}\n.interdata-plan-track{display:flex;align-items:stretch;gap:12px;overflow:visible;padding:0 0 4px;transform:translate3d(0,0,0);transition:transform .45s ease;will-change:transform;touch-action:pan-y}\n.interdata-plan-card{flex:0 0 calc((100% - 24px)\/3);min-width:0;min-height:0!important;height:auto;background:#fff;border:1px solid var(--border);border-radius:8px;padding:15px 12px 13px;display:flex;flex-direction:column;box-shadow:var(--shadow)}\n.interdata-plan-title{color:var(--blue-dark);font-size:16px;line-height:1.22;font-weight:800;text-align:center;margin:0 0 7px;text-transform:uppercase;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.interdata-plan-price{color:var(--blue-dark);font-size:24px;line-height:1;font-weight:900;text-align:center;margin-bottom:12px;white-space:nowrap;letter-spacing:0}\n.interdata-plan-price span{font-size:10px;font-weight:800;margin-left:2px}\n.interdata-plan-badge{align-self:center;display:inline-flex;align-items:center;justify-content:center;background:#ff3934;color:#fff;border-radius:5px;padding:7px 8px;font-size:9px;line-height:1;font-weight:800;margin-bottom:15px;white-space:nowrap;max-width:100%}\n.interdata-plan-features{list-style:none!important;padding:0!important;margin:0!important}\n.interdata-plan-features li{display:flex;gap:7px;align-items:flex-start;color:var(--text);font-size:12px;line-height:1.35;font-weight:700;text-align:left;margin:0 0 10px!important;padding:0!important}\n.interdata-plan-icon{width:14px;min-width:14px;height:14px;color:#0069ff;margin-top:2px}\n.interdata-plan-icon svg{display:block;width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}\n.interdata-plan-spacer{flex:1;min-height:16px}\n.interdata-plan-button{display:flex;align-items:center;justify-content:center;min-height:42px;width:100%;margin-top:auto!important;margin-bottom:0!important;background:var(--blue);color:#fff!important;border-radius:5px;font-size:13px;font-weight:800;text-decoration:none!important;box-shadow:0 7px 14px rgba(0,91,234,.24);transition:transform .2s ease,background .2s ease}\n.interdata-plan-button:hover{background:var(--blue-dark);color:#fff!important;transform:translateY(-1px)}\n.interdata-carousel-arrow{position:absolute;top:50%;z-index:5;width:44px;height:54px;border:2px solid #fff!important;border-radius:999px;background:var(--blue)!important;color:#fff!important;box-shadow:0 8px 22px rgba(0,62,145,.32);display:flex!important;align-items:center;justify-content:center;cursor:pointer;transform:translateY(-35%);transition:background .2s ease,color .2s ease,opacity .2s ease,transform .2s ease}\n.interdata-carousel-arrow:hover{background:var(--blue-dark)!important;color:#fff!important;transform:translateY(-35%) scale(1.04)}\n.interdata-carousel-arrow:disabled{opacity:.78;cursor:not-allowed;background:#8aa6cf!important;color:#fff!important}\n.interdata-carousel-arrow:disabled:hover{background:#8aa6cf!important;color:#fff!important;transform:translateY(-35%)}\n.interdata-carousel-arrow svg{display:none!important}\n.interdata-carousel-arrow:before{content:none!important;display:none!important}\n.interdata-carousel-mark{display:block!important;color:#fff!important;font-family:Arial,Helvetica,sans-serif!important;font-size:38px!important;font-weight:900!important;line-height:1!important;text-align:center!important;pointer-events:none!important;transform:translateY(-2px)}\n.interdata-carousel-prev{left:14px}\n.interdata-carousel-prev .interdata-carousel-mark{margin-left:-2px}\n.interdata-carousel-next{right:14px}\n.interdata-carousel-next .interdata-carousel-mark{margin-right:-2px}\n@media (max-width:800px){.interdata-plan-carousel{padding:12px 44px 16px}.interdata-plan-card{flex-basis:calc((100% - 12px)\/2)}.interdata-carousel-heading{font-size:16px}.interdata-carousel-prev{left:6px}.interdata-carousel-next{right:6px}}\n@media (max-width:480px){.interdata-plan-carousel{padding:12px 38px 16px}.interdata-plan-card{flex-basis:100%}.interdata-plan-price{font-size:23px}.interdata-carousel-arrow{width:34px;height:44px}.interdata-carousel-mark{font-size:32px!important}.interdata-carousel-prev{left:3px}.interdata-carousel-next{right:3px}}\n<\/style>\n\n<div class=\"interdata-plan-carousel\" data-interdata-carousel>\n  <div class=\"interdata-carousel-heading\">Si\u00eau \u01afu \u0110\u00e3i VPS \/ CLOUD SERVER - Ti\u1ebft Ki\u1ec7m \u0110\u1ebfn 70%<\/div>\n\n  <svg width=\"0\" height=\"0\" style=\"position:absolute;visibility:hidden\" aria-hidden=\"true\">\n    <symbol id=\"id-icon-cpu\" viewBox=\"0 0 24 24\"><rect x=\"7\" y=\"7\" width=\"10\" height=\"10\" rx=\"2\"><\/rect><path d=\"M4 9h3M4 15h3M17 9h3M17 15h3M9 4v3M15 4v3M9 17v3M15 17v3\"><\/path><path d=\"M10 10h4v4h-4z\"><\/path><\/symbol>\n    <symbol id=\"id-icon-ram\" viewBox=\"0 0 24 24\"><rect x=\"4\" y=\"8\" width=\"16\" height=\"8\" rx=\"2\"><\/rect><path d=\"M7 16v2M11 16v2M15 16v2M19 16v2M7 11h1M11 11h1M15 11h1\"><\/path><\/symbol>\n    <symbol id=\"id-icon-storage\" viewBox=\"0 0 24 24\"><rect x=\"6\" y=\"3\" width=\"12\" height=\"18\" rx=\"2\"><\/rect><path d=\"M9 7h6\"><\/path><circle cx=\"12\" cy=\"16\" r=\"1.5\"><\/circle><\/symbol>\n    <symbol id=\"id-icon-network\" viewBox=\"0 0 24 24\"><path d=\"M5 12.5a10 10 0 0 1 14 0\"><\/path><path d=\"M8.5 16a5 5 0 0 1 7 0\"><\/path><path d=\"M12 19h.01\"><\/path><\/symbol>\n    <symbol id=\"id-icon-gift\" viewBox=\"0 0 24 24\"><rect x=\"3\" y=\"8\" width=\"18\" height=\"13\" rx=\"2\"><\/rect><path d=\"M12 8v13M3 12h18\"><\/path><path d=\"M7.5 8C6.1 8 5 6.9 5 5.5S6.1 3 7.5 3C10 3 12 8 12 8\"><\/path><path d=\"M16.5 8C17.9 8 19 6.9 19 5.5S17.9 3 16.5 3C14 3 12 8 12 8\"><\/path><\/symbol>\n  <\/svg>\n\n  <button class=\"interdata-carousel-arrow interdata-carousel-prev\" type=\"button\" aria-label=\"Xem 3 g\u00f3i tr\u01b0\u1edbc\" onclick=\"var r=this.closest('[data-interdata-carousel]');if(!r)return false;var t=r.querySelector('.interdata-plan-track'),c=t?t.querySelectorAll('.interdata-plan-card'):[];if(!t||!c.length)return false;var v=window.matchMedia('(max-width:480px)').matches?1:(window.matchMedia('(max-width:800px)').matches?2:3),m=Math.max(0,c.length-Math.min(v,c.length||1)),s=[],i=0;while(i&lt;m){s.push(i);i+=v}if(!s.length||s[s.length-1]!==m)s.push(m);var p=parseInt(r.getAttribute('data-inline-page')||'0',10);p=(p-1+s.length)%s.length;r.setAttribute('data-inline-page',p);var g=parseFloat(window.getComputedStyle(t).gap)||12,w=c[0].getBoundingClientRect().width;t.style.transition='transform .45s ease';t.style.transform='translate3d('+(-(w+g)*s[p])+'px,0,0)';return false;\">\n    <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M15 18l-6-6 6-6\"><\/path><\/svg>\n    <span class=\"interdata-carousel-mark\" aria-hidden=\"true\">&#8249;<\/span>\n  <\/button>\n\n  <div class=\"interdata-plan-viewport\">\n    <div class=\"interdata-plan-track\">\n      <!-- 7 card d\u1ef1 ph\u00f2ng: JavaScript s\u1ebd \u0111\u1ed3ng b\u1ed9 l\u1ea1i t\u1eeb API portal khi trang t\u1ea3i. -->\n      <article class=\"interdata-plan-card\" data-plan-pid=\"490\">\n        <h3 class=\"interdata-plan-title\">Premium Base<\/h3>\n        <div class=\"interdata-plan-price\">299.000 \u0111<span>\/3 th\u00e1ng<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>2 vCore Intel Xeon Scalable<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>2 GB <a href=\"https:\/\/interdata.vn\/blog\/ram-server\/\">RAM<\/a><\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>30 GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>1 IPv4 Private<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>300Mbps Network Port<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Unlimited Bandwidth<\/li>\n        <\/ul>\n\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/best-value-plans-2026\/best-value-plans-premium-base\" target=\"_blank\" rel=\"noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\" data-plan-pid=\"529\">\n        <h3 class=\"interdata-plan-title\">INTER PLATINUM 1<\/h3>\n        <div class=\"interdata-plan-price\">998.000 \u0111<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>2 vCore<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>3 GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>30 GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>1 IPv4 Private<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>300Mbps Network Port<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Unlimited Bandwidth<\/li>\n        <\/ul>\n\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/inter-platinum-series-2026\/inter-platinum-1\" target=\"_blank\" rel=\"noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\" data-plan-pid=\"530\">\n        <h3 class=\"interdata-plan-title\">INTER PLATINUM 2<\/h3>\n        <div class=\"interdata-plan-price\">2.666.000 \u0111<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>5 vCore<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>8 GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>70 GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>1 IPv4 Private<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>300Mbps Network Port<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Unlimited Bandwidth<\/li>\n        <\/ul>\n\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/inter-platinum-series-2026\/inter-platinum-2\" target=\"_blank\" rel=\"noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\" data-plan-pid=\"531\">\n        <h3 class=\"interdata-plan-title\">INTER PLATINUM 3<\/h3>\n        <div class=\"interdata-plan-price\">5.888.000 \u0111<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>9 vCore<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>16 GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>140 GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>1 IPv4 Private<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>300Mbps Network Port<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Unlimited Bandwidth<\/li>\n        <\/ul>\n\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/inter-platinum-series-2026\/inter-platinum-3\" target=\"_blank\" rel=\"noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\" data-plan-pid=\"521\">\n        <h3 class=\"interdata-plan-title\">BD-Cloud 1<\/h3>\n        <div class=\"interdata-plan-price\">988.000 \u0111<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>3 vCore<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>3 GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>30 GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>1 IPv4 Private<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>300Mbps Network Port<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Unlimited Bandwidth<\/li>\n        <\/ul>\n\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/best-plan-real-cloud\/bd-cloud-1\" target=\"_blank\" rel=\"noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\" data-plan-pid=\"522\">\n        <h3 class=\"interdata-plan-title\">BD-Cloud 2<\/h3>\n        <div class=\"interdata-plan-price\">2.988.000 \u0111<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>4 vCore<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>8 GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>80 GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>1 IPv4 Private<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>300 Mbps Network Port<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Unlimited Bandwidth<\/li>\n        <\/ul>\n\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/best-plan-real-cloud\/bd-cloud-2\" target=\"_blank\" rel=\"noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\" data-plan-pid=\"523\">\n        <h3 class=\"interdata-plan-title\">BD-Cloud 3<\/h3>\n        <div class=\"interdata-plan-price\">5.999.000 \u0111<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>8 vCore<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>16 GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>140 GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>1 IPv4 Private<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>400 Mbps Network Port<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Unlimited Bandwidth<\/li>\n        <\/ul>\n\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/best-plan-real-cloud\/bd-cloud-3\" target=\"_blank\" rel=\"noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n    <\/div>\n  <\/div>\n\n  <button class=\"interdata-carousel-arrow interdata-carousel-next\" type=\"button\" aria-label=\"Xem 3 g\u00f3i ti\u1ebfp theo\" onclick=\"var r=this.closest('[data-interdata-carousel]');if(!r)return false;var t=r.querySelector('.interdata-plan-track'),c=t?t.querySelectorAll('.interdata-plan-card'):[];if(!t||!c.length)return false;var v=window.matchMedia('(max-width:480px)').matches?1:(window.matchMedia('(max-width:800px)').matches?2:3),m=Math.max(0,c.length-Math.min(v,c.length||1)),s=[],i=0;while(i&lt;m){s.push(i);i+=v}if(!s.length||s[s.length-1]!==m)s.push(m);var p=parseInt(r.getAttribute('data-inline-page')||'0',10);p=(p+1)%s.length;r.setAttribute('data-inline-page',p);var g=parseFloat(window.getComputedStyle(t).gap)||12,w=c[0].getBoundingClientRect().width;t.style.transition='transform .45s ease';t.style.transform='translate3d('+(-(w+g)*s[p])+'px,0,0)';return false;\">\n    <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M9 18l6-6-6-6\"><\/path><\/svg>\n    <span class=\"interdata-carousel-mark\" aria-hidden=\"true\">&#8250;<\/span>\n  <\/button>\n<\/div>\n\n<script>\n(function(){\n  var API_GROUPS=[\n    {url:'https:\/\/support.interdata.vn\/packages.php?gid=89&module',pids:[490]},\n    {url:'https:\/\/support.interdata.vn\/packages.php?gid=100&module',pids:[529,530,531]},\n    {url:'https:\/\/support.interdata.vn\/packages.php?gid=97&module',pids:[521,522,523]}\n  ];\n  var PLAN_CYCLES={\n    490:{key:'quarterly',label:'3 th\u00e1ng'},\n    529:{key:'annually',label:'n\u0103m'},\n    530:{key:'annually',label:'n\u0103m'},\n    531:{key:'annually',label:'n\u0103m'},\n    521:{key:'annually',label:'n\u0103m'},\n    522:{key:'annually',label:'n\u0103m'},\n    523:{key:'annually',label:'n\u0103m'}\n  };\n\n  function fetchPlanData(){\n    if(window.interdataPlanApiPromise)return window.interdataPlanApiPromise;\n\n    window.interdataPlanApiPromise=Promise.all(API_GROUPS.map(function(group){\n      return fetch(group.url,{method:'GET',mode:'cors',cache:'no-store'})\n        .then(function(response){\n          if(!response.ok)throw new Error('API '+response.status);\n          return response.json();\n        })\n        .then(function(data){\n          if(!data||data.success!==true||!Array.isArray(data.products))return [];\n          return data.products.filter(function(product){\n            return group.pids.indexOf(Number(product.pid))!==-1;\n          });\n        })\n        .catch(function(error){\n          console.warn('Kh\u00f4ng th\u1ec3 c\u1eadp nh\u1eadt nh\u00f3m g\u00f3i InterData:',group.url,error);\n          return [];\n        });\n    })).then(function(groups){\n      return groups.reduce(function(all,products){return all.concat(products);},[]);\n    });\n\n    return window.interdataPlanApiPromise;\n  }\n\n  function parseDescription(html){\n    var source=String(html||'')\n      .replace(\/<brs*\/?>\/gi,'n')\n      .replace(\/<\/(p|div|li)>\/gi,'n');\n    var holder=document.createElement('div');\n    holder.innerHTML=source;\n    var strong=holder.querySelector('strong');\n    var badge=strong?strong.textContent.trim():'';\n    var lines=(holder.textContent||'').split(\/r?n\/).map(function(line){\n      return line.trim();\n    }).filter(Boolean);\n    if(badge&&lines[0]===badge)lines.shift();\n    return {badge:badge,features:lines};\n  }\n\n  function iconForFeature(feature){\n    if(\/ram\/i.test(feature))return 'id-icon-ram';\n    if(\/ssd|nvme|storage|disk\/i.test(feature))return 'id-icon-storage';\n    if(\/vcore|vcpu|cpu|xeon|amd\/i.test(feature))return 'id-icon-cpu';\n    if(\/ipv4|network|mbps|gbps|bandwidth\/i.test(feature))return 'id-icon-network';\n    return 'id-icon-gift';\n  }\n\n  function createFeatureItem(feature){\n    var item=document.createElement('li');\n    var icon=document.createElement('span');\n    var svg=document.createElementNS('http:\/\/www.w3.org\/2000\/svg','svg');\n    var use=document.createElementNS('http:\/\/www.w3.org\/2000\/svg','use');\n    icon.className='interdata-plan-icon';\n    use.setAttribute('href','#'+iconForFeature(feature));\n    svg.appendChild(use);\n    icon.appendChild(svg);\n    item.appendChild(icon);\n    item.appendChild(document.createTextNode(feature));\n    return item;\n  }\n\n  function updateCardFromApi(root,product){\n    var pid=Number(product.pid);\n    var cycle=PLAN_CYCLES[pid];\n    var card=root.querySelector('[data-plan-pid=\"'+pid+'\"]');\n    if(!card||!cycle)return;\n\n    var title=card.querySelector('.interdata-plan-title');\n    var priceBox=card.querySelector('.interdata-plan-price');\n    var badgeBox=card.querySelector('.interdata-plan-badge');\n    var featureList=card.querySelector('.interdata-plan-features');\n    var button=card.querySelector('.interdata-plan-button');\n    var description=parseDescription(product.description);\n    var pricing=product.pricing&&product.pricing.VND;\n    var price=pricing?Number(pricing[cycle.key]):-1;\n\n    if(title&&product.name)title.textContent=product.name;\n    if(priceBox&&Number.isFinite(price)&&price>=0){\n      priceBox.textContent=Math.round(price).toLocaleString('vi-VN')+' \u0111';\n      var suffix=document.createElement('span');\n      suffix.textContent='\/'+cycle.label;\n      priceBox.appendChild(suffix);\n    }\n    if(badgeBox&&description.badge)badgeBox.textContent=description.badge;\n    if(featureList&&description.features.length){\n      featureList.textContent='';\n      description.features.forEach(function(feature){\n        featureList.appendChild(createFeatureItem(feature));\n      });\n    }\n    if(button&&product.product_url)button.href=product.product_url;\n  }\n\n  function setupInterDataCarousel(root){\n    var track=root.querySelector('.interdata-plan-track');\n    var prev=root.querySelector('.interdata-carousel-prev');\n    var next=root.querySelector('.interdata-carousel-next');\n    if(!track||!prev||!next||track.dataset.ready==='1')return;\n    track.dataset.ready='1';\n    prev.disabled=false;\n    next.disabled=false;\n    var activePage=0;\n    var touchStartX=null;\n\n    function visibleCards(){\n      if(window.matchMedia&&window.matchMedia('(max-width:480px)').matches)return 1;\n      if(window.matchMedia&&window.matchMedia('(max-width:800px)').matches)return 2;\n      return 3;\n    }\n\n    function pageStarts(){\n      var total=track.querySelectorAll('.interdata-plan-card').length;\n      var visible=Math.min(visibleCards(),total||1);\n      var maxStart=Math.max(0,total-visible);\n      var starts=[];\n      var start=0;\n      while(start<maxStart){\n        starts.push(start);\n        start+=visible;\n      }\n      if(!starts.length||starts[starts.length-1]!==maxStart)starts.push(maxStart);\n      return starts;\n    }\n\n    function renderSlide(animate){\n      var cards=track.querySelectorAll('.interdata-plan-card');\n      var starts=pageStarts();\n      if(!cards.length||!starts.length)return;\n      if(activePage>=starts.length)activePage=starts.length-1;\n      if(activePage<0)activePage=0;\n\n      var cardWidth=cards[0].getBoundingClientRect().width;\n      var trackStyle=window.getComputedStyle?window.getComputedStyle(track):null;\n      var gap=trackStyle?parseFloat(trackStyle.columnGap||trackStyle.gap):12;\n      if(!Number.isFinite(gap))gap=12;\n      if(cardWidth<=0)return;\n\n      track.style.transition=animate?'transform .45s ease':'none';\n      track.style.transform='translate3d('+(-(cardWidth+gap)*starts[activePage])+'px,0,0)';\n      prev.setAttribute('aria-disabled',starts.length>1?'false':'true');\n      next.setAttribute('aria-disabled',starts.length>1?'false':'true');\n    }\n\n    function move(direction){\n      var starts=pageStarts();\n      if(starts.length<=1)return;\n      activePage=parseInt(root.getAttribute('data-inline-page')||activePage,10)||0;\n      activePage=(activePage+direction+starts.length)%starts.length;\n      root.setAttribute('data-inline-page',activePage);\n      renderSlide(true);\n    }\n\n    track.addEventListener('touchstart',function(event){\n      touchStartX=event.touches&&event.touches[0]?event.touches[0].clientX:null;\n    },{passive:true});\n    track.addEventListener('touchend',function(event){\n      if(touchStartX===null)return;\n      var endX=event.changedTouches&&event.changedTouches[0]?event.changedTouches[0].clientX:touchStartX;\n      var distance=endX-touchStartX;\n      touchStartX=null;\n      if(Math.abs(distance)>=40)move(distance<0?1:-1);\n    },{passive:true});\n\n    function resetAfterResize(){\n      activePage=0;\n      root.setAttribute('data-inline-page','0');\n      renderSlide(false);\n    }\n\n    window.addEventListener('resize',resetAfterResize);\n    window.addEventListener('load',resetAfterResize);\n    if('ResizeObserver' in window){\n      var resizeObserver=new ResizeObserver(function(){renderSlide(false);});\n      resizeObserver.observe(root);\n    }\n    window.requestAnimationFrame(function(){renderSlide(false);});\n    window.setTimeout(function(){renderSlide(false);},250);\n    window.setTimeout(function(){renderSlide(false);},1000);\n\n    fetchPlanData().then(function(products){\n      products.forEach(function(product){updateCardFromApi(root,product);});\n      renderSlide(false);\n    });\n  }\n\n  function initInterDataCarousels(){\n    document.querySelectorAll('[data-interdata-carousel]').forEach(setupInterDataCarousel);\n  }\n\n  if(document.readyState==='loading'){\n    document.addEventListener('DOMContentLoaded',initInterDataCarousels);\n  }else{\n    initInterDataCarousels();\n  }\n\n  if('MutationObserver' in window){\n    var initQueued=false;\n    new MutationObserver(function(){\n      if(initQueued)return;\n      initQueued=true;\n      window.requestAnimationFrame(function(){\n        initQueued=false;\n        initInterDataCarousels();\n      });\n    }).observe(document.documentElement,{childList:true,subtree:true});\n  }\n})();\n<\/script>\n\n\t<div id=\"gap-2037242023\" class=\"gap-element clearfix\" style=\"display:block; height:auto;\">\n\t\t\n<style>\n#gap-2037242023 {\n  padding-top: 15px;\n}\n<\/style>\n\t<\/div>\n\t\n<h2 id=\"section1\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin: 40px 0 20px; line-height: 1.4;\">1. Fail2ban l\u00e0 g\u00ec v\u00e0 c\u01a1 ch\u1ebf ch\u1eb7n brute-force tr\u00ean Linux?<\/h2>\n<p style=\"text-align: justify;\">Fail2ban l\u00e0 ph\u1ea7n m\u1ec1m b\u1ea3o m\u1eadt m\u00e3 ngu\u1ed3n m\u1edf vi\u1ebft b\u1eb1ng ng\u00f4n ng\u1eef Python, chuy\u00ean gi\u00e1m s\u00e1t file log h\u1ec7 th\u1ed1ng \u0111\u1ec3 ph\u00e1t hi\u1ec7n c\u00e1c h\u00e0nh vi x\u00e1c th\u1ef1c th\u1ea5t b\u1ea1i l\u1eb7p \u0111i l\u1eb7p l\u1ea1i. Khi m\u1ed9t \u0111\u1ecba ch\u1ec9 IP v\u01b0\u1ee3t qu\u00e1 ng\u01b0\u1ee1ng th\u1eed cho ph\u00e9p, Fail2ban s\u1ebd t\u1ef1 \u0111\u1ed9ng th\u00eam quy t\u1eafc v\u00e0o t\u01b0\u1eddng l\u1eeda \u0111\u1ec3 kh\u00f3a k\u1ebft n\u1ed1i t\u1eeb IP \u0111\u00f3 trong m\u1ed9t kho\u1ea3ng th\u1eddi gian nh\u1ea5t \u0111\u1ecbnh.<\/p>\n<p style=\"text-align: justify;\">\u0110\u1ec3 hi\u1ec3u s\u00e2u h\u01a1n v\u1ec1 ki\u1ebfn tr\u00fac \u1ee9ng d\u1ee5ng n\u00e0y, b\u1ea1n c\u00f3 th\u1ec3 tham kh\u1ea3o b\u00e0i vi\u1ebft <a href=\"https:\/\/interdata.vn\/blog\/fail2ban-la-gi\/\">Fail2ban<\/a> \u0111\u1ec3 n\u1eafm c\u1ea5u tr\u00fac chi ti\u1ebft t\u1eebng th\u00e0nh ph\u1ea7n. B\u1ea3n ch\u1ea5t c\u00f4ng c\u1ee5 n\u00e0y sinh ra nh\u1eb1m gi\u1ea3m thi\u1ec3u t\u1ed1i \u0111a h\u00ecnh th\u1ee9c t\u1ea5n c\u00f4ng <a href=\"https:\/\/interdata.vn\/blog\/brute-force-la-gi\/\">Brute Force<\/a>, k\u1ef9 thu\u1eadt m\u00e0 botnet t\u1ef1 \u0111\u1ed9ng s\u1eed d\u1ee5ng t\u1eeb \u0111i\u1ec3n \u0111\u1ec3 th\u1eed h\u00e0ng tri\u1ec7u c\u1eb7p t\u00e0i kho\u1ea3n v\u00e0 m\u1eadt kh\u1ea9u truy c\u1eadp qua c\u1ed5ng <a href=\"https:\/\/interdata.vn\/blog\/ssh-la-gi\/\">SSH<\/a> c\u1ee7a m\u00e1y ch\u1ee7.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-43378\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/fail2ban-la-gi.png\" alt=\"fail2ban l\u00e0 g\u00ec\" width=\"742\" height=\"296\" title=\"\" srcset=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/fail2ban-la-gi.png 742w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/fail2ban-la-gi-300x120.png 300w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/p>\n<p style=\"text-align: justify;\">Quy tr\u00ecnh v\u1eadn h\u00e0nh chu\u1ea9n c\u1ee7a Fail2ban di\u1ec5n ra qua 3 b\u01b0\u1edbc kh\u00e9p k\u00edn:<\/p>\n<ul>\n<li style=\"margin-bottom: 8px;\"><strong>Gi\u00e1m s\u00e1t file log (Log Monitoring):<\/strong> Ti\u1ebfn tr\u00ecnh daemon c\u1ee7a Fail2ban theo d\u00f5i li\u00ean t\u1ee5c c\u00e1c t\u1ec7p nh\u1eadt k\u00fd nh\u01b0 <code>\/var\/log\/auth.log<\/code> (Ubuntu\/Debian) ho\u1eb7c <code>\/var\/log\/secure<\/code> (CentOS\/AlmaLinux).<\/li>\n<li style=\"margin-bottom: 8px;\"><strong>Kh\u1edbp m\u1eabu bi\u1ec3u th\u1ee9c ch\u00ednh quy (Regex Matching):<\/strong> Fail2ban s\u1eed d\u1ee5ng c\u00e1c b\u1ed9 l\u1ecdc (filter) \u0111\u1ecbnh s\u1eb5n \u0111\u1ec3 t\u00ecm chu\u1ed7i c\u1ea3nh b\u00e1o \u0111\u0103ng nh\u1eadp l\u1ed7i nh\u01b0 &#8220;Failed password&#8221;, &#8220;authentication failure&#8221; ho\u1eb7c &#8220;Invalid user&#8221;.<\/li>\n<li style=\"margin-bottom: 8px;\"><strong>Th\u1ef1c thi h\u00e0nh \u0111\u1ed9ng qua t\u01b0\u1eddng l\u1eeda (Action Trigger):<\/strong> Khi s\u1ed1 l\u1ea7n th\u1eed l\u1ed7i c\u1ee7a m\u1ed9t IP ch\u1ea1m ng\u01b0\u1ee1ng <code>maxretry<\/code> trong c\u1eeda s\u1ed5 th\u1eddi gian <code>findtime<\/code>, Fail2ban g\u1ecdi ch\u1ec9 th\u1ecb firewall \u0111\u1ec3 drop ho\u1eb7c reject g\u00f3i tin \u0111\u1ebfn t\u1eeb \u0111\u1ecba ch\u1ec9 IP vi ph\u1ea1m.<\/li>\n<\/ul>\n<div style=\"display: flex; flex-wrap: wrap; background-color: #fff; border: 1.5px solid #BFDBFE; box-shadow: 0 8px 20px rgba(37,99,235,0.08); border-radius: 12px; overflow: hidden; margin: 35px 0;\">\n<div style=\"flex: 1; min-width: 250px; background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 100%); display: flex; align-items: center; justify-content: center; padding: 30px; text-align: center;\">\n<div>\n<p style=\"color: #fff; font-size: 34px; font-family: 'Be Vietnam Pro', sans-serif; font-weight: bold; margin: 0; line-height: 1.1;\">Thu\u00ea VPS InterData<\/p>\n<p style=\"color: #dbeafe; font-size: 15px; font-weight: 600; margin-top: 12px;\">CPU th\u1ebf h\u1ec7 m\u1edbi, SSD NVMe U.2, h\u1ed7 tr\u1ee3 k\u1ef9 thu\u1eadt 24\/7<\/p>\n<\/div>\n<\/div>\n<div style=\"flex: 2; padding: 25px; min-width: 300px;\">\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 0; font-size: 20px;\">C\u1ea7n VPS c\u00f3 quy\u1ec1n root \u0111\u1ec3 t\u1ef1 c\u00e0i Fail2ban b\u1ea3o m\u1eadt server?<\/h3>\n<p style=\"text-align: justify; font-size: 15px; margin-bottom: 15px;\">\u0110\u1ec3 tri\u1ec3n khai Fail2ban, ch\u1ec9nh s\u1eeda iptables v\u00e0 ki\u1ec3m so\u00e1t ch\u00ednh s\u00e1ch b\u1ea3o m\u1eadt, b\u1ea1n c\u1ea7n m\u1ed9t m\u00f4i tr\u01b0\u1eddng <a href=\"https:\/\/interdata.vn\/blog\/vps-la-gi\/\">m\u00e1y ch\u1ee7 \u1ea3o VPS<\/a> c\u00f3 to\u00e0n quy\u1ec1n root tr\u00ean n\u1ec1n t\u1ea3ng <a href=\"https:\/\/interdata.vn\/blog\/linux-la-gi\/\">h\u1ec7 \u0111i\u1ec1u h\u00e0nh Linux<\/a>. VPS InterData cung c\u1ea5p quy\u1ec1n truy c\u1eadp qu\u1ea3n tr\u1ecb cao nh\u1ea5t tr\u00ean \u0111a d\u1ea1ng b\u1ea3n ph\u00e2n ph\u1ed1i Ubuntu, CentOS, AlmaLinux.<\/p>\n<p><a style=\"background: linear-gradient(90deg, #2563EB 0%, #1E3A8A 100%); color: #fff; padding: 12px 25px; text-decoration: none; font-weight: 600; border-radius: 8px; font-size: 15px; display: inline-block; box-shadow: 0 5px 15px rgba(37,99,235,0.3);\" href=\"https:\/\/interdata.vn\/thue-vps\/\" target=\"_blank\" rel=\"noopener\">Xem B\u1ea3ng Gi\u00e1 Thu\u00ea VPS \u27f6<\/a><\/p>\n<\/div>\n<\/div>\n<h2 id=\"section2\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin: 40px 0 20px; line-height: 1.4;\">2. Y\u00eau c\u1ea7u chu\u1ea9n b\u1ecb tr\u01b0\u1edbc khi c\u00e0i \u0111\u1eb7t Fail2ban<\/h2>\n<p style=\"text-align: justify;\">Tr\u01b0\u1edbc khi ti\u1ebfn h\u00e0nh c\u00e0i \u0111\u1eb7t, b\u1ea1n c\u1ea7n \u0111\u1ea3m b\u1ea3o h\u1ec7 th\u1ed1ng m\u00e1y ch\u1ee7 \u0111\u00e1p \u1ee9ng \u0111\u1ea7y \u0111\u1ee7 c\u00e1c \u0111i\u1ec1u ki\u1ec7n ti\u00ean quy\u1ebft d\u01b0\u1edbi \u0111\u00e2y nh\u1eb1m tr\u00e1nh t\u00ecnh tr\u1ea1ng xung \u0111\u1ed9t d\u1ecbch v\u1ee5 m\u1ea1ng:<\/p>\n<ul>\n<li style=\"margin-bottom: 8px;\"><strong>T\u00e0i kho\u1ea3n c\u00f3 quy\u1ec1n Root:<\/strong> B\u1ea1n ph\u1ea3i \u0111\u0103ng nh\u1eadp b\u1eb1ng t\u00e0i kho\u1ea3n <code>root<\/code> ho\u1eb7c t\u00e0i kho\u1ea3n ng\u01b0\u1eddi d\u00f9ng c\u00f3 quy\u1ec1n th\u1ef1c thi qua <code>sudo<\/code>.<\/li>\n<li style=\"margin-bottom: 8px;\"><strong>T\u01b0\u1eddng l\u1eeda \u0111ang ho\u1ea1t \u0111\u1ed9ng:<\/strong> M\u00e1y ch\u1ee7 c\u1ea7n k\u00edch ho\u1ea1t s\u1eb5n t\u01b0\u1eddng l\u1eeda t\u1ea7ng m\u1ea1ng nh\u01b0 <a href=\"https:\/\/interdata.vn\/blog\/iptables-la-gi\/\">t\u01b0\u1eddng l\u1eeda IPtables<\/a>, <a href=\"https:\/\/interdata.vn\/blog\/ufw-la-gi\/\">c\u00f4ng c\u1ee5 t\u01b0\u1eddng l\u1eeda UFW<\/a> ho\u1eb7c Firewalld \u0111\u1ec3 Fail2ban c\u00f3 th\u1ec3 \u0111\u1ea9y c\u00e1c rule ch\u1eb7n IP v\u00e0o kernel.<\/li>\n<li style=\"margin-bottom: 8px;\"><strong>\u0110\u1ed3ng b\u1ed9 th\u1eddi gian chu\u1ea9n (NTP):<\/strong> File log h\u1ec7 th\u1ed1ng c\u1ea7n ghi nh\u1eadn m\u1ed1c th\u1eddi gian ch\u00ednh x\u00e1c \u0111\u1ec3 thu\u1eadt to\u00e1n t\u00ednh to\u00e1n c\u1eeda s\u1ed5 th\u1eddi gian <code>findtime<\/code> ho\u1ea1t \u0111\u1ed9ng chu\u1ea9n x\u00e1c.<\/li>\n<li style=\"margin-bottom: 8px;\"><strong>\u0110\u1ecba ch\u1ec9 IP t\u0129nh c\u1ee7a qu\u1ea3n tr\u1ecb vi\u00ean:<\/strong> Chu\u1ea9n b\u1ecb s\u1eb5n IP m\u1ea1ng c\u00e1 nh\u00e2n ho\u1eb7c IP m\u1ea1ng v\u0103n ph\u00f2ng \u0111\u1ec3 \u0111\u01b0a v\u00e0o danh s\u00e1ch ngo\u1ea1i l\u1ec7 (whitelist), tr\u00e1nh t\u00ecnh hu\u1ed1ng t\u1ef1 kh\u00f3a t\u00e0i kho\u1ea3n khi g\u00f5 sai m\u1eadt kh\u1ea9u.<\/li>\n<\/ul>\n<h2 id=\"section3\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin: 40px 0 20px; line-height: 1.4;\">3. H\u01b0\u1edbng d\u1eabn c\u00e0i \u0111\u1eb7t Fail2ban tr\u00ean Linux: Ubuntu v\u00e0 Debian<\/h2>\n<p style=\"text-align: justify;\">C\u00e1c b\u1ea3n ph\u00e2n ph\u1ed1i Ubuntu (20.04, 22.04, 24.04 LTS) v\u00e0 Debian (11, 12) \u0111\u1ec1u t\u00edch h\u1ee3p s\u1eb5n package Fail2ban trong kho l\u01b0u tr\u1eef APT ch\u00ednh th\u1ee9c. Th\u1ef1c hi\u1ec7n theo c\u00e1c b\u01b0\u1edbc sau:<\/p>\n<h3 style=\"color: #1e3a8a; font-size: 18px; font-weight: bold; margin-top: 20px;\">B\u01b0\u1edbc 1: C\u1eadp nh\u1eadt ch\u1ec9 m\u1ee5c g\u00f3i ph\u1ea7n m\u1ec1m<\/h3>\n<p style=\"text-align: justify;\">Tr\u01b0\u1edbc khi t\u1ea3i \u1ee9ng d\u1ee5ng, c\u1eadp nh\u1eadt c\u01a1 s\u1edf d\u1eef li\u1ec7u package b\u1eb1ng l\u1ec7nh sau:<\/p>\n<pre><code>sudo apt update &amp;&amp; sudo apt upgrade -y<\/code><\/pre>\n<h3 style=\"color: #1e3a8a; font-size: 18px; font-weight: bold; margin-top: 20px;\">B\u01b0\u1edbc 2: C\u00e0i \u0111\u1eb7t g\u00f3i Fail2ban<\/h3>\n<p style=\"text-align: justify;\">C\u00e0i \u0111\u1eb7t Fail2ban tr\u1ef1c ti\u1ebfp qua tr\u00ecnh qu\u1ea3n l\u00fd g\u00f3i <code>apt<\/code>:<\/p>\n<pre><code>sudo apt install fail2ban -y<\/code><\/pre>\n<h3 style=\"color: #1e3a8a; font-size: 18px; font-weight: bold; margin-top: 20px;\">B\u01b0\u1edbc 3: K\u00edch ho\u1ea1t d\u1ecbch v\u1ee5 kh\u1edfi \u0111\u1ed9ng c\u00f9ng h\u1ec7 th\u1ed1ng<\/h3>\n<p style=\"text-align: justify;\">B\u1eadt ti\u1ebfn tr\u00ecnh Fail2ban v\u00e0 c\u1ea5u h\u00ecnh t\u1ef1 ch\u1ea1y l\u1ea1i m\u1ed7i khi kh\u1edfi \u0111\u1ed9ng l\u1ea1i m\u00e1y ch\u1ee7:<\/p>\n<pre><code>sudo systemctl enable fail2ban\r\nsudo systemctl start fail2ban<\/code><\/pre>\n<p style=\"text-align: justify;\">Ki\u1ec3m tra tr\u1ea1ng th\u00e1i d\u1ecbch v\u1ee5 xem \u0111\u00e3 ho\u1ea1t \u0111\u1ed9ng \u1ed5n \u0111\u1ecbnh ch\u01b0a:<\/p>\n<pre><code>sudo systemctl status fail2ban<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-43369\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/Huong-dan-cai-dat-fail2ban-tren-Linux.png\" alt=\"H\u01b0\u1edbng d\u1eabn c\u00e0i \u0111\u1eb7t fail2ban tr\u00ean Linux\" width=\"900\" height=\"470\" title=\"\" srcset=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/Huong-dan-cai-dat-fail2ban-tren-Linux.png 992w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/Huong-dan-cai-dat-fail2ban-tren-Linux-300x157.png 300w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/Huong-dan-cai-dat-fail2ban-tren-Linux-768x401.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/p>\n<h2 id=\"section4\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin: 40px 0 20px; line-height: 1.4;\">4. H\u01b0\u1edbng d\u1eabn c\u00e0i \u0111\u1eb7t Fail2ban tr\u00ean Linux: CentOS, RHEL v\u00e0 AlmaLinux<\/h2>\n<p style=\"text-align: justify;\">\u0110\u1ed1i v\u1edbi nh\u00f3m h\u1ec7 \u0111i\u1ec1u h\u00e0nh Enterprise Linux nh\u01b0 CentOS 7\/8\/9 Stream, RHEL v\u00e0 AlmaLinux\/Rocky Linux, Fail2ban kh\u00f4ng n\u1eb1m trong kho repository m\u1eb7c \u0111\u1ecbnh m\u00e0 thu\u1ed9c kho EPEL (Extra Packages for Enterprise Linux).<\/p>\n<h3 style=\"color: #1e3a8a; font-size: 18px; font-weight: bold; margin-top: 20px;\">B\u01b0\u1edbc 1: K\u00edch ho\u1ea1t kho ph\u1ea7n m\u1ec1m EPEL Repository<\/h3>\n<p style=\"text-align: justify;\">Tr\u00ean CentOS 7 s\u1eed d\u1ee5ng <code>yum<\/code>, tr\u00ean AlmaLinux\/Rocky Linux\/RHEL 8 v\u00e0 9 s\u1eed d\u1ee5ng <code>dnf<\/code>:<\/p>\n<pre><code># D\u00e0nh cho AlmaLinux, Rocky Linux, RHEL 8\/9\r\nsudo dnf install epel-release -y\r\n\r\n# D\u00e0nh cho CentOS 7\r\nsudo yum install epel-release -y<\/code><\/pre>\n<h3 style=\"color: #1e3a8a; font-size: 18px; font-weight: bold; margin-top: 20px;\">B\u01b0\u1edbc 2: C\u00e0i \u0111\u1eb7t Fail2ban v\u00e0 g\u00f3i h\u1ed7 tr\u1ee3 t\u01b0\u1eddng l\u1eeda<\/h3>\n<p style=\"text-align: justify;\">N\u1ebfu b\u1ea1n \u0111ang s\u1eed d\u1ee5ng Firewalld l\u00e0m t\u01b0\u1eddng l\u1eeda ch\u00ednh, b\u1ea1n c\u1ea7n c\u00e0i \u0111\u1eb7t th\u00eam g\u00f3i <code>fail2ban-firewalld<\/code> \u0111\u1ec3 t\u00edch h\u1ee3p \u0111\u1ed3ng b\u1ed9:<\/p>\n<pre><code># D\u00e0nh cho AlmaLinux \/ RHEL 8 &amp; 9\r\nsudo dnf install fail2ban fail2ban-firewalld -y\r\n\r\n# D\u00e0nh cho CentOS 7\r\nsudo yum install fail2ban -y<\/code><\/pre>\n<h3 style=\"color: #1e3a8a; font-size: 18px; font-weight: bold; margin-top: 20px;\">B\u01b0\u1edbc 3: Kh\u1edfi \u0111\u1ed9ng v\u00e0 k\u00edch ho\u1ea1t ti\u1ebfn tr\u00ecnh systemd<\/h3>\n<p style=\"text-align: justify;\">Th\u1ef1c hi\u1ec7n n\u1ea1p d\u1ecbch v\u1ee5 v\u00e0o background:<\/p>\n<pre><code>sudo systemctl enable --now fail2ban<\/code><\/pre>\n<div style=\"background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%); border: 1.5px solid #2563EB; border-radius: 12px; padding: 28px; margin: 35px 0; text-align: center;\">\n<p style=\"font-family: 'Be Vietnam Pro', sans-serif; font-size: 22px; font-weight: bold; color: #1e3a8a; margin: 0 0 8px;\">S\u0103n deal VPS &amp; Cloud Server tr\u01b0\u1edbc khi ch\u1ed1t g\u00f3i<\/p>\n<p style=\"font-size: 15px; color: #4b5563; margin-bottom: 20px;\">Canh Me t\u1ed5ng h\u1ee3p khuy\u1ebfn m\u00e3i, m\u00e3 gi\u1ea3m gi\u00e1, th\u1eddi gian \u00e1p d\u1ee5ng v\u00e0 \u0111i\u1ec1u ki\u1ec7n \u0111\u0103ng k\u00fd m\u1edbi nh\u1ea5t \u2014 xem tr\u01b0\u1edbc \u0111\u1ec3 ch\u1ecdn c\u1ea5u h\u00ecnh ch\u1ea1y server v\u1edbi chi ph\u00ed t\u1ed1t nh\u1ea5t.<\/p>\n<p><a style=\"background: #2563EB; color: #fff; padding: 12px 30px; text-decoration: none; font-weight: 600; border-radius: 8px; display: inline-block;\" href=\"https:\/\/interdata.vn\/canhme\/\" target=\"_blank\" rel=\"noopener\">Xem Hot Deals t\u1ea1i Canh Me \u27f6<\/a><\/p>\n<\/div>\n<h2 id=\"section5\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin: 40px 0 20px; line-height: 1.4;\">5. C\u1ea5u h\u00ecnh sau khi c\u00e0i \u0111\u1eb7t Fail2ban tr\u00ean Linux: T\u00f9y bi\u1ebfn jail.local<\/h2>\n<p style=\"text-align: justify;\">M\u1eb7c \u0111\u1ecbnh, Fail2ban l\u01b0u c\u1ea5u h\u00ecnh ch\u00ednh t\u1ea1i file <code>\/etc\/fail2ban\/jail.conf<\/code>. Tuy nhi\u00ean, b\u1ea1n <strong>tuy\u1ec7t \u0111\u1ed1i kh\u00f4ng ch\u1ec9nh s\u1eeda tr\u1ef1c ti\u1ebfp file n\u00e0y<\/strong> v\u00ec m\u1ed7i l\u1ea7n c\u1eadp nh\u1eadt phi\u00ean b\u1ea3n, package manager s\u1ebd ghi \u0111\u00e8 to\u00e0n b\u1ed9 n\u1ed9i dung.<\/p>\n<p style=\"text-align: justify;\">Quy t\u1eafc chu\u1ea9n trong qu\u1ea3n tr\u1ecb server l\u00e0 t\u1ea1o m\u1ed9t b\u1ea3n sao c\u00f3 t\u00ean <code>\/etc\/fail2ban\/jail.local<\/code>. Fail2ban s\u1ebd t\u1ef1 \u0111\u1ed9ng \u01b0u ti\u00ean n\u1ea1p c\u00e1c gi\u00e1 tr\u1ecb ghi \u0111\u00e8 trong file <code>.local<\/code> n\u00e0y.<\/p>\n<pre><code>sudo cp \/etc\/fail2ban\/jail.conf \/etc\/fail2ban\/jail.local\r\nsudo nano \/etc\/fail2ban\/jail.local<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-43373\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/Cau-hinh-co-ban.png\" alt=\"C\u1ea5u h\u00ecnh c\u01a1 b\u1ea3n\" width=\"900\" height=\"830\" title=\"\" srcset=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/Cau-hinh-co-ban.png 927w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/Cau-hinh-co-ban-300x277.png 300w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/Cau-hinh-co-ban-768x708.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/p>\n<h3 style=\"color: #1e3a8a; font-size: 18px; font-weight: bold; margin-top: 20px;\">Gi\u1ea3i th\u00edch c\u00e1c tham s\u1ed1 c\u1ed1t l\u00f5i trong Fail2ban<\/h3>\n<p style=\"text-align: justify;\">D\u01b0\u1edbi \u0111\u00e2y l\u00e0 b\u1ea3ng t\u1ed5ng h\u1ee3p c\u00e1c ch\u1ec9 th\u1ecb quan tr\u1ecdng nh\u1ea5t b\u1ea1n b\u1eaft bu\u1ed9c ph\u1ea3i hi\u1ec3u khi thi\u1ebft l\u1eadp ch\u00ednh s\u00e1ch ch\u1eb7n:<\/p>\n<div style=\"overflow-x: auto; margin: 20px 0;\">\n<table style=\"width: 100%; border-collapse: collapse; text-align: left; font-size: 14px;\">\n<thead>\n<tr style=\"background-color: #1e3a8a; color: #ffffff;\">\n<th style=\"padding: 12px; border: 1px solid #CBD5E1;\">Tham s\u1ed1<\/th>\n<th style=\"padding: 12px; border: 1px solid #CBD5E1;\">Gi\u00e1 tr\u1ecb m\u1eb7c \u0111\u1ecbnh<\/th>\n<th style=\"padding: 12px; border: 1px solid #CBD5E1;\">\u00dd ngh\u0129a &amp; H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"background-color: #f8fafc;\">\n<td style=\"padding: 10px; border: 1px solid #CBD5E1; font-family: monospace; font-weight: bold;\">ignoreip<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">127.0.0.1\/8 ::1<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">Danh s\u00e1ch IP ho\u1eb7c d\u1ea3i CIDR \u0111\u01b0\u1ee3c whitelist tuy\u1ec7t \u0111\u1ed1i kh\u00f4ng bao gi\u1edd b\u1ecb kh\u00f3a. C\u00e1ch nhau b\u1edfi d\u1ea5u c\u00e1ch.<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1; font-family: monospace; font-weight: bold;\">bantime<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">10m (ho\u1eb7c 600)<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">Th\u1eddi gian kh\u00f3a \u0111\u1ecba ch\u1ec9 IP vi ph\u1ea1m (h\u1ed7 tr\u1ee3 \u0111u\u00f4i s: gi\u00e2y, m: ph\u00fat, h: gi\u1edd, d: ng\u00e0y). \u0110\u1eb7t -1 \u0111\u1ec3 kh\u00f3a v\u0129nh vi\u1ec5n.<\/td>\n<\/tr>\n<tr style=\"background-color: #f8fafc;\">\n<td style=\"padding: 10px; border: 1px solid #CBD5E1; font-family: monospace; font-weight: bold;\">findtime<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">10m (ho\u1eb7c 600)<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">C\u1eeda s\u1ed5 th\u1eddi gian m\u00e0 s\u1ed1 l\u1ea7n vi ph\u1ea1m \u0111\u01b0\u1ee3c t\u00edch l\u0169y l\u1ea1i \u0111\u1ec3 t\u00ednh to\u00e1n x\u1eed ph\u1ea1t.<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1; font-family: monospace; font-weight: bold;\">maxretry<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">5<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">S\u1ed1 l\u1ea7n th\u1eed sai t\u1ed1i \u0111a cho ph\u00e9p trong kho\u1ea3ng findtime tr\u01b0\u1edbc khi th\u1ef1c hi\u1ec7n l\u1ec7nh kh\u00f3a IP.<\/td>\n<\/tr>\n<tr style=\"background-color: #f8fafc;\">\n<td style=\"padding: 10px; border: 1px solid #CBD5E1; font-family: monospace; font-weight: bold;\">logpath<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">T\u00f9y theo d\u1ecbch v\u1ee5<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">\u0110\u01b0\u1eddng d\u1eabn tuy\u1ec7t \u0111\u1ed1i d\u1eabn \u0111\u1ebfn file nh\u1eadt k\u00fd m\u00e0 jail c\u1ee5 th\u1ec3 c\u1ea7n \u0111\u1ecdc v\u00e0 ph\u00e2n t\u00edch d\u1eef li\u1ec7u.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h3 style=\"color: #1e3a8a; font-size: 18px; font-weight: bold; margin-top: 20px;\">File c\u1ea5u h\u00ecnh m\u1eabu ho\u00e0n ch\u1ec9nh cho SSH, Nginx v\u00e0 Apache<\/h3>\n<p style=\"text-align: justify;\">M\u1edf file <code>\/etc\/fail2ban\/jail.local<\/code> v\u00e0 d\u00e1n c\u1ea5u h\u00ecnh th\u1ef1c chi\u1ebfn sau. C\u1ea5u h\u00ecnh n\u00e0y \u0111\u00e3 t\u1ed1i \u01b0u b\u1ea3o v\u1ec7 c\u1ea3 SSH, web server <a href=\"https:\/\/interdata.vn\/blog\/nginx-la-gi\/\">Nginx<\/a> v\u00e0 <a href=\"https:\/\/interdata.vn\/blog\/apache-la-gi\/\">Apache<\/a>:<\/p>\n<pre><code># File: \/etc\/fail2ban\/jail.local\r\n\r\n[DEFAULT]\r\n# Whitelist IP m\u1ea1ng n\u1ed9i b\u1ed9 v\u00e0 IP qu\u1ea3n tr\u1ecb\r\nignoreip = 127.0.0.1\/8 ::1 103.xxx.xxx.xxx\r\n# Kh\u00f3a trong 1 gi\u1edd n\u1ebfu vi ph\u1ea1m\r\nbantime  = 1h\r\n# C\u1eeda s\u1ed5 theo d\u00f5i trong v\u00f2ng 10 ph\u00fat\r\nfindtime  = 10m\r\n# Th\u1eed sai qu\u00e1 3 l\u1ea7n s\u1ebd b\u1ecb kh\u00f3a\r\nmaxretry = 3\r\n# Ph\u01b0\u01a1ng th\u1ee9c ki\u1ec3m tra log (systemd ho\u1eb7c polling)\r\nbackend = auto\r\n\r\n# --------------------------------------------------\r\n# JAIL B\u1ea2O V\u1ec6 D\u1ecaCH V\u1ee4 TRUY C\u1eacP SSH\r\n# --------------------------------------------------\r\n[sshd]\r\nenabled = true\r\nport    = ssh\r\n# Tr\u00ean Ubuntu\/Debian d\u00f9ng: \/var\/log\/auth.log\r\n# Tr\u00ean CentOS\/AlmaLinux d\u00f9ng: \/var\/log\/secure\r\nlogpath = %(sshd_log)s\r\nbackend = %(sshd_backend)s\r\nmaxretry = 3\r\nbantime  = 24h\r\n\r\n# --------------------------------------------------\r\n# JAIL B\u1ea2O V\u1ec6 NGINX: CH\u1ed0NG SCANNER V\u00c0 BAD REQUEST\r\n# --------------------------------------------------\r\n[nginx-http-auth]\r\nenabled = true\r\nport    = http,https\r\nlogpath = \/var\/log\/nginx\/error.log\r\n\r\n[nginx-botsearch]\r\nenabled  = true\r\nport     = http,https\r\nlogpath  = \/var\/log\/nginx\/access.log\r\nmaxretry = 2\r\nbantime  = 48h\r\n\r\n# --------------------------------------------------\r\n# JAIL B\u1ea2O V\u1ec6 APACHE: CH\u1ed0NG D\u00d2 QU\u00c9T T\u1ef0 \u0110\u1ed8NG\r\n# --------------------------------------------------\r\n[apache-auth]\r\nenabled = true\r\nport    = http,https\r\nlogpath = \/var\/log\/apache2\/*error.log\r\nmaxretry = 3\r\n\r\n[apache-badbots]\r\nenabled = true\r\nport    = http,https\r\nlogpath = \/var\/log\/apache2\/*access.log\r\nbantime = 48h\r\nmaxretry = 2<\/code><\/pre>\n<p style=\"text-align: justify;\">Sau khi l\u01b0u file c\u1ea5u h\u00ecnh, kh\u1edfi \u0111\u1ed9ng l\u1ea1i daemon \u0111\u1ec3 k\u00edch ho\u1ea1t c\u00e1c jail:<\/p>\n<pre><code>sudo systemctl restart fail2ban<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-43375\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/File-cau-hinh-mau-hoan-chinh-cho-SSH-Nginx-va-Apache.png\" alt=\"File c\u1ea5u h\u00ecnh m\u1eabu ho\u00e0n ch\u1ec9nh cho SSH, Nginx v\u00e0 Apache\" width=\"900\" height=\"750\" title=\"\" srcset=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/File-cau-hinh-mau-hoan-chinh-cho-SSH-Nginx-va-Apache.png 1065w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/File-cau-hinh-mau-hoan-chinh-cho-SSH-Nginx-va-Apache-300x250.png 300w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/File-cau-hinh-mau-hoan-chinh-cho-SSH-Nginx-va-Apache-1024x854.png 1024w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/File-cau-hinh-mau-hoan-chinh-cho-SSH-Nginx-va-Apache-768x640.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/p>\n<h2 id=\"section6\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin: 40px 0 20px; line-height: 1.4;\">6. C\u1ea5u h\u00ecnh Fail2ban n\u00e2ng cao: Recidive, Custom Filter v\u00e0 Email Alert<\/h2>\n<h3 style=\"color: #1e3a8a; font-size: 18px; font-weight: bold; margin-top: 20px;\">K\u00edch ho\u1ea1t Jail Recidive (Kh\u00f3a d\u00e0i h\u1ea1n k\u1ebb t\u00e1i ph\u1ea1m nhi\u1ec1u l\u1ea7n)<\/h3>\n<p style=\"text-align: justify;\">Nhi\u1ec1u botnet \u0111\u01b0\u1ee3c l\u1eadp tr\u00ecnh \u0111\u1ec3 \u0111\u1ee3i h\u1ebft th\u1eddi gian kh\u00f3a (v\u00ed d\u1ee5 sau 1 gi\u1edd) r\u1ed3i ti\u1ebfp t\u1ee5c t\u1ea5n c\u00f4ng. Jail <code>recidive<\/code> gi\u00e1m s\u00e1t ch\u00ednh file log c\u1ee7a Fail2ban (<code>\/var\/log\/fail2ban.log<\/code>) \u0111\u1ec3 ph\u00e1t hi\u1ec7n IP b\u1ecb kh\u00f3a l\u1eb7p l\u1ea1i nhi\u1ec1u l\u1ea7n, t\u1eeb \u0111\u00f3 \u00e1p d\u1ee5ng m\u1ee9c ph\u1ea1t kh\u00f3a trong v\u00e0i tu\u1ea7n ho\u1eb7c v\u00e0i th\u00e1ng:<\/p>\n<pre><code>[recidive]\r\nenabled  = true\r\nlogpath  = \/var\/log\/fail2ban.log\r\nbanaction = %(banaction_allports)s\r\nbantime  = 4w ; Kh\u00f3a trong 4 tu\u1ea7n\r\nfindtime = 1d ; Trong v\u00f2ng 1 ng\u00e0y\r\nmaxretry = 3  ; N\u1ebfu b\u1ecb kh\u00f3a 3 l\u1ea7n t\u1eeb c\u00e1c jail kh\u00e1c<\/code><\/pre>\n<h3 style=\"color: #1e3a8a; font-size: 18px; font-weight: bold; margin-top: 20px;\">T\u1ea1o Custom Filter ng\u0103n ch\u1eb7n t\u1ea5n c\u00f4ng WordPress XML-RPC<\/h3>\n<p style=\"text-align: justify;\">T\u1ea5n c\u00f4ng d\u00f2 m\u1eadt kh\u1ea9u qua t\u1ec7p <code>xmlrpc.php<\/code> ho\u1eb7c <code>wp-login.php<\/code> r\u1ea5t ph\u1ed5 bi\u1ebfn \u0111\u1ed1i v\u1edbi c\u00e1c website WordPress. B\u1ea1n c\u00f3 th\u1ec3 t\u1ea1o m\u1ed9t b\u1ed9 l\u1ecdc t\u00f9y ch\u1ec9nh m\u1edbi b\u1eb1ng c\u00e1ch t\u1ea1o file <code>\/etc\/fail2ban\/filter.d\/wordpress-auth.conf<\/code>:<\/p>\n<pre><code># File: \/etc\/fail2ban\/filter.d\/wordpress-auth.conf\r\n[Definition]\r\nfailregex = ^&lt;HOST&gt; .* \"POST \/(wp-login\\.php|xmlrpc\\.php) HTTP.*\" 200\r\nignoreregex =<\/code><\/pre>\n<p style=\"text-align: justify;\">Sau \u0111\u00f3 th\u00eam kh\u1ed1i jail t\u01b0\u01a1ng \u1ee9ng v\u00e0o cu\u1ed1i file <code>\/etc\/fail2ban\/jail.local<\/code>:<\/p>\n<pre><code>[wordpress-auth]\r\nenabled  = true\r\nport     = http,https\r\nfilter   = wordpress-auth\r\nlogpath  = \/var\/log\/nginx\/*access.log\r\nmaxretry = 4\r\nfindtime = 5m\r\nbantime  = 24h<\/code><\/pre>\n<h3 style=\"color: #1e3a8a; font-size: 18px; font-weight: bold; margin-top: 20px;\">C\u1ea5u h\u00ecnh g\u1eedi email c\u1ea3nh b\u00e1o t\u1ef1 \u0111\u1ed9ng<\/h3>\n<p style=\"text-align: justify;\">N\u1ebfu server \u0111\u00e3 c\u00e0i \u0111\u1eb7t <code>sendmail<\/code> ho\u1eb7c <code>postfix<\/code>, b\u1ea1n c\u00f3 th\u1ec3 thi\u1ebft l\u1eadp \u0111\u1ec3 Fail2ban g\u1eedi th\u00f4ng b\u00e1o m\u1ed7i khi c\u00f3 IP b\u1ecb c\u00e1ch ly b\u1eb1ng c\u00e1ch ch\u1ec9nh s\u1eeda ph\u1ea7n <code>[DEFAULT]<\/code>:<\/p>\n<pre><code>destemail = admin-security@domaincuaban.vn\r\nsender    = fail2ban@domaincuaban.vn\r\nmta       = sendmail\r\naction    = %(action_mwl)s<\/code><\/pre>\n<p style=\"text-align: justify;\">K\u00fd hi\u1ec7u <code>action_mwl<\/code> c\u00f3 ngh\u0129a l\u00e0: Ch\u1eb7n IP, g\u1eedi email k\u00e8m b\u00e1o c\u00e1o chi ti\u1ebft th\u00f4ng tin WHOIS v\u00e0 c\u00e1c d\u00f2ng log vi ph\u1ea1m li\u00ean quan.<\/p>\n<div style=\"display: flex; flex-wrap: wrap; background-color: #fff; border: 1.5px solid #BFDBFE; box-shadow: 0 8px 20px rgba(37,99,235,0.08); border-radius: 12px; overflow: hidden; margin: 35px 0;\">\n<div style=\"flex: 1; min-width: 250px; background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 100%); display: flex; align-items: center; justify-content: center; padding: 30px; text-align: center;\">\n<div>\n<p style=\"color: #fff; font-size: 34px; font-family: 'Be Vietnam Pro', sans-serif; font-weight: bold; margin: 0; line-height: 1.1;\">Cloud Server InterData<\/p>\n<p style=\"color: #dbeafe; font-size: 15px; font-weight: 600; margin-top: 12px;\">N\u00e2ng\/h\u1ea1 t\u00e0i nguy\u00ean nhanh theo t\u1ea3i, m\u1ea1ng t\u1ed1c \u0111\u1ed9 cao<\/p>\n<\/div>\n<\/div>\n<div style=\"flex: 2; padding: 25px; min-width: 300px;\">\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 0; font-size: 20px;\">Ch\u1ea1y nhi\u1ec1u d\u1ecbch v\u1ee5, nhi\u1ec1u website c\u1ea7n b\u1ea3o m\u1eadt \u0111a l\u1edbp?<\/h3>\n<p style=\"text-align: justify; font-size: 15px; margin-bottom: 15px;\">Khi m\u00e1y ch\u1ee7 ch\u1ea1y \u0111\u1ed3ng th\u1eddi website l\u01b0u l\u01b0\u1ee3ng l\u1edbn, c\u01a1 s\u1edf d\u1eef li\u1ec7u v\u00e0 c\u1ee5m container, vi\u1ec7c ph\u00e2n t\u00edch log th\u1eddi gian th\u1ef1c y\u00eau c\u1ea7u CPU v\u00e0 I\/O \u0111\u0129a \u1ed5n \u0111\u1ecbnh. Gi\u1ea3i ph\u00e1p <a href=\"https:\/\/interdata.vn\/blog\/cloud-server-la-gi\/\">h\u1ea1 t\u1ea7ng Cloud Server<\/a> c\u1ee7a InterData cho ph\u00e9p linh ho\u1ea1t m\u1edf r\u1ed9ng t\u00e0i nguy\u00ean kh\u00f4ng gi\u00e1n \u0111o\u1ea1n d\u1ecbch v\u1ee5.<\/p>\n<p><a style=\"background: linear-gradient(90deg, #2563EB 0%, #1E3A8A 100%); color: #fff; padding: 12px 25px; text-decoration: none; font-weight: 600; border-radius: 8px; font-size: 15px; display: inline-block; box-shadow: 0 5px 15px rgba(37,99,235,0.3);\" href=\"https:\/\/interdata.vn\/cloud-server\/\" target=\"_blank\" rel=\"noopener\">Xem B\u1ea3ng Gi\u00e1 Cloud Server \u27f6<\/a><\/p>\n<\/div>\n<\/div>\n<h2 id=\"section7\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin: 40px 0 20px; line-height: 1.4;\">7. Qu\u1ea3n l\u00fd tr\u1ea1ng th\u00e1i v\u00e0 x\u1eed l\u00fd s\u1ef1 c\u1ed1 th\u01b0\u1eddng g\u1eb7p<\/h2>\n<h3 style=\"color: #1e3a8a; font-size: 18px; font-weight: bold; margin-top: 20px;\">C\u00e1c l\u1ec7nh ki\u1ec3m tra tr\u1ea1ng th\u00e1i b\u1eb1ng fail2ban-client<\/h3>\n<p style=\"text-align: justify;\">Ti\u1ec7n \u00edch d\u00f2ng l\u1ec7nh <code>fail2ban-client<\/code> cho ph\u00e9p b\u1ea1n t\u01b0\u01a1ng t\u00e1c tr\u1ef1c ti\u1ebfp v\u1edbi ti\u1ebfn tr\u00ecnh daemon \u0111ang ho\u1ea1t \u0111\u1ed9ng:<\/p>\n<pre><code># Xem danh s\u00e1ch t\u1ea5t c\u1ea3 c\u00e1c jail \u0111ang \u0111\u01b0\u1ee3c k\u00edch ho\u1ea1t\r\nsudo fail2ban-client status\r\n\r\n# Xem chi ti\u1ebft danh s\u00e1ch IP \u0111ang b\u1ecb kh\u00f3a trong jail sshd\r\nsudo fail2ban-client status sshd\r\n\r\n# M\u1edf kh\u00f3a th\u1ee7 c\u00f4ng (Unban) cho m\u1ed9t IP c\u1ee5 th\u1ec3\r\nsudo fail2ban-client set sshd unbanip 203.0.113.50\r\n\r\n# Kh\u00f3a th\u1ee7 c\u00f4ng m\u1ed9t IP \u0111\u00e1ng ng\u1edd ngay l\u1eadp t\u1ee9c\r\nsudo fail2ban-client set sshd banip 198.51.100.25<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-43377\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/Trang-thai-fail2ban.png\" alt=\"Tr\u1ea1ng th\u00e1i fail2ban\" width=\"800\" height=\"305\" title=\"\" srcset=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/Trang-thai-fail2ban.png 865w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/Trang-thai-fail2ban-300x114.png 300w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/08\/Trang-thai-fail2ban-768x293.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<h3 style=\"color: #1e3a8a; font-size: 18px; font-weight: bold; margin-top: 20px;\">Troubleshooting: X\u1eed l\u00fd c\u00e1c l\u1ed7i ph\u1ed5 bi\u1ebfn<\/h3>\n<ul>\n<li style=\"margin-bottom: 12px;\"><strong>L\u1ed7i 1: T\u1ef1 kh\u00f3a IP c\u1ee7a ch\u00ednh m\u00ecnh (Self-Lockout):<\/strong> N\u1ebfu b\u1ea1n b\u1ecb m\u1ea5t k\u1ebft n\u1ed1i do g\u00f5 sai m\u1eadt kh\u1ea9u v\u00e0 kh\u00f4ng th\u1ec3 SSH v\u00e0o server, h\u00e3y \u0111\u0103ng nh\u1eadp qua b\u1ea3ng \u0111i\u1ec1u khi\u1ec3n Web Console (VNC Console) \u0111\u01b0\u1ee3c cung c\u1ea5p tr\u00ean trang qu\u1ea3n tr\u1ecb VPS. Sau \u0111\u00f3 d\u00f9ng l\u1ec7nh <code>sudo fail2ban-client set sshd unbanip &lt;IP_CUA_BAN&gt;<\/code> v\u00e0 th\u00eam ngay IP c\u1ee7a m\u00ecnh v\u00e0o d\u00f2ng <code>ignoreip<\/code> trong <code>jail.local<\/code>.<\/li>\n<li style=\"margin-bottom: 12px;\"><strong>L\u1ed7i 2: Fail2ban kh\u00f4ng ch\u1eb7n IP d\u00f9 log ghi nh\u1eadn \u0111\u0103ng nh\u1eadp l\u1ed7i:<\/strong> Nguy\u00ean nh\u00e2n hay g\u1eb7p nh\u1ea5t l\u00e0 do \u0111\u01b0\u1eddng d\u1eabn <code>logpath<\/code> kh\u00f4ng kh\u1edbp v\u1edbi c\u1ea5u h\u00ecnh h\u1ec7 \u0111i\u1ec1u h\u00e0nh th\u1ef1c t\u1ebf (v\u00ed d\u1ee5 Ubuntu d\u00f9ng <code>\/var\/log\/auth.log<\/code> nh\u01b0ng file c\u1ea5u h\u00ecnh l\u1ea1i tr\u1ecf v\u1ec1 <code>\/var\/log\/secure<\/code>), ho\u1eb7c do m\u00fai gi\u1edd h\u1ec7 th\u1ed1ng kh\u00f4ng \u0111\u1ed3ng b\u1ed9. D\u00f9ng l\u1ec7nh <code>sudo fail2ban-regex \/var\/log\/auth.log \/etc\/fail2ban\/filter.d\/sshd.conf<\/code> \u0111\u1ec3 ki\u1ec3m tra \u0111\u1ed9 kh\u1edbp c\u1ee7a bi\u1ec3u th\u1ee9c regex v\u1edbi file log.<\/li>\n<li style=\"margin-bottom: 12px;\"><strong>L\u1ed7i 3: Xung \u0111\u1ed9t backend tr\u00ean h\u1ec7 \u0111i\u1ec1u h\u00e0nh m\u1edbi:<\/strong> Tr\u00ean Ubuntu 22.04+ v\u00e0 Debian 12, g\u00f3i <code>rsyslog<\/code> m\u1eb7c \u0111\u1ecbnh kh\u00f4ng \u0111\u01b0\u1ee3c c\u00e0i s\u1eb5n khi\u1ebfn c\u00e1c file log d\u1ea1ng v\u0103n b\u1ea3n truy\u1ec1n th\u1ed1ng kh\u00f4ng sinh ra. H\u00e3y chuy\u1ec3n <code>backend = systemd<\/code> trong file <code>jail.local<\/code> \u0111\u1ec3 Fail2ban \u0111\u1ecdc tr\u1ef1c ti\u1ebfp t\u1eeb journald.<\/li>\n<\/ul>\n<h2 id=\"section8\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin: 40px 0 20px; line-height: 1.4;\">8. So s\u00e1nh Fail2ban v\u00e0 CSF Firewall<\/h2>\n<p style=\"text-align: justify;\">C\u1ea3 Fail2ban v\u00e0 CSF (ConfigServer Security &amp; Firewall) \u0111\u1ec1u l\u00e0 hai gi\u1ea3i ph\u00e1p b\u1ea3o m\u1eadt ph\u1ed5 bi\u1ebfn tr\u00ean Linux. B\u1ea3ng d\u01b0\u1edbi \u0111\u00e2y ch\u1ec9 r\u00f5 c\u00e1c \u0111i\u1ec3m kh\u00e1c bi\u1ec7t gi\u00fap b\u1ea1n l\u1ef1a ch\u1ecdn \u0111\u00fang c\u00f4ng c\u1ee5:<\/p>\n<div style=\"overflow-x: auto; margin: 20px 0;\">\n<table style=\"width: 100%; border-collapse: collapse; text-align: left; font-size: 14px;\">\n<thead>\n<tr style=\"background-color: #1e3a8a; color: #ffffff;\">\n<th style=\"padding: 12px; border: 1px solid #CBD5E1;\">Ti\u00eau ch\u00ed<\/th>\n<th style=\"padding: 12px; border: 1px solid #CBD5E1;\">Fail2ban<\/th>\n<th style=\"padding: 12px; border: 1px solid #CBD5E1;\">CSF (ConfigServer Firewall)<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"background-color: #f8fafc;\">\n<td style=\"padding: 10px; border: 1px solid #CBD5E1; font-weight: bold;\">B\u1ea3n ch\u1ea5t ho\u1ea1t \u0111\u1ed9ng<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">\u1ee8ng d\u1ee5ng ph\u00e2n t\u00edch log theo th\u1eddi gian th\u1ef1c v\u00e0 \u0111\u1ea9y rule \u0111\u1ed9ng v\u00e0o t\u01b0\u1eddng l\u1eeda c\u00f3 s\u1eb5n.<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">B\u1ed9 t\u01b0\u1eddng l\u1eeda Stateful Firewall ho\u00e0n ch\u1ec9nh k\u1ebft h\u1ee3p Login Failure Daemon (LFD).<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1; font-weight: bold;\">Giao di\u1ec7n qu\u1ea3n tr\u1ecb (GUI)<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">Ch\u1ec9 h\u1ed7 tr\u1ee3 CLI (D\u00f2ng l\u1ec7nh).<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">T\u00edch h\u1ee3p giao di\u1ec7n qu\u1ea3n tr\u1ecb \u0111\u1ed3 h\u1ecda trong cPanel, <a href=\"https:\/\/interdata.vn\/blog\/directadmin-la-gi\/\">DirectAdmin<\/a>, <a href=\"https:\/\/interdata.vn\/blog\/webmin-la-gi\/\">Webmin<\/a>.<\/td>\n<\/tr>\n<tr style=\"background-color: #f8fafc;\">\n<td style=\"padding: 10px; border: 1px solid #CBD5E1; font-weight: bold;\">Ti\u00eau t\u1ed1n t\u00e0i nguy\u00ean<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">R\u1ea5t nh\u1eb9, ph\u00f9 h\u1ee3p v\u1edbi c\u1ea3 VPS c\u1ea5u h\u00ecnh nh\u1ecf t\u1eeb 1GB RAM.<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">Ti\u00eau t\u1ed1n nhi\u1ec1u RAM v\u00e0 CPU h\u01a1n do t\u00edch h\u1ee3p nhi\u1ec1u module ki\u1ec3m tra s\u00e2u.<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1; font-weight: bold;\">M\u00f4i tr\u01b0\u1eddng ph\u00f9 h\u1ee3p nh\u1ea5t<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">M\u00e1y ch\u1ee7 thu\u1ea7n d\u00f2ng l\u1ec7nh (Ubuntu\/Debian\/CentOS), c\u1ee5m <a href=\"https:\/\/interdata.vn\/blog\/docker-la-gi\/\">Docker<\/a>, server microservices.<\/td>\n<td style=\"padding: 10px; border: 1px solid #CBD5E1;\">Server Shared Web Hosting ch\u1ea1y cPanel, DirectAdmin ho\u1eb7c m\u00e1y ch\u1ee7 l\u01b0u tr\u1eef nhi\u1ec1u t\u00e0i kho\u1ea3n.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2 id=\"section9\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin: 40px 0 20px; line-height: 1.4;\">9. Checklist b\u1ea3o m\u1eadt m\u00e1y ch\u1ee7 sau khi c\u1ea5u h\u00ecnh Fail2ban<\/h2>\n<p style=\"text-align: justify;\">Fail2ban l\u00e0 l\u1edbp b\u1ea3o v\u1ec7 tuy\u1ec7t v\u1eddi, tuy nhi\u00ean m\u1ed9t h\u1ec7 th\u1ed1ng ph\u00f2ng th\u1ee7 v\u1eefng ch\u1eafc c\u1ea7n s\u1ef1 k\u1ebft h\u1ee3p \u0111a t\u1ea7ng. B\u1ea1n n\u00ean ho\u00e0n thi\u1ec7n c\u00e1c ti\u00eau chu\u1ea9n sau \u0111\u1ec3 ho\u00e0n t\u1ea5t vi\u1ec7c hardening server:<\/p>\n<ol>\n<li style=\"margin-bottom: 10px;\"><strong>\u0110\u1ed5i c\u1ed5ng k\u1ebft n\u1ed1i SSH m\u1eb7c \u0111\u1ecbnh:<\/strong> Chuy\u1ec3n t\u1eeb port <code>22<\/code> sang m\u1ed9t d\u1ea3i c\u1ed5ng s\u1ed1 ng\u1eabu nhi\u00ean (v\u00ed d\u1ee5 <code>2289<\/code> ho\u1eb7c <code>55222<\/code>) trong file <code>\/etc\/ssh\/sshd_config<\/code> nh\u1eb1m gi\u1ea3m b\u1edbt h\u01a1n 90% s\u1ed1 l\u01b0\u1ee3ng botnet t\u1ef1 \u0111\u1ed9ng qu\u00e9t m\u1ea1ng.<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>Chuy\u1ec3n sang x\u00e1c th\u1ef1c b\u1eb1ng SSH Key:<\/strong> T\u1eaft ho\u00e0n to\u00e0n t\u00ednh n\u0103ng \u0111\u0103ng nh\u1eadp b\u1eb1ng m\u1eadt kh\u1ea9u (<code>PasswordAuthentication no<\/code>) v\u00e0 ch\u1ec9 cho ph\u00e9p ch\u1ee9ng th\u1ef1c th\u00f4ng qua c\u1eb7p kh\u00f3a RSA 4096-bit ho\u1eb7c Ed25519.<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>V\u00f4 hi\u1ec7u h\u00f3a quy\u1ec1n \u0111\u0103ng nh\u1eadp c\u1ee7a t\u00e0i kho\u1ea3n Root:<\/strong> Thi\u1ebft l\u1eadp <code>PermitRootLogin no<\/code> \u0111\u1ec3 bu\u1ed9c qu\u1ea3n tr\u1ecb vi\u00ean ph\u1ea3i truy c\u1eadp qua t\u00e0i kho\u1ea3n ph\u1ee5 c\u00f3 quy\u1ec1n h\u1ea1n m\u1ee9c, sau \u0111\u00f3 m\u1edbi leo thang \u0111\u1eb7c quy\u1ec1n qua <code>sudo<\/code>.<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>K\u00edch ho\u1ea1t t\u01b0\u1eddng l\u1eeda m\u00e1y ch\u1ee7:<\/strong> \u0110\u1ea3m b\u1ea3o ch\u1ec9 m\u1edf c\u00e1c c\u1ed5ng d\u1ecbch v\u1ee5 c\u00f4ng khai th\u1ef1c s\u1ef1 c\u1ea7n thi\u1ebft (v\u00ed d\u1ee5 80, 443 v\u00e0 c\u1ed5ng SSH m\u1edbi \u0111\u1ed5i). \u0110\u00f3ng to\u00e0n b\u1ed9 c\u00e1c c\u1ed5ng database nh\u01b0 MySQL (3306) ho\u1eb7c Redis (6379) kh\u1ecfi m\u00f4i tr\u01b0\u1eddng Internet c\u00f4ng c\u1ed9ng.<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>B\u1eadt ch\u1ebf \u0111\u1ed9 c\u1eadp nh\u1eadt b\u1ea3o m\u1eadt t\u1ef1 \u0111\u1ed9ng:<\/strong> C\u00e0i \u0111\u1eb7t <code>unattended-upgrades<\/code> tr\u00ean Ubuntu ho\u1eb7c <code>dnf-automatic<\/code> tr\u00ean RHEL \u0111\u1ec3 h\u1ec7 \u0111i\u1ec1u h\u00e0nh t\u1ef1 \u0111\u1ed9ng v\u00e1 c\u00e1c l\u1ed7 h\u1ed5ng nh\u00e2n Linux \u0111\u1ecbnh k\u1ef3.<\/li>\n<\/ol>\n<h2 id=\"faq\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin: 40px 0 20px; line-height: 1.4;\">FAQ \u2014 C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 Fail2ban<\/h2>\n<h3 style=\"color: #1e3a8a; font-size: 17px; font-weight: bold; margin-top: 15px;\">Fail2ban c\u00f3 ho\u00e0n to\u00e0n mi\u1ec5n ph\u00ed kh\u00f4ng?<\/h3>\n<p style=\"text-align: justify;\">Fail2ban l\u00e0 ph\u1ea7n m\u1ec1m m\u00e3 ngu\u1ed3n m\u1edf ho\u00e0n to\u00e0n mi\u1ec5n ph\u00ed \u0111\u01b0\u1ee3c ph\u00e1t h\u00e0nh theo gi\u1ea5y ph\u00e9p GNU General Public License (GPLv2). B\u1ea1n c\u00f3 th\u1ec3 t\u1ef1 do c\u00e0i \u0111\u1eb7t, ch\u1ec9nh s\u1eeda m\u00e3 ngu\u1ed3n v\u00e0 s\u1eed d\u1ee5ng cho m\u1ee5c \u0111\u00edch c\u00e1 nh\u00e2n l\u1eabn c\u00e1c h\u1ec7 th\u1ed1ng m\u00e1y ch\u1ee7 th\u01b0\u01a1ng m\u1ea1i m\u00e0 kh\u00f4ng t\u1ed1n chi ph\u00ed b\u1ea3n quy\u1ec1n.<\/p>\n<h3 style=\"color: #1e3a8a; font-size: 17px; font-weight: bold; margin-top: 15px;\">Fail2ban c\u00f3 thay th\u1ebf \u0111\u01b0\u1ee3c t\u01b0\u1eddng l\u1eeda h\u1ec7 th\u1ed1ng kh\u00f4ng?<\/h3>\n<p style=\"text-align: justify;\">Kh\u00f4ng. B\u1ea3n th\u00e2n Fail2ban kh\u00f4ng ph\u1ea3i l\u00e0 t\u01b0\u1eddng l\u1eeda \u0111\u1ed9c l\u1eadp m\u00e0 ho\u1ea1t \u0111\u1ed9ng nh\u01b0 m\u1ed9t c\u00f4ng c\u1ee5 ph\u00e2n t\u00edch log th\u00f4ng minh. Khi ph\u00e1t hi\u1ec7n d\u1ea5u hi\u1ec7u b\u1ea5t th\u01b0\u1eddng, Fail2ban s\u1ebd giao ti\u1ebfp v\u00e0 \u0111\u1ea9y c\u00e1c quy t\u1eafc ch\u1eb7n IP v\u00e0o c\u00e1c t\u01b0\u1eddng l\u1eeda s\u1eb5n c\u00f3 nh\u01b0 IPtables, NFTables, UFW ho\u1eb7c Firewalld.<\/p>\n<h3 style=\"color: #1e3a8a; font-size: 17px; font-weight: bold; margin-top: 15px;\">T\u00f4i b\u1ecb Fail2ban kh\u00f3a nh\u1ea7m \u0111\u1ecba ch\u1ec9 IP th\u00ec ph\u1ea3i x\u1eed l\u00fd th\u1ebf n\u00e0o?<\/h3>\n<p style=\"text-align: justify;\">B\u1ea1n c\u00f3 th\u1ec3 k\u1ebft n\u1ed1i v\u00e0o m\u00e1y ch\u1ee7 th\u00f4ng qua giao di\u1ec7n VNC Console tr\u00ean c\u1ed5ng qu\u1ea3n l\u00fd hosting\/VPS. Sau khi truy c\u1eadp terminal n\u1ed9i b\u1ed9, th\u1ef1c thi l\u1ec7nh <code>fail2ban-client set &lt;jail_name&gt; unbanip &lt;IP_cua_ban&gt;<\/code> \u0111\u1ec3 m\u1edf kh\u00f3a ngay l\u1eadp t\u1ee9c v\u00e0 \u0111\u01b0a IP v\u00e0o m\u1ee5c ignoreip.<\/p>\n<h3 style=\"color: #1e3a8a; font-size: 17px; font-weight: bold; margin-top: 15px;\">Fail2ban c\u00f3 b\u1ea3o v\u1ec7 \u0111\u01b0\u1ee3c c\u00e1c \u1ee9ng d\u1ee5ng web nh\u01b0 Nginx v\u00e0 Apache kh\u00f4ng?<\/h3>\n<p style=\"text-align: justify;\">C\u00f3. Fail2ban \u0111i k\u00e8m nhi\u1ec1u b\u1ed9 l\u1ecdc \u0111\u1ecbnh s\u1eb5n cho Nginx v\u00e0 Apache \u0111\u1ec3 ch\u1eb7n c\u00e1c cu\u1ed9c t\u1ea5n c\u00f4ng qu\u00e9t m\u00e3 \u0111\u1ed9c (bot search), khai th\u00e1c l\u1ed7i b\u1ea3o m\u1eadt, t\u1ea5n c\u00f4ng d\u00f2 m\u1eadt kh\u1ea9u HTTP Auth v\u00e0 d\u00f2 qu\u00e9t \u0111\u01b0\u1eddng d\u1eabn \u0111\u0103ng nh\u1eadp qu\u1ea3n tr\u1ecb CMS WordPress.<\/p>\n<h3 style=\"color: #1e3a8a; font-size: 17px; font-weight: bold; margin-top: 15px;\">N\u00ean d\u00f9ng Fail2ban hay CSF Firewall cho m\u00e1y ch\u1ee7 Linux?<\/h3>\n<p style=\"text-align: justify;\">N\u1ebfu b\u1ea1n v\u1eadn h\u00e0nh m\u00e1y ch\u1ee7 d\u00f2ng l\u1ec7nh g\u1ecdn nh\u1eb9 ho\u1eb7c c\u1ee5m microservices, Fail2ban k\u1ebft h\u1ee3p c\u00f9ng UFW\/IPtables l\u00e0 l\u1ef1a ch\u1ecdn ti\u00eau chu\u1ea9n. N\u1ebfu b\u1ea1n v\u1eadn h\u00e0nh m\u00e1y ch\u1ee7 Shared Web Hosting nhi\u1ec1u ng\u01b0\u1eddi d\u00f9ng c\u00f3 giao di\u1ec7n cPanel ho\u1eb7c DirectAdmin, CSF s\u1ebd mang l\u1ea1i kh\u1ea3 n\u0103ng qu\u1ea3n tr\u1ecb thu\u1eadn ti\u1ec7n h\u01a1n.<\/p>\n<div style=\"border-top: 2px dashed #BFDBFE; margin-top: 50px; padding-top: 30px;\">\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; font-size: 22px; font-weight: bold; margin-bottom: 15px;\">Ch\u1ee7 \u0111\u1ed9ng b\u1ea3o v\u1ec7 h\u1ec7 th\u1ed1ng m\u00e1y ch\u1ee7 c\u1ee7a b\u1ea1n ngay h\u00f4m nay<\/h3>\n<p style=\"text-align: justify;\">Vi\u1ec7c <strong>c\u00e0i \u0111\u1eb7t Fail2ban tr\u00ean Linux<\/strong> l\u00e0 b\u01b0\u1edbc \u0111i n\u1ec1n t\u1ea3ng gi\u00fap h\u1ec7 th\u1ed1ng m\u00e1y ch\u1ee7 \u0111\u1ee9ng v\u1eefng tr\u01b0\u1edbc h\u00e0ng ngh\u00ecn \u0111\u1ee3t d\u00f2 qu\u00e9t m\u1eadt kh\u1ea9u t\u1ef1 \u0111\u1ed9ng m\u1ed7i ng\u00e0y. Ch\u1ec9 v\u1edbi v\u00e0i thao t\u00e1c thi\u1ebft l\u1eadp t\u1ec7p <code>jail.local<\/code>, b\u1ea1n \u0111\u00e3 t\u1ea1o ra m\u1ed9t l\u00e1 ch\u1eafn ch\u1ee7 \u0111\u1ed9ng, gi\u00fap gi\u1ea3m t\u1ea3i ti\u00eau th\u1ee5 t\u00e0i nguy\u00ean v\u00e0 gi\u1ea3m thi\u1ec3u nguy c\u01a1 b\u1ecb chi\u1ebfm quy\u1ec1n root.<\/p>\n<\/div>\n<p style=\"text-align: justify; font-size: 13px; font-style: italic; color: #6b7280; margin-top: 30px; border-top: 1px solid #E5E7EB; padding-top: 15px;\"><span style=\"font-size: 100%;\"><em>N\u1ed9i dung mang t\u00ednh tham kh\u1ea3o. C\u00e1c l\u1ec7nh v\u00e0 c\u1ea5u h\u00ecnh c\u00f3 th\u1ec3 thay \u0111\u1ed5i theo phi\u00ean b\u1ea3n h\u1ec7 \u0111i\u1ec1u h\u00e0nh (Ubuntu, Debian, CentOS, AlmaLinux), phi\u00ean b\u1ea3n Fail2ban v\u00e0 m\u00f4i tr\u01b0\u1eddng th\u1ef1c t\u1ebf. N\u00ean ki\u1ec3m th\u1eed tr\u00ean m\u00f4i tr\u01b0\u1eddng staging, sao l\u01b0u d\u1eef li\u1ec7u v\u00e0 \u0111\u00e1nh gi\u00e1 r\u1ee7i ro tr\u01b0\u1edbc khi \u00e1p d\u1ee5ng cho production.<\/em><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>C\u00e0i \u0111\u1eb7t Fail2ban tr\u00ean Linux l\u00e0 gi\u1ea3i ph\u00e1p thi\u1ebft y\u1ebfu \u0111\u1ec3 ng\u0103n ch\u1eb7n tin t\u1eb7c qu\u00e9t c\u1ed5ng v\u00e0 d\u00f2 m\u1eadt kh\u1ea9u h\u1ec7 th\u1ed1ng. Khi v\u1eeba tri\u1ec3n khai m\u00e1y ch\u1ee7, c\u1ed5ng SSH m\u1eb7c \u0111\u1ecbnh th\u01b0\u1eddng xuy\u00ean b\u1ecb t\u1ea5n c\u00f4ng d\u00f2 qu\u00e9t li\u00ean t\u1ee5c khi\u1ebfn t\u00e0i nguy\u00ean qu\u00e1 t\u1ea3i v\u00e0 t\u0103ng r\u1ee7i ro l\u1ed9 quy\u1ec1n qu\u1ea3n tr\u1ecb.<\/p>\n","protected":false},"author":2,"featured_media":43379,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[161],"tags":[],"class_list":["post-43365","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-huong-dan-chung"],"_links":{"self":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts\/43365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/comments?post=43365"}],"version-history":[{"count":7,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts\/43365\/revisions"}],"predecessor-version":[{"id":43380,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts\/43365\/revisions\/43380"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/media\/43379"}],"wp:attachment":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/media?parent=43365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/categories?post=43365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/tags?post=43365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}