2024年5月12日 星期日

GlusterFS-server加NFS-ganesha大亂測

 事前導讀及參考資訊

https://xrcd2.blogspot.com/2022/04/glusterfs-samba.html

https://www.server-world.info/en/note?os=CentOS_Stream_9&p=glusterfs11&f=1

https://core.vmware.com/resource/nfs-iscsi-multipathing-vsphere

測試架構

192.168.100.201 Rocky  Linux  nfs1     glusterfs-server+nfs-ganesha

192.168.100.202 Rocky  Linux  nfs2     glusterfs-server+nfs-ganesha

192.168.100.x   Oracle Linux  Oracle9  glusterfs/nfsclient test

192.168.100.111 ESXi NFS Client 

192.168.100.222 PVE  Glusterfs Client + Client

===========================

操作及設定簡要記錄

fdisk /dev/nvme0n2

mkfs.xfs /dev/nvme0n2p1

mkdir /syncdisk

blkid

vi /etc/fstab


UUID=33548bbf-a5be-4d08-ab25-28e68dc438f5 /syncdisk   xfs   defaults   0 0



vi /etc/hosts

192.168.100.201 nfs1 
192.168.100.202     nfs2

[root@nfs1 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        4.0M     0  4.0M   0% /dev
tmpfs           3.8G     0  3.8G   0% /dev/shm
tmpfs           1.5G  9.4M  1.5G   1% /run
/dev/nvme0n1p2   44G  6.8G   38G  16% /
/dev/nvme0n1p1  960M  469M  492M  49% /boot
/dev/nvme0n2p1   20G  175M   20G   1% /syncdisk
tmpfs           766M   36K  766M   1% /run/user/1000
[root@nfs1 ~]# 


  dnf install centos-release-gluster11.noarch 
  dnf install centos-release-nfs-ganesha5.noarch 
  dnf --enablerepo=crb install python3-pyxattr
  dnf install   glusterfs-server


[root@nfs1 yum.repos.d]# systemctl enable --now glusterd
[root@nfs1 yum.repos.d]# gluster --version
glusterfs 11.1
Repository revision: git://git.gluster.org/glusterfs.git
Copyright (c) 2006-2016 Red Hat, Inc. <https://www.gluster.org/>
GlusterFS comes with ABSOLUTELY NO WARRANTY.
It is licensed to you under your choice of the GNU Lesser
General Public License, version 3 or any later version (LGPLv3
or later), or the GNU General Public License, version 2 (GPLv2),
in all cases as published by the Free Software Foundation.
[root@nfs1 yum.repos.d]# gluster peer probe nfs2
peer probe: success
[root@nfs1 yum.repos.d]# gluster peer status 
Number of Peers: 1

Hostname: nfs2
Uuid: bc6daa49-a8ca-438c-871c-45a978ea4251
State: Peer in Cluster (Connected)

[root@nfs1 yum.repos.d]# gluster volume create nfsvolume replica 2 transport tcp nfs1:/syncdisk/nfs nfs2:/syncdisk/nfs
Replica 2 volumes are prone to split-brain. Use Arbiter or Replica 3 to avoid this. See: http://docs.gluster.org/en/latest/Administrator-Guide/Split-brain-and-ways-to-deal-with-it/.
Do you still want to continue?
 (y/n) y
volume create: nfsvolume: success: please start the volume to access data

[root@nfs1 yum.repos.d]# gluster volume info 
 
Volume Name: nfsvolume
Type: Replicate
Volume ID: 776a642f-53fe-47ee-924a-20a45a911304
Status: Created
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: nfs1:/syncdisk/nfs
Brick2: nfs2:/syncdisk/nfs
Options Reconfigured:
cluster.granular-entry-heal: on
storage.fips-mode-rchecksum: on
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off
[root@nfs1 yum.repos.d]# 


[root@nfs1 yum.repos.d]# gluster volume start nfsvolume
volume start: nfsvolume: success
[root@nfs1 yum.repos.d]# 


[root@nfs2 ~]#  mount -t glusterfs nfs1:/nfsvolume /mnt
[root@nfs2 ~]# df 
Filesystem      1K-blocks    Used Available Use% Mounted on
devtmpfs             4096       0      4096   0% /dev
tmpfs             3918632       0   3918632   0% /dev/shm
tmpfs             1567456    9600   1557856   1% /run
/dev/nvme0n1p2   46064640 7125096  38939544  16% /
/dev/nvme0n2p1   20904960  179044  20725916   1% /syncdisk
/dev/nvme0n1p1     983040  479448    503592  49% /boot
tmpfs              783724      36    783688   1% /run/user/1000
nfs1:/nfsvolume  20904960  388092  20516868   2% /mnt

[root@nfs2 ~]#  echo "GlusterFS write test from nfs2" > /mnt/test.txt
[root@nfs2 ~]# ls -la /syncdisk/nfs/*
-rw-r--r-- 2 root root 21 May 11 12:57 /syncdisk/nfs/test.txt
[root@nfs2 ~]# 


[root@nfs1 yum.repos.d]# ls -la /syncdisk/nfs/*
-rw-r--r-- 2 root root 21 May 11 12:57 /syncdisk/nfs/test.txt
[root@nfs1 yum.repos.d]# 


mkdir /syncgfs 

vi /etc/fstab 



[root@nfs1 nfs]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Tue Feb 20 23:34:32 2024
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=c5d392e3-edbd-44e3-bd92-0053aec8bc10 /                       xfs     defaults        0 0
UUID=6fe1dba6-5999-491c-9679-c32ee4c84490 /boot                   xfs     defaults        0 0
UUID=d631d923-aa38-475f-9609-8283d3a598dc none                    swap    defaults        0 0
UUID=33548bbf-a5be-4d08-ab25-28e68dc438f5 /syncdisk   xfs   defaults   0 0
nfs1:/nfsvolume /syncgfs glusterfs   defaults,_netdev   0 0
[root@nfs1 nfs]# 



[root@nfs2 syncgfs]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Tue Feb 20 23:34:32 2024
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=c5d392e3-edbd-44e3-bd92-0053aec8bc10 /                       xfs     defaults        0 0
UUID=6fe1dba6-5999-491c-9679-c32ee4c84490 /boot                   xfs     defaults        0 0
UUID=d631d923-aa38-475f-9609-8283d3a598dc none                    swap    defaults        0 0
UUID=575c8913-d8df-4d79-857e-4b586c439b52 /syncdisk   xfs   defaults   0 0 
nfs2:/nfsvolume         /syncgfs        glusterfs                 defaults,_netdev        0 0
[root@nfs2 syncgfs]# 


dnf install nfs-ganesha-vfs nfs-ganesha nfs-ganesha-gluster


[root@nfs1 nfs]# cp /etc/ganesha/ganesha.conf /etc/ganesha/ganesha.conf.org
[root@nfs1 nfs]# vi /etc/ganesha/ganesha.conf




###################################################
#
# Ganesha Config Example
#
# This is a commented example configuration file for Ganesha.  It is not
# complete, but only has some common configuration options.  See the man pages
# for complete documentation.
#
###################################################

## These are core parameters that affect Ganesha as a whole.
NFS_CORE_PARAM {
## Allow NFSv3 to mount paths with the Pseudo path, the same as NFSv4,
## instead of using the physical paths.
mount_path_pseudo = true;

## Configure the protocols that Ganesha will listen for.  This is a hard
## limit, as this list determines which sockets are opened.  This list
## can be restricted per export, but cannot be expanded.
Protocols = 3,4;
}

## These are defaults for exports.  They can be overridden per-export.
EXPORT_DEFAULTS {
## Access type for clients.  Default is None, so some access must be
## given either here or in the export itself.
Access_Type = RW;
}

## Configure settings for the object handle cache
#MDCACHE {
## The point at which object cache entries will start being reused.
#Entries_HWMark = 100000;
#}

## Configure an export for some file tree
EXPORT
{
## Export Id (mandatory, each EXPORT must have a unique Export_Id)
Export_Id = 12345;

## Exported path (mandatory)
Path = /nfsha;

## Pseudo Path (required for NFSv4 or if mount_path_pseudo = true)
Pseudo = /nfsha;

## Restrict the protocols that may use this export.  This cannot allow
## access that is denied in NFS_CORE_PARAM.
Protocols = 3,4;

## Access type for clients.  Default is None, so some access must be
## given. It can be here, in the EXPORT_DEFAULTS, or in a CLIENT block
Access_Type = RW;

## Whether to squash various users.
Squash = No_root_squash;

## Allowed security types for this export
Sectype = sys;

## Exporting FSAL
FSAL {
Name = GLUSTER;
hostname="192.168.100.201";
volume="nfsvolume";
}
}

## Configure logging.  Default is to log to Syslog.  Basic logging can also be
## configured from the command line
LOG {
## Default log level for all components
Default_Log_Level = WARN;

## Configure per-component log levels.
#Components {
#FSAL = INFO;
#NFS4 = EVENT;
#}

## Where to log
#Facility {
#name = FILE;
#destination = "/var/log/ganesha.log";
#enable = active;
#}
}



[root@nfs1 nfs]#  systemctl disable --now nfs-server
[root@nfs1 nfs]#  systemctl enable --now nfs-ganesha
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-ganesha.service → /usr/lib/systemd/system/nfs-ganesha.service.
Created symlink /etc/systemd/system/nfs-ganesha.service.wants/nfs-ganesha-lock.service → /usr/lib/systemd/system/nfs-ganesha-lock.service.

[root@nfs1 nfs]# showmount -e localhost
Export list for localhost:
/nfsha (everyone)
[root@nfs1 nfs]# 





[root@Oracle9 ~]# yum install nfsv4-client-utils.x86_64 nfs-utils.x86_64


[root@Oracle9 mnt]# 

vi /ets/hosts

192.168.100.201 nfs1
192.168.100.202 nfs2


mkdir /mnt/HA-NFS


[root@Oracle9 mnt]# mount -t nfs4 nfs1:/nfsha /mnt/HA-NFS/


[root@Oracle9 mnt]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        4.0M     0  4.0M   0% /dev
tmpfs           3.7G     0  3.7G   0% /dev/shm
tmpfs           1.5G  9.2M  1.5G   1% /run
/dev/nvme0n1p3   45G   11G   35G  23% /
/dev/nvme0n1p1  960M  707M  254M  74% /boot
tmpfs           749M   36K  749M   1% /run/user/0
tmpfs           749M   36K  749M   1% /run/user/1001
nfs1:/nfsha      20G  379M   20G   2% /mnt/HA-NFS
[root@Oracle9 mnt]# 



[root@Oracle9 mnt]# cat  /mnt/HA-NFS/test.txt 
GlusterFS write test from nfs 1 
GlusterFS write test from nfs 2 

[root@Oracle9 mnt]# echo "GlusterFS write test from Oracle-Client  " >> /mnt/HA-NFS/test.txt 
[root@Oracle9 mnt]# 


[root@Oracle9 mnt]# cat /mnt/HA-NFS/test.txt 
GlusterFS write test from nfs 1 
GlusterFS write test from nfs 2 
GlusterFS write test from Oracle-Client  
[root@Oracle9 mnt]# 

[root@nfs1 nfs]# cat /syncdisk/nfs/test.txt 
GlusterFS write test from nfs 1 
GlusterFS write test from nfs 2 
GlusterFS write test from Oracle-Client  
[root@nfs1 nfs]# 


[root@nfs2 syncgfs]# cat /syncdisk/nfs/test.txt 
GlusterFS write test from nfs 1 
GlusterFS write test from nfs 2 
GlusterFS write test from Oracle-Client  
[root@nfs2 syncgfs]# 


[root@Oracle9 mnt]# umount /mnt/HA-NFS 
[root@Oracle9 mnt]# mount -t nfs4 nfs2:/nfsha /mnt/HA-NFS/

[root@Oracle9 mnt]# echo "GlusterFS write test2 from Oracle-Client  " >> /mnt/HA-NFS/test.txt 
[root@Oracle9 mnt]# 

[root@nfs1 nfs]# cat /syncdisk/nfs/test.txt 
GlusterFS write test from nfs 1 
GlusterFS write test from nfs 2 
GlusterFS write test from Oracle-Client  
GlusterFS write test2 from Oracle-Client  
[root@nfs1 nfs]# 


[root@nfs2 syncgfs]# cat /syncdisk/nfs/test.txt 
GlusterFS write test from nfs 1 
GlusterFS write test from nfs 2 
GlusterFS write test from Oracle-Client  
GlusterFS write test2 from Oracle-Client  
[root@nfs2 syncgfs]# 





ESXi

[root@localhost:~] esxcli storage nfs41 list
Volume Name  Host(s)                          Share   Accessible  Mounted  Read-Only  Security   isPE  Hardware Acceleration
-----------  -------------------------------  ------  ----------  -------  ---------  --------  -----  ---------------------
gfs-storage  192.168.100.201,192.168.100.202  /nfsha        true     true      false  AUTH_SYS  false  Not Supported
[root@localhost:~] 




[root@localhost:~] vim-cmd hostsvc/datastore/info gfs-storage
(vim.host.NasDatastoreInfo) {
   name = "gfs-storage", 
   url = "/vmfs/volumes/d3b21ae2-01cd6b50-0000-000000000000", 
   freeSpace = 14566449152, 
   maxFileSize = 70368744177664, 
   maxVirtualDiskCapacity = 68169720922112, 
   maxMemoryFileSize = 70368744177664, 
   timestamp = "2024-05-11T09:42:04.121385Z", 
   containerId = <unset>, 
   aliasOf = <unset>, 
   datastoreFormat = <unset>, 
   logicalSectorSize = <unset>, 
   physicalSectorSize = <unset>, 
   nas = (vim.host.NasVolume) {
      type = "NFS41", 
      name = "gfs-storage", 
      capacity = 21406679040, 
      remoteHost = "192.168.100.201", 
      remotePath = "/nfsha", 
      userName = <unset>, 
      remoteHostNames = (string) [
         "192.168.100.201", 
         "192.168.100.202"
      ], 
      securityType = "AUTH_SYS", 
      protocolEndpoint = false
   }
}
(vim.Datastore.HostMount) [
   (vim.Datastore.HostMount) {
      key = 'vim.HostSystem:ha-host', 
      mountInfo = (vim.host.MountInfo) {
         path = "/vmfs/volumes/d3b21ae2-01cd6b50-0000-000000000000", 
         accessMode = "readWrite", 
         mounted = true, 
         accessible = true, 
         inaccessibleReason = <unset>, 
         vmknicName = "None", 
         vmknicActive = false, 
         mountFailedReason = <unset>, 
         numTcpConnections = 1
      }
   }
]
[root@localhost:~]


[root@localhost:~] esxcli storage filesystem list
Mount Point                                        Volume Name                                 UUID                                 Mounted  Type            Size          Free
-------------------------------------------------  ------------------------------------------  -----------------------------------  -------  ------  ------------  ------------
/vmfs/volumes/d3b21ae2-01cd6b50-0000-000000000000  gfs-storage                                 d3b21ae2-01cd6b50-0000-000000000000     true  NFS41    21406679040   14566449152
/vmfs/volumes/654e469c-44d19cd7-8715-000c2921ee83  datastore1                                  654e469c-44d19cd7-8715-000c2921ee83     true  VMFS-6  137170518016   99963895808
/vmfs/volumes/654e469c-378e9fe6-73ec-000c2921ee83  OSDATA-654e469c-378e9fe6-73ec-000c2921ee83  654e469c-378e9fe6-73ec-000c2921ee83     true  VMFSOS  128580583424  125292249088
/vmfs/volumes/507161ab-d84dd9c3-c4a7-a5422027a503  BOOTBANK1                                   507161ab-d84dd9c3-c4a7-a5422027a503     true  vfat      4293591040    4000317440
/vmfs/volumes/d9628348-1545f094-5e85-a3d31d093e2e  BOOTBANK2                                   d9628348-1545f094-5e85-a3d31d093e2e     true  vfat      4293591040    4293525504
[root@localhost:~] 

PVE






ESXi  NFS

不同的儲存供應商有不同的方法來啟用此功能,
但通常 NAS 伺服器使用 no_root_squash 選項。
如果 NAS 伺服器不授予 root 存取權限,
仍然可以在主機上掛載 NFS 資料儲存。

但是,您無法在資料儲存上建立任何虛擬機器

2024年4月27日 星期六

TrueNAS SCALE 試裝

 TrueNAS-SCALE-24.04.0.iso

重點設定項目如下.

(1)儲存 => 建  RAID

(2)認證 => 建 帳密

(3)資料表 => 建 資料集 設定權限

(4)共用 => 設定及啟用共用服務 SMB/NFS/iSCSI/









2024年3月15日 星期五

使用 PHP 試寫 LibreNMS 串接 Jandi 通知

 LibreNMS 預設是支援常見的 Line Notify,但不支援 Jandi 的.

所以試寫一個 Jandi 的 alert-transports 


Demo 如下所示.


PS:以下程式的串接寫下僅適用於 librenms-22.12.x 以下的版本.

而且是抄改自  Linenotify.php 原碼,如下所示


[root@Oracle9 Transport]# pwd

/opt/librenms/LibreNMS/Alert/Transport

[root@Oracle9 Transport]# cat Linenotify.php

<?php

/**

 * LINE Notify Transport

 */


namespace LibreNMS\Alert\Transport;


use LibreNMS\Alert\Transport;

use LibreNMS\Util\Proxy;


class Linenotify extends Transport

{

    protected $name = 'LINE Notify';


    public function deliverAlert($obj, $opts)

    {

        $opts['line-notify-access-token'] = $this->config['line-notify-access-token'];


        return $this->contactLinenotify($obj, $opts);

    }


    private function contactLinenotify($obj, $opts)

    {

        $lineUrl = 'https://notify-api.line.me/api/notify';

        $lineHead = ['Authorization: Bearer ' . $opts['line-notify-access-token']];

        $lineFields = ['message' => $obj['msg']];


        $curl = curl_init();

        Proxy::applyToCurl($curl);

        curl_setopt($curl, CURLOPT_URL, $lineUrl);

        curl_setopt($curl, CURLOPT_HTTPHEADER, $lineHead);

        curl_setopt($curl, CURLOPT_NOBODY, false);

        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

        curl_setopt($curl, CURLOPT_POST, true);

        curl_setopt($curl, CURLOPT_POSTFIELDS, $lineFields);

        curl_exec($curl);

        $code = curl_getinfo($curl, CURLINFO_HTTP_CODE);

        curl_close($curl);

        if ($code != 200) {

            return 'HTTP Status code ' . $code;

        }


        return true;

    }


    public static function configTemplate()

    {

        return [

            'config' => [

                [

                    'title' => 'Token',

                    'name' => 'line-notify-access-token',

                    'descr' => 'LINE Notify Token',

                    'type' => 'text',

                ],

            ],

            'validation' => [

                'line-notify-access-token' => 'required|string',

            ],

        ];

    }

}

[root@Oracle9 Transport]#


抄改成 Jandi 的程式如下所示 


[root@Oracle9 Transport]# pwd

/opt/librenms/LibreNMS/Alert/Transport

[root@Oracle9 Transport]# cat Jandi.php

<?php

/**

 * Jandi webhook Transport

 */



namespace LibreNMS\Alert\Transport;


use LibreNMS\Alert\Transport;

use LibreNMS\Util\Proxy;


class Jandi extends Transport

{


    protected $name = 'Jandi';



    public function deliverAlert($obj, $opts)

    {

        $opts['jandi-webhook-access-token'] = $this->config['jandi-webhook-access-token'];

        $opts['jandi-webhook-access-rec'] = $this->config['jandi-webhook-access-rec'];

        return $this->contactLineNotify($obj, $opts);

    }


    private function contactLinenotify($obj, $opts)

    {

        $webhooktoken=$opts['jandi-webhook-access-token'];

        $webhookid=$opts['jandi-webhook-access-rec'];

        $lineUrl = "https://wh.jandi.com/connect-api/webhook/$webhooktoken/$webhookid";

        $lineHead = ['Accept: application/vnd.tosslab.jandi-v2+json','Content-Type: application/json'];

        // $lineFields = [body' => body , 'connectColor' => '#FAC11B' , 'connectInfo' => [ 'title' => title , 'description' => $obj['msg'] ] ];


        $jmsg=$obj['msg'];


        $nowtime=date('Y-m-d H:i:s');


        $lineFields = <<<DATA

        {

        "body" : "$nowtime",

        "connectColor" : "#FAC11B",

        "connectInfo" : [

           { "title" : "AlertMessage",

             "description" : "$jmsg"

           }

         ]

        }

        DATA;


        // $lineFields = ["body" => body];

        $curl = curl_init();

        curl_setopt($curl, CURLOPT_URL, $lineUrl);

        curl_setopt($curl, CURLOPT_HTTPHEADER, $lineHead);

        curl_setopt($curl, CURLOPT_NOBODY, false);

        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

        curl_setopt($curl, CURLOPT_POST, true);

        curl_setopt($curl, CURLOPT_POSTFIELDS, $lineFields);

        curl_exec($curl);

        $code = curl_getinfo($curl, CURLINFO_HTTP_CODE);

        curl_close($curl);

        if ($code != 200) {

            return 'HTTP Status code ' . $code;

        }


        return true;

    }


    public static function configTemplate()

    {

        return [

            'config' => [

                [

                    'title' => 'Jandi WebHook Token',

                    'name' => 'jandi-webhook-access-token',

                    'descr' => 'Jandi WEBHOOK Token',

                    'type' => 'text',

                ],

                [

                    'title' => 'Jandi WebHook Recipient',

                    'name' => 'jandi-webhook-access-rec',

                    'descr' => 'Jandi WEBHOOK Recipient',

                    'type' => 'text',

                ],


            ],

            'validation' => [

                'jandi-webhook-access-token' => 'required|string',

                'jandi-webhook-access-rec' => 'required|string',

            ],

        ];

    }

}

[root@Oracle9 Transport]#


DEMO












2023年11月2日 星期四

Synology NAS 透過 WebHook 機制發 Alert 到 Line Notify

申請 Token URL 如下

https://notify-bot.line.me/zh_TW/

CURL 測試方式示意

curl -X POST -H 'Authorization: Bearer [LineNotify]' -F 'message=TestMessage' https://notify-api.line.me/api/notify

實際運用:

curl -X POST -H 'Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXX -F 'message=TestMessage' https://notify-api.line.me/api/notify


LineNotify API URL 

https://notify-api.line.me/api/notify


 圖解:



Webhook 網址:請輸入

https://notify-api.line.me/api/notify?message=%40%40TEXT%40%40




 HTTP請求

其實就是最上面那個 CURL 的用法,只是改成以 WEB  輸入的方式呈現.
觀念是一樣的.


可以經由 發送測試通知 去驗證是否正常




如果正常應該會收到如下的 Alert 訊息



FortiGate 也是可以比照辦理.




如有興趣詳見:










2023年10月28日 星期六

FortiGate Automation webhook 加 Line Notify API Webhook 實驗

 延續做實驗

接續 Line Notify API Webhook 實驗

https://xrcd2.blogspot.com/2023/09/line-notify-api-webhook.html


再加入 FortiGate Automation webhook 做進階實驗

簡要架構

FTG--> Automation webhook ->LineNotifyAPI-webhook-Server-->Alert---> LineNotify

 (以下實驗架構)

實務上的用法較正確的做法如下所示

 FTG-> Automation webhook -> https://notify-api.line.me/api/notify --> Alert---> LineNotify

 (一般用法)

申請 Token URL 如下

https://notify-bot.line.me/zh_TW/


CURL 測試方式

curl -X POST -H 'Authorization: Bearer [access_token]' -F 'message=TestMessage' https://notify-api.line.me/api/notify


實驗截圖開始














正常的用法可能長這樣 直打  https://notify-api.line.me/api/notify



Debug 

正常發出訊息


傳送訊息加入 %%log%%  

看來有將 log 訊息加上,但可能死在 json 或 curl 不支援 %%log%% ,可能是 保留字 吧.

有空再研究啦!


Demo




以上畫面的截取為 FTG7 如使用 FTG  6 的畫面如下所示





我是在家中的 IP 分享器底下的 VM 去做實驗的

如果直打 https://notify-api.line.me/api/notify 問題會死在 

auto_curl_perform()-107: Curl perform error:35 - SSL connect error.

__action_webhook_status()-150: Failed to perform curl for url:https://notify-api.line.me/api/notify.

__run_action()-298: Error when running service for stitch:AdminLoginAlert action:SendAlert2Line.

但很怪的是 VM 上網對外是全開的.

且用 CURL 去測也是正常的.. GG

FortiOS 的底層的 curl 可能很不一般吧..(很神奇的那一種) ..~^_^~.


WAN IP unknown




最後手段








終於成功啦!










2023年10月15日 星期日

CentOS 7.9 Install BIND 9.16 Extended Support Version Packages

 

yum install scl-utils scl-utils-build iso-codes-devel.noarch iso-codes.noarch


vi /etc/yum.repos.d/isc-bind-esv-epel-7.repo

[copr:copr.fedorainfracloud.org:isc:bind-esv]

name=Copr repo for bind-esv owned by isc

baseurl=https://download.copr.fedorainfracloud.org/results/isc/bind-esv/epel-7-$basearch/

type=rpm-md

skip_if_unavailable=True

gpgcheck=1

gpgkey=https://download.copr.fedorainfracloud.org/results/isc/bind-esv/pubkey.gpg

repo_gpgcheck=0

enabled=1

enabled_metadata=1


https://copr.fedorainfracloud.org/coprs/isc/bind-esv


Description


BIND 9.16 Extended Support Version Packages


This Copr contains the core BIND 9 DNS server and all the required dependencies for the popular DNSTAP 

logging feature. These packages are provided by the BIND developer, not the operating system, and is 

intended to provide an up-to-date version of BIND. It is not suitable for use if you are relying on 

operating system-specific features, such as, for example FreeIPA.


Installation Instructions

To use this Copr repository, please first enable it by following the Quick Enable instructions on the right of your screen.


Once the repository is enabled, run yum install isc-bind (RHEL/CentOS 7) or dnf install isc-bind (RHEL/CentOS 8, Fedora). 


This will install the BIND 9 Software Collection.


NOTE: The above commands are the only supported way of installing the BIND 9 Software Collection.

The BIND 9 Software Collection consists of several packages, the most important of which are:


isc-bind-bind, which contains the named binary, the rndc tool, DNSSEC utilities, and related configuration/system files,

isc-bind-bind-utils, which contains other BIND 9 utilities, most importantly dig and nsupdate.

Quick reference for the named daemon:


The configuration file can be found at:

/etc/opt/isc/isc-bind/named.conf (RHEL/CentOS 7)

/etc/opt/isc/scls/isc-bind/named.conf (RHEL/CentOS 8, Fedora)

Command line options for the daemon can be specified in:

/etc/opt/isc/isc-bind/sysconfig/named (RHEL/CentOS 7)

/etc/opt/isc/scls/isc-bind/sysconfig/named (RHEL/CentOS 8, Fedora)

To start the daemon, run systemctl start isc-bind-named.

If you want the daemon to start at boot time, run systemctl enable isc-bind-named.

Note that due to the nature of Software Collections, no BIND 9 daemon or utility installed by these packages is available in 

$PATH by default. To be able to use them, do the following:


to enable the Software Collection for the current shell, run scl enable isc-bind bash

to enable the Software Collection inside a shell script, add the following line to it: source scl_source enable isc-bind

The latter line can also put in one of your shell initialization files (like ~/.bash_profile) to automatically enable the 

Software Collection upon every login (caveats apply). For more ways of enabling a Software Collection (that might better fit your needs),

 please consult the Software Collection documentation.


Providing BIND 9 as a Software Collection allows the latest supported versions released by ISC to be installed along stock OS packages 

(which are usually based on older releases) on the same machine. If for some reason you prefer to use classic packages that do not 

comprise a Software Collection, the source RPMs published in this Copr can be conveniently rebuilt using --without scl.

 Note, however, that the resulting packages cannot be installed on a machine which also has stock OS packages installed.


For more BIND 9 documentation, including instructions on installing from source, please take a look at the ISC Knowledge Base.


To report a bug, please fill out the bug report form in ISC GitLab.




 



2023年10月13日 星期五

DKIM DNS Record Test LAB

 [root@AlmaLinux92 log]# dig TXT test.tw @192.168.100.200


; <<>> DiG 9.16.23-RH <<>> TXT test.tw @192.168.100.200

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62113

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1


;; OPT PSEUDOSECTION:

; EDNS: version: 0, flags:; udp: 1232

; COOKIE: d0864ba0ace624b4010000006529c783cefa39d8595c18c5 (good)

;; QUESTION SECTION:

;test.tw. IN TXT


;; ANSWER SECTION:

test.tw. 86400 IN TXT "v=spf1 mx ip4:60.123.123.123/27 ip4:211.123.123.213 ip4:211.123.123.215 ip4:211.123.123.211 ~all"

test.tw. 86400 IN TXT "v=DKIM1; k=rsa; p=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

test.tw. 86400 IN TXT "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"

test.tw. 86400 IN TXT "YYYYYYYYYYYYYYYYYYYYYYYYYYY"


;; Query time: 0 msec

;; SERVER: 192.168.100.200#53(192.168.100.200)

;; WHEN: Sat Oct 14 06:41:07 CST 2023

;; MSG SIZE  rcvd: 522


[root@AlmaLinux92 log]# 



[root@AlmaLinux92 log]# named -v

BIND 9.16.23-RH (Extended Support Version) <id:fde3b1f>

[root@AlmaLinux92 log]# 



============================================================


[root@AlmaLinux92 log]# cat /etc/named.conf 

//

// named.conf

//

// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS

// server as a caching only nameserver (as a localhost DNS resolver only).

//

// See /usr/share/doc/bind*/sample/ for example named configuration files.

//


options {

listen-on port 53 { any; };

directory "/var/named";

dump-file "/var/named/data/cache_dump.db";

statistics-file "/var/named/data/named_stats.txt";

memstatistics-file "/var/named/data/named_mem_stats.txt";

secroots-file "/var/named/data/named.secroots";

recursing-file "/var/named/data/named.recursing";

allow-query     { localhost; 0.0.0.0/0; };


/* 

- If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.

- If you are building a RECURSIVE (caching) DNS server, you need to enable 

   recursion. 

- If your recursive DNS server has a public IP address, you MUST enable access 

   control to limit queries to your legitimate users. Failing to do so will

   cause your server to become part of large scale DNS amplification 

   attacks. Implementing BCP38 within your network would greatly

   reduce such attack surface 

*/

recursion yes;


dnssec-validation no;


managed-keys-directory "/var/named/dynamic";

geoip-directory "/usr/share/GeoIP";


pid-file "/run/named/named.pid";

session-keyfile "/run/named/session.key";


/* https://fedoraproject.org/wiki/Changes/CryptoPolicy */

include "/etc/crypto-policies/back-ends/bind.config";

};


logging {

        channel default_debug {

                file "data/named.run";

                severity dynamic;

        };

};


zone "." IN {

        type hint;

        file "named.ca";

};


zone "test.tw" IN {

type master;

file "test.tw.zone";

        allow-query {any;};

};


include "/etc/named.rfc1912.zones";

include "/etc/named.root.key";


[root@AlmaLinux92 log]# cat  /var/named/test.tw.zone 

$TTL    86400

@       IN      SOA     dns.test.tw. root.test.tw. (

                     2023101401         ; Serial

                         604800         ; Refresh

                          86400         ; Retry

                        2419200         ; Expire

                          86400        ; Negative Cache TTL

);


@                IN      NS      dns.test.tw.

@                IN      A       192.168.100.200

dns.test.tw.        IN      A       192.168.100.200

test.tw.    IN      TXT     "v=DKIM1; k=rsa; p=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"


test.tw.    IN      TXT     "v=spf1 mx ip4:60.123.123.123/27 ip4:211.123.123.213 ip4:211.123.123.215 ip4:211.123.123.211 ~all"

test.tw.    IN      TXT     "YYYYYYYYYYYYYYYYYYYYYYYYYYY"

test.tw.    IN TXT     "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"


[root@AlmaLinux92 log]# cat  /etc/sysconfig/named

# BIND named process options

# ~~~~~~~~~~~~~~~~~~~~~~~~~~

#

# OPTIONS="whatever"     --  These additional options will be passed to named

#                            at startup. Don't add -t here, enable proper

#                            -chroot.service unit file.

#

# NAMEDCONF=/etc/named/alternate.conf

#                        --  Don't use -c to change configuration file.

#                            Extend systemd named.service instead or use this

#                            variable.

#

# DISABLE_ZONE_CHECKING  --  By default, service file calls named-checkzone

#                            utility for every zone to ensure all zones are

#                            valid before named starts. If you set this option

#                            to 'yes' then service file doesn't perform those

#                            checks.

#


OPTIONS="-4"

[root@AlmaLinux92 log]# 


====================================


C:\Users\xrcd2>nslookup

預設伺服器:  dns.hinet.net

Address:  168.95.1.1


> server 192.168.100.200

預設伺服器:  [192.168.100.200]

Address:  192.168.100.200


> set type=txt

> test.tw

伺服器:  [192.168.100.200]

Address:  192.168.100.200


test.tw text =


        "v=DKIM1; k=rsa; p=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

test.tw text =


        "YYYYYYYYYYYYYYYYYYYYYYYYYYY"

test.tw text =


        "v=spf1 mx ip4:60.123.123.123/27 ip4:211.123.123.213 ip4:211.123.123.215 ip4:211.123.123.211 ~all"

test.tw text =


        "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"

>



===============================



[root@AlmaLinux92 log]# dig TXT msa.hinet.net  @127.0.0.1


; <<>> DiG 9.16.23-RH <<>> TXT msa.hinet.net @127.0.0.1

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1278

;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1


;; OPT PSEUDOSECTION:

; EDNS: version: 0, flags:; udp: 1232

; COOKIE: 1f3935b5ab413596010000006529c90ef407026e93083ccd (good)

;; QUESTION SECTION:

;msa.hinet.net. IN TXT


;; ANSWER SECTION:

msa.hinet.net. 86400 IN TXT "v=spf1 redirect=spf.ms.hinet.net"

msa.hinet.net. 86400 IN TXT "v=DKIM1; k=rsa; p=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"


;; Query time: 347 msec

;; SERVER: 127.0.0.1#53(127.0.0.1)

;; WHEN: Sat Oct 14 06:47:42 CST 2023

;; MSG SIZE  rcvd: 362


[root@AlmaLinux92 log]# 



========================



[root@AlmaLinux92 log]# netstat -anulp | more

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    

udp        0      0 192.168.100.200:53      0.0.0.0:*                           10700/named         

udp        0      0 192.168.100.200:53      0.0.0.0:*                           10700/named         

udp        0      0 192.168.100.200:53      0.0.0.0:*                           10700/named         

udp        0      0 192.168.100.200:53      0.0.0.0:*                           10700/named         

udp        0      0 127.0.0.1:53            0.0.0.0:*                           10700/named         

udp        0      0 127.0.0.1:53            0.0.0.0:*                           10700/named         

udp        0      0 127.0.0.1:53            0.0.0.0:*                           10700/named         

udp        0      0 127.0.0.1:53            0.0.0.0:*                           10700/named         

udp        0      0 127.0.0.1:323           0.0.0.0:*                           905/chronyd         

udp6       0      0 ::1:323                 :::*                                905/chronyd   


      

[root@AlmaLinux92 log]# systemctl status named 

● named.service - Berkeley Internet Name Domain (DNS)

     Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; preset: disabled)

     Active: active (running) since Sat 2023-10-14 06:52:59 CST; 26s ago

    Process: 10696 ExecStartPre=/bin/bash -c if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi (code=exited, status=0/SUCCESS)

    Process: 10699 ExecStart=/usr/sbin/named -u named -c ${NAMEDCONF} $OPTIONS (code=exited, status=0/SUCCESS)

   Main PID: 10700 (named)

      Tasks: 14 (limit: 48696)

     Memory: 40.6M

        CPU: 42ms

     CGroup: /system.slice/named.service

             └─10700 /usr/sbin/named -u named -c /etc/named.conf -4


Oct 14 06:52:59 AlmaLinux92 named[10700]: zone localhost/IN: loaded serial 0

Oct 14 06:52:59 AlmaLinux92 named[10700]: zone test.tw/IN: loaded serial 2023101401

Oct 14 06:52:59 AlmaLinux92 named[10700]: zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0

Oct 14 06:52:59 AlmaLinux92 named[10700]: zone localhost.localdomain/IN: loaded serial 0

Oct 14 06:52:59 AlmaLinux92 named[10700]: zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 0

Oct 14 06:52:59 AlmaLinux92 named[10700]: all zones loaded

Oct 14 06:52:59 AlmaLinux92 named[10700]: running

Oct 14 06:52:59 AlmaLinux92 systemd[1]: Started Berkeley Internet Name Domain (DNS).

Oct 14 06:52:59 AlmaLinux92 named[10700]: managed-keys-zone: Key 20326 for zone . is now trusted (acceptance timer complete)

Oct 14 06:52:59 AlmaLinux92 named[10700]: resolver priming query complete

[root@AlmaLinux92 log]# 



===============

openkdim install & setting dns zone 


[root@AlmaLinux92 log]# yum install epel-release.noarch

Last metadata expiration check: 1:18:55 ago on Sat 14 Oct 2023 05:51:30 AM CST.

Dependencies resolved.

=================================================================================================================================================================================================================================================

 Package                                                       Architecture                                            Version                                                     Repository                                               Size

=================================================================================================================================================================================================================================================

Installing:

 epel-release                                                  noarch                                                  9-5.el9                                                     extras                                                   18 k


Transaction Summary

=================================================================================================================================================================================================================================================

Install  1 Package


Total download size: 18 k

Installed size: 25 k

Is this ok [y/N]: y

Downloading Packages:

epel-release-9-5.el9.noarch.rpm                                                                                                                                                                                   43 kB/s |  18 kB     00:00    

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                                                                                             13 kB/s |  18 kB     00:01     

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                                                                                                                                         1/1 

  Installing       : epel-release-9-5.el9.noarch                                                                                                                                                                                             1/1 

  Running scriptlet: epel-release-9-5.el9.noarch                                                                                                                                                                                             1/1 

Many EPEL packages require the CodeReady Builder (CRB) repository.

It is recommended that you run /usr/bin/crb enable to enable the CRB repository.


  Verifying        : epel-release-9-5.el9.noarch                                                                                                                                                                                             1/1 


Installed:

  epel-release-9-5.el9.noarch                                                                                                                                                                                                                    


Complete!

[root@AlmaLinux92 log]#



[root@AlmaLinux92 log]# dnf config-manager --set-enabled crb

[root@AlmaLinux92 log]# dnf install opendkim-tools opendkim

AlmaLinux 9 - CRB                                                                                                                                                                                                2.0 MB/s | 2.9 MB     00:01    

Last metadata expiration check: 0:00:01 ago on Sat 14 Oct 2023 07:14:38 AM CST.

Dependencies resolved.

=================================================================================================================================================================================================================================================

 Package                                                            Architecture                                         Version                                                        Repository                                          Size

=================================================================================================================================================================================================================================================

Installing:

 opendkim                                                           x86_64                                               2.11.0-0.34.el9                                                epel                                               224 k

 opendkim-tools                                                     x86_64                                               2.11.0-0.34.el9                                                epel                                                55 k

Installing dependencies:

 libbsd                                                             x86_64                                               0.11.7-2.el9                                                   epel                                               111 k

 libmd                                                              x86_64                                               1.1.0-1.el9                                                    epel                                                46 k

 libmemcached-awesome                                               x86_64                                               1.1.0-12.el9                                                   crb                                                110 k

 libopendkim                                                        x86_64                                               2.11.0-0.34.el9                                                epel                                                70 k

 opendbx                                                            x86_64                                               1.4.6-31.el9                                                   epel                                                52 k

 sendmail-milter                                                    x86_64                                               8.16.1-10.el9                                                  crb                                                 40 k


Transaction Summary

=================================================================================================================================================================================================================================================

Install  8 Packages


Total download size: 708 k

Installed size: 1.8 M

Is this ok [y/N]: y

Downloading Packages:

(1/8): sendmail-milter-8.16.1-10.el9.x86_64.rpm                                                                                                                                                                  272 kB/s |  40 kB     00:00    

(2/8): libbsd-0.11.7-2.el9.x86_64.rpm                                                                                                                                                                            432 kB/s | 111 kB     00:00    

(3/8): libmemcached-awesome-1.1.0-12.el9.x86_64.rpm                                                                                                                                                              408 kB/s | 110 kB     00:00    

(4/8): libopendkim-2.11.0-0.34.el9.x86_64.rpm                                                                                                                                                                    1.1 MB/s |  70 kB     00:00    

(5/8): libmd-1.1.0-1.el9.x86_64.rpm                                                                                                                                                                              262 kB/s |  46 kB     00:00    

(6/8): opendkim-tools-2.11.0-0.34.el9.x86_64.rpm                                                                                                                                                                 745 kB/s |  55 kB     00:00    

(7/8): opendkim-2.11.0-0.34.el9.x86_64.rpm                                                                                                                                                                       1.7 MB/s | 224 kB     00:00    

(8/8): opendbx-1.4.6-31.el9.x86_64.rpm                                                                                                                                                                           251 kB/s |  52 kB     00:00    

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                                                                                            410 kB/s | 708 kB     00:01     

Extra Packages for Enterprise Linux 9 - x86_64                                                                                                                                                                   1.6 MB/s | 1.6 kB     00:00    

Importing GPG key 0x3228467C:

 Userid     : "Fedora (epel9) <epel@fedoraproject.org>"

 Fingerprint: FF8A D134 4597 106E CE81 3B91 8A38 72BF 3228 467C

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9

Is this ok [y/N]: y

Key imported successfully

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                                                                                                                                         1/1 

  Installing       : opendbx-1.4.6-31.el9.x86_64                                                                                                                                                                                             1/8 

  Installing       : libmemcached-awesome-1.1.0-12.el9.x86_64                                                                                                                                                                                2/8 

  Installing       : libmd-1.1.0-1.el9.x86_64                                                                                                                                                                                                3/8 

  Installing       : libbsd-0.11.7-2.el9.x86_64                                                                                                                                                                                              4/8 

  Installing       : libopendkim-2.11.0-0.34.el9.x86_64                                                                                                                                                                                      5/8 

  Installing       : sendmail-milter-8.16.1-10.el9.x86_64                                                                                                                                                                                    6/8 

  Running scriptlet: opendkim-2.11.0-0.34.el9.x86_64                                                                                                                                                                                         7/8 

  Installing       : opendkim-2.11.0-0.34.el9.x86_64                                                                                                                                                                                         7/8 

  Running scriptlet: opendkim-2.11.0-0.34.el9.x86_64                                                                                                                                                                                         7/8 

  Installing       : opendkim-tools-2.11.0-0.34.el9.x86_64                                                                                                                                                                                   8/8 

  Running scriptlet: opendkim-tools-2.11.0-0.34.el9.x86_64                                                                                                                                                                                   8/8 

  Verifying        : libmemcached-awesome-1.1.0-12.el9.x86_64                                                                                                                                                                                1/8 

  Verifying        : sendmail-milter-8.16.1-10.el9.x86_64                                                                                                                                                                                    2/8 

  Verifying        : libbsd-0.11.7-2.el9.x86_64                                                                                                                                                                                              3/8 

  Verifying        : libmd-1.1.0-1.el9.x86_64                                                                                                                                                                                                4/8 

  Verifying        : libopendkim-2.11.0-0.34.el9.x86_64                                                                                                                                                                                      5/8 

  Verifying        : opendbx-1.4.6-31.el9.x86_64                                                                                                                                                                                             6/8 

  Verifying        : opendkim-2.11.0-0.34.el9.x86_64                                                                                                                                                                                         7/8 

  Verifying        : opendkim-tools-2.11.0-0.34.el9.x86_64                                                                                                                                                                                   8/8 


Installed:

  libbsd-0.11.7-2.el9.x86_64           libmd-1.1.0-1.el9.x86_64 libmemcached-awesome-1.1.0-12.el9.x86_64 libopendkim-2.11.0-0.34.el9.x86_64 opendbx-1.4.6-31.el9.x86_64 opendkim-2.11.0-0.34.el9.x86_64 opendkim-tools-2.11.0-0.34.el9.x86_64

  sendmail-milter-8.16.1-10.el9.x86_64


Complete!

[root@AlmaLinux92 log]# 




[root@AlmaLinux92 test.tw]# pwd

/etc/opendkim/keys/test.tw

[root@AlmaLinux92 test.tw]# ll

total 0

[root@AlmaLinux92 test.tw]# opendkim-genkey -b 2048 -r -s default -d test.tw -D /etc/opendkim/keys/test.tw/

[root@AlmaLinux92 test.tw]# ll

total 8

-rw------- 1 root root 1704 Oct 14 07:27 default.private

-rw------- 1 root root  502 Oct 14 07:27 default.txt

[root@AlmaLinux92 test.tw]# chown opendkim.opendkim -R /etc/opendkim/keys/test.tw

[root@AlmaLinux92 test.tw]# ll

total 8

-rw------- 1 opendkim opendkim 1704 Oct 14 07:27 default.private

-rw------- 1 opendkim opendkim  502 Oct 14 07:27 default.txt

[root@AlmaLinux92 test.tw]# cat default.txt 



[root@AlmaLinux92 test.tw]# cat default.txt 

default._domainkey IN TXT ( "v=DKIM1; k=rsa; s=email; "

  "p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlaJDpwzwD8Xn/iKQPN4jD8V97/pQsCkUdnmJOf5gqQ4to1ehmM+3+P7EH7Id9XaL7dtyeOpxe63waunulPBNQ3TtEMuDbI3nCiscNEHxDICzmpqm99fpi/vzsMZ0MvN11/VdITgQ8qmUd6uzTfpEHNTgNzfBRuNc89Upw7MZuSL82AT+Pks3xuyIgBWXaouQQHXlw5P6hF0TLQ"

  "pfi3uAQEeI8g42rWV/cbCzXzrQ2MwOSEnVkuhQopNU5cdqYtuXkCRdebT2LoK2uFAYaEk6O58CSfKnEPB5q4Q8MVitL/qHq4IuJpGL1Lz7UGHEe5Krn+AVQnw58J7/OH/k8CrE1wIDAQAB" )  ; ----- DKIM key default for test.tw

[root@AlmaLinux92 test.tw]# 




[root@AlmaLinux92 test.tw]# vi /var/named/test.tw.zone 



test.tw. IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlaJDpwzwD8Xn/iKQPN4jD8V97/pQsCkUdnmJOf5gqQ4to1ehmM+3+P7EH7Id9XaL7dtyeOpxe63waunulPBNQ3TtEMuDbI3nCiscNEHxDICzmpqm9" "9fpi/vzsMZ0MvN11/VdITgQ8qmUd6uzTfpEHNTgNzfBRuNc89Upw7MZuSL82AT+Pks3xuyIgBWXaouQQHXlw5P6hF0TLQ" "pfi3uAQEeI8g42rWV/cbCzXzrQ2MwOSEnVkuhQopNU5cdqYtuXkCRdebT2LoK2uFAYaEk6O58CSfKnEPB5q4Q8MVitL/qHq4IuJpGL1Lz7UGHEe5Krn+AVQnw58J7/OH/k8CrE1wIDAQAB"



#systemctl restart  named




[root@AlmaLinux92 test.tw]#  dig TXT test.tw @192.168.100.200


; <<>> DiG 9.16.23-RH <<>> TXT test.tw @192.168.100.200

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38844

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1


;; OPT PSEUDOSECTION:

; EDNS: version: 0, flags:; udp: 1232

; COOKIE: f74f11fd6e9c9d33010000006529d973b9f9e24db038b1ba (good)

;; QUESTION SECTION:

;test.tw. IN TXT


;; ANSWER SECTION:


.................

.................

test.tw. 86400 IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlaJDpwzwD8Xn/iKQPN4jD8V97/pQsCkUdnmJOf5gqQ4to1ehmM+3+P7EH7Id9XaL7dtyeOpxe63waunulPBNQ3TtEMuDbI3nCiscNEHxDICzmpqm9" "9fpi/vzsMZ0MvN11/VdITgQ8qmUd6uzTfpEHNTgNzfBRuNc89Upw7MZuSL82AT+Pks3xuyIgBWXaouQQHXlw5P6hF0TLQ" "pfi3uAQEeI8g42rWV/cbCzXzrQ2MwOSEnVkuhQopNU5cdqYtuXkCRdebT2LoK2uFAYaEk6O58CSfKnEPB5q4Q8MVitL/qHq4IuJpGL1Lz7UGHEe5Krn+AVQnw58J7/OH/k8CrE1wIDAQAB"

.................

.................


;; Query time: 0 msec

;; SERVER: 192.168.100.200#53(192.168.100.200)

;; WHEN: Sat Oct 14 07:57:39 CST 2023

;; MSG SIZE  rcvd: 700


[root@AlmaLinux92 test.tw]# 




[root@AlmaLinux92 test.tw]#  dig TXT test.tw @192.168.100.200


; <<>> DiG 9.16.23-RH <<>> TXT test.tw @192.168.100.200

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38844

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1


;; OPT PSEUDOSECTION:

; EDNS: version: 0, flags:; udp: 1232

; COOKIE: f74f11fd6e9c9d33010000006529d973b9f9e24db038b1ba (good)

;; QUESTION SECTION:

;test.tw. IN TXT


;; ANSWER SECTION:


.................

.................

test.tw. 86400 IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlaJDpwzwD8Xn/iKQPN4jD8V97/pQsCkUdnmJOf5gqQ4to1ehmM+3+P7EH7Id9XaL7dtyeOpxe63waunulPBNQ3TtEMuDbI3nCiscNEHxDICzmpqm9" "9fpi/vzsMZ0MvN11/VdITgQ8qmUd6uzTfpEHNTgNzfBRuNc89Upw7MZuSL82AT+Pks3xuyIgBWXaouQQHXlw5P6hF0TLQ" "pfi3uAQEeI8g42rWV/cbCzXzrQ2MwOSEnVkuhQopNU5cdqYtuXkCRdebT2LoK2uFAYaEk6O58CSfKnEPB5q4Q8MVitL/qHq4IuJpGL1Lz7UGHEe5Krn+AVQnw58J7/OH/k8CrE1wIDAQAB"

.................

.................


;; Query time: 0 msec

;; SERVER: 192.168.100.200#53(192.168.100.200)

;; WHEN: Sat Oct 14 07:57:39 CST 2023

;; MSG SIZE  rcvd: 700



[root@AlmaLinux92 test.tw]# 




=================




> set type=txt

> test.tw

伺服器:  [192.168.100.200]

Address:  192.168.100.200


............


test.tw text =


"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlaJDpwzwD8Xn/iKQPN4jD8V97/pQsCkUdnmJOf5gqQ4to1ehmM+3+P7EH7Id9XaL7dtyeOpxe63waunulPBNQ3TtEMuDbI3nCiscNEHxDICzmpqm9"

"9fpi/vzsMZ0MvN11/VdITgQ8qmUd6uzTfpEHNTgNzfBRuNc89Upw7MZuSL82AT+Pks3xuyIgBWXaouQQHXlw5P6hF0TLQ"

"pfi3uAQEeI8g42rWV/cbCzXzrQ2MwOSEnVkuhQopNU5cdqYtuXkCRdebT2LoK2uFAYaEk6O58CSfKnEPB5q4Q8MVitL/qHq4IuJpGL1Lz7UGHEe5Krn+AVQnw58J7/OH/k8CrE1wIDAQAB"


.................