<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Debian on Net Boy</title>
    <link>https://lian.st/tags/debian/</link>
    <description>Recent content in Debian on Net Boy</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-gb</language>
    <lastBuildDate>Mon, 09 Dec 2024 17:39:44 +0800</lastBuildDate><atom:link href="https://lian.st/tags/debian/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Debian vim滑鼠右鍵無法使用解決</title>
      <link>https://lian.st/posts/1342b289/</link>
      <pubDate>Mon, 09 Dec 2024 17:39:44 +0800</pubDate>
      
      <guid>https://lian.st/posts/1342b289/</guid>
      
      <description>&lt;p&gt;Debian中通過終端使用vim，滑鼠無法使用右鍵的復制粘貼等功能，這是由於vim的一向默認配置導致，按照下面方法修改即可。&lt;/p&gt;
&lt;h2 id=&#34;解決方法&#34;&gt;解決方法&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt; vi /usr/share/vim/vim*/defaults.vim
....
 80 if has(&amp;#39;mouse&amp;#39;)
 81   if &amp;amp;term =~ &amp;#39;xterm&amp;#39;
 82     set mouse-=a
 83   else
 84     set mouse=nvi
 85   endif
 86 endif
...
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;說明&#34;&gt;說明&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;mouse 選型默認爲 a，相關說明如下：

The mouse can be enabled for different modes:
n Normal mode
v Visual mode
i Insert mode
c Command-line mode
h all previous modes when editing a help file
a all previous modes
r for |hit-enter| and |more-prompt| prompt
Normally you would enable the mouse in all four modes with:
:set mouse=a

When the mouse is not enabled, the GUI will still use the mouse for
modeless selection. This doesn&amp;#39;t move the text cursor.
&lt;/code&gt;&lt;/pre&gt;</description>
      
    </item>
    
    <item>
      <title>Debian 12 部署Fail2ban保護SSH</title>
      <link>https://lian.st/posts/c9fd9755/</link>
      <pubDate>Wed, 06 Nov 2024 22:52:04 +0800</pubDate>
      
      <guid>https://lian.st/posts/c9fd9755/</guid>
      
      <description>&lt;h2 id=&#34;environment&#34;&gt;Environment&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;OS Version：&lt;code&gt; Debian GNU/Linux 12 (bookworm)&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Fail2ban-Server： &lt;code&gt;1.0.2&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Python： &lt;code&gt;3.11.2&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;install-fail2ban&#34;&gt;Install Fail2ban&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;apt install fail2ban
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;configure-rule&#34;&gt;Configure Rule&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;nano /etc/fail2ban/jail.d/defaults-debian.conf

[DEFAULT]
# 用於指定忽略的ip地址， fail2ban 防御,以空格間隔。
ignoreip = 127.0.0.1/8
# ssh客戶端被禁止的時長（默認單位爲：秒）
bantime  = 86400
# 過濾的時長（秒）
findtime  = 600
# 匹配到的閥值（允許失敗的次數）
maxretry = 3
 
 
[ssh-iptables]
# 是否開啓
enabled  = true
# 過濾規則
port = 22
filter = sshd
# debian日志路徑
logpath = /var/log/auth.log
# centos7日志文件路徑
#logpath  = /var/log/secure
# 匹配到的閥值（允許失敗的次數）
maxretry = 4
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;install--rsyslog&#34;&gt;Install  Rsyslog&lt;/h2&gt;
&lt;p&gt;Debian 12 默認沒有安裝rsyslog，因fail2ban需要依賴rsyslog來做處理，所以我們這裏需要在debian12 中安裝rsyslog。&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>Debian12更換apt源</title>
      <link>https://lian.st/posts/37d36afc/</link>
      <pubDate>Tue, 01 Oct 2024 17:41:25 +0800</pubDate>
      
      <guid>https://lian.st/posts/37d36afc/</guid>
      
      <description>&lt;h2 id=&#34;備份&#34;&gt;備份&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cp /etc/apt/sources.list /etc/apt/sources.list.bak
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;更換&#34;&gt;更換&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo nano /etc/apt/sources.list
# Official Debian 12 (Bookworm) Repositories
deb http://deb.debian.org/debian/ bookworm main contrib non-free
deb-src http://deb.debian.org/debian/ bookworm main contrib non-free

# Security Updates
deb http://security.debian.org/debian-security bookworm-security main contrib non-free
deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free

# Updates
deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free
deb-src http://deb.debian.org/debian/ bookworm-updates main contrib non-free
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;更新&#34;&gt;更新&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;apt update
apt upgrade
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;常用源&#34;&gt;常用源&lt;/h2&gt;
&lt;h3 id=&#34;香港理工大學&#34;&gt;香港理工大學&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;deb http://ftp.polyu.edu.hk/pub/Linux/debian/ bookworm main contrib non-free
deb-src http://ftp.polyu.edu.hk/pub/Linux/debian/ bookworm main contrib non-free

deb http://ftp.polyu.edu.hk/pub/Linux/debian-security bookworm-security main contrib non-free
deb-src http://ftp.polyu.edu.hk/pub/Linux/debian-security bookworm-security main contrib non-free

deb http://ftp.polyu.edu.hk/pub/Linux/debian/ bookworm-updates main contrib non-free
deb-src http://ftp.polyu.edu.hk/pub/Linux/debian/ bookworm-updates main contrib non-free
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;臺灣清華大學&#34;&gt;臺灣清華大學&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free non-free-firmware contrib

deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;新加坡nus&#34;&gt;新加坡NUS&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;deb http://mirror.nus.edu.sg/debian/ bookworm main contrib non-free
deb-src http://mirror.nus.edu.sg/debian/ bookworm main contrib non-free

deb http://mirror.nus.edu.sg/debian-security/ bookworm-security main
deb-src http://mirror.nus.edu.sg/debian-security/ bookworm-security main

deb http://mirror.nus.edu.sg/debian/ bookworm-updates main contrib non-free
deb-src http://mirror.nus.edu.sg/debian/ bookworm-updates main contrib non-free
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;阿裏雲&#34;&gt;阿裏雲&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;清華大學&#34;&gt;清華大學&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib
&lt;/code&gt;&lt;/pre&gt;</description>
      
    </item>
    
    <item>
      <title>Debian安裝ClamAV病毒掃描工具</title>
      <link>https://lian.st/posts/976927fe/</link>
      <pubDate>Tue, 12 Mar 2024 17:36:15 +0800</pubDate>
      
      <guid>https://lian.st/posts/976927fe/</guid>
      
      <description>&lt;p&gt;&lt;img alt=&#34;Debian安裝ClamAV病毒掃描工具&#34; src=&#34;https://b2.ccc.re/images/2024/12/18/clamav.png&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;安裝&#34;&gt;安裝&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;## Debian
sudo apt-get update
sudo apt-get install clamav clamav-daemon

## Centos
sudo yum install epel-release
sudo yum install clamav clamav-update
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;配置&#34;&gt;配置&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# 如果日志文件不存在的話，需要手動創建。

sudo touch /var/log/clamav/freshclam.log
sudo chown clamav:clamav /var/log/clamav/freshclam.log
sudo chmod 644 /var/log/clamav/freshclam.log
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;使用&#34;&gt;使用&lt;/h2&gt;
&lt;p&gt;安裝之後，需要重啓一下機器，否則啓動服務不生效（至少我操作的時候是這樣的）。&lt;/p&gt;
&lt;h3 id=&#34;啓動服務&#34;&gt;啓動服務&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo systemctl start clamav-daemon
# 或者
sudo systemctl restart clamav-daemon
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;查看服務狀態&#34;&gt;查看服務狀態&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root@debian:/home/ghost#  systemctl status clamav-daemon
● clamav-daemon.service - Clam AntiVirus userspace daemon
     Loaded: loaded (/lib/systemd/system/clamav-daemon.service; enabled; preset: enabled)
    Drop-In: /etc/systemd/system/clamav-daemon.service.d
             └─extend.conf
     Active: active (running) since Wed 2024-12-18 00:27:03 EST; 2min 27s ago
TriggeredBy: ● clamav-daemon.socket
       Docs: man:clamd(8)
             man:clamd.conf(5)
             https://docs.clamav.net/
    Process: 823 ExecStartPre=/bin/mkdir -p /run/clamav (code=exited, status=0/SUCCESS)
    Process: 830 ExecStartPre=/bin/chown clamav /run/clamav (code=exited, status=0/SUCCESS)
   Main PID: 831 (clamd)
      Tasks: 2 (limit: 2264)
     Memory: 1.5G
        CPU: 12.447s
     CGroup: /system.slice/clamav-daemon.service
             └─831 /usr/sbin/clamd --foreground=true

Dec 18 00:27:16 debian clamd[831]: Wed Dec 18 00:27:16 2024 -&amp;gt; Portable Executable support enabled.
Dec 18 00:27:16 debian clamd[831]: Wed Dec 18 00:27:16 2024 -&amp;gt; ELF support enabled.
Dec 18 00:27:16 debian clamd[831]: Wed Dec 18 00:27:16 2024 -&amp;gt; Mail files support enabled.
Dec 18 00:27:16 debian clamd[831]: Wed Dec 18 00:27:16 2024 -&amp;gt; OLE2 support enabled.
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;更新病毒庫&#34;&gt;更新病毒庫&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root@debian:/home/ghost# freshclam
Wed Dec 18 00:29:38 2024 -&amp;gt; ClamAV update process started at Wed Dec 18 00:29:38 2024
Wed Dec 18 00:29:38 2024 -&amp;gt; daily.cld database is up-to-date (version: 27490, sigs: 2070490, f-level: 90, builder: raynman)
Wed Dec 18 00:29:38 2024 -&amp;gt; main.cvd database is up-to-date (version: 62, sigs: 6647427, f-level: 90, builder: sigmgr)
Wed Dec 18 00:29:38 2024 -&amp;gt; bytecode.cvd database is up-to-date (version: 335, sigs: 86, f-level: 90, builder: raynman)xxxxxxxxxx6 1更新 Cla•mAV 的病毒數據庫root@debian:/home/ghost# freshclam2Wed Dec 18 00:29:38 2024 -&amp;gt; ClamAV update process started at Wed Dec 18 00:29:38 20243Wed Dec 18 00:29:38 2024 -&amp;gt; daily.cld database is up-to-date (version: 27490, sigs: 2070490, f-level: 90, builder: raynman)4Wed Dec 18 00:29:38 2024 -&amp;gt; main.cvd database is up-to-date (version: 62, sigs: 6647427, f-level: 90, builder: sigmgr)5Wed Dec 18 00:29:38 2024 -&amp;gt; bytecode.cvd database is up-to-date (version: 335, sigs: 86, f-level: 90, builder: raynman)6
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;常用命令&#34;&gt;常用命令&lt;/h3&gt;
&lt;h4 id=&#34;掃描單個文件&#34;&gt;掃描單個文件&lt;/h4&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;語法：clamscan /path/to/your/file
root@debian:/home/ghost# clamscan /etc/passwd
Loading:    15s, ETA:   0s [========================&amp;gt;]    8.70M/8.70M sigs       
Compiling:   6s, ETA:   0s [========================&amp;gt;]       41/41 tasks 

/etc/passwd: OK

----------- SCAN SUMMARY -----------
Known viruses: 8702280
Engine version: 1.0.7
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.00 MB
Data read: 0.00 MB (ratio 0.00:1)
Time: 22.179 sec (0 m 22 s)
Start Date: 2024:12:18 00:37:07
End Date:   2024:12:18 00:37:29
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;掃描整個目錄&#34;&gt;掃描整個目錄&lt;/h4&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;clamscan -r /path/to/directory
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;自動刪除檢測到的病毒&#34;&gt;自動刪除檢測到的病毒&lt;/h4&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;clamscan --remove -r /path/to/directory
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;掃描結果生成報告&#34;&gt;掃描結果生成報告&lt;/h4&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;clamscan -r /path/to/directory &amp;gt; scanreport.txt
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;顯示掃描到的病毒信息&#34;&gt;顯示掃描到的病毒信息&lt;/h4&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;clamscan -r --bell -i /path/to/directory
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;clamdscan&#34;&gt;clamdscan&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;clamdscan&lt;/code&gt; 是 Cla­mAV 防病毒服务器 &lt;code&gt;clamd&lt;/code&gt; 的客户端，用于与后台持续运行并加载病毒数据库的 &lt;code&gt;clamd&lt;/code&gt; 进行交互以执行病毒扫描，使得频繁或大规模的扫描任务更加高效。&lt;/p&gt;</description>
      
    </item>
    
  </channel>
</rss>
