ansibleguy.addons_nftables

<a href="https://netfilter.org/projects/nftables/index.html">
<img src="https://netfilter.org/images/netfilter-logo3.png" alt="NFTablesロゴ" width="400"/>
</a>

# Ansibleロール - NFTablesアドオン

Linuxサーバー上でNFTables用のアドオンをデプロイするロールです。

<a href='https://ko-fi.com/ansible0guy' target='_blank'><img height='35' style='border:0px;height:46px;' src='https://az743702.vo.msecnd.net/cdn/kofi3.png?v=0' border='0' alt='コーヒーを買ってください' />

[![Moleculeテストステータス](https://badges.ansibleguy.net/addons_nftables.molecule.svg)](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/molecule.sh.j2)
[![YamlLintテストステータス](https://badges.ansibleguy.net/addons_nftables.yamllint.svg)](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/yamllint.sh.j2)
[![PyLintテストステータス](https://badges.ansibleguy.net/addons_nftables.pylint.svg)](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/pylint.sh.j2)
[![Ansible-Lintテストステータス](https://badges.ansibleguy.net/addons_nftables.ansiblelint.svg)](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/ansiblelint.sh.j2)
[![Ansible Galaxy](https://badges.ansibleguy.net/galaxy.badge.svg)](https://galaxy.ansible.com/ui/standalone/roles/ansibleguy/addons_nftables)

Moleculeログ: [短い](https://badges.ansibleguy.net/log/molecule_addons_nftables_test_short.log), [完全](https://badges.ansibleguy.net/log/molecule_addons_nftables_test.log)

**テスト済み:**
* Debian 11
* Debian 12

## インストール

```bash
# 最新版
ansible-galaxy role install git+https://github.com/ansibleguy/addons_nftables

# Galaxyから
ansible-galaxy install ansibleguy.addons_nftables

# またはカスタムロールパスへ
ansible-galaxy install ansibleguy.addons_nftables --roles-path ./roles

ドキュメンテーション


使用方法

NFTablesの基本設定をansibleguy.infra_nftablesロールを使って管理できます!

設定

詳細な例はここにあります: !

必要に応じて設定を定義します:

nftables_addons:
  enable:
    dns: true  # DNSアドオンを有効にする
    dns_v6: true  # DNSアドオンのIPv6処理を有効にする
    iplist: true  # IPリストアドオンを有効にする
    iplist_v6: true  # IPリストアドオンのIPv6処理を有効にする
    # timer: true  # タイマー管理を自分でやりたい場合は無効にできます
    # systemd: true  # systemdタイマーを使用してアドオンを更新
    # cron: false  # cronジョブを使用してアドオンを更新
    # include: true  # /etc/nftables.confへのアドオンの自動含めを無効にする

  config:
    iplists:
      iplist_tor_exit_nodes:  # 変数名
        urls: ['https://check.torproject.org/torbulkexitlist']
        separator: "\n"
        comment: '#'
    dns_records:
      ntp_servers: ['0.europe.pool.ntp.org', '1.europe.pool.ntp.org']
      repo_debian: ['deb.debian.org', 'debian.map.fastlydns.net', 'security.debian.org']

  ext: 'nft'  # nftables設定ファイルの拡張子
  path:
    base:
      config: '/etc/nftables.conf'
      dir: '/etc/nftables.d'
    addon:
      dir: '/etc/nftables.d/addons'

  timer:
    systemd:
      dns: '*:0/15'  # 15分ごとに更新
      iplist: '*-*-* 00,12:00:00'  # 1日2回更新

    # cron:
    #   dns:  # 15分ごと
    #     minute: '*/15'
    #   iplist:  # 1日2回
    #     minute: '0'
    #     hour: '0,12'

実行

プレイブックを実行します:

ansible-playbook -K -D -i inventory/hosts.yml playbook.yml

便利なタグも利用可能です:

  • dns
  • iplist
  • config (アドオン設定のみ更新)

エラーをデバッグするには、実行時に'debug'変数を設定します:

ansible-playbook -K -D -i inventory/hosts.yml playbook.yml -e debug=yes

機能

  • 設定

    • デフォルト設定:

      • アドオンを実行するためのsystemdタイマー
      • Syslogへのログ記録
      • IPv6変数の付録: '_v6'
        • 例:変数 'repo_debian' => 'repo_debian_v6'
      • タイマー
        • DNS => 15分ごとに更新
        • IPリスト => 1日2回更新
      • Systemd
        • Syslog ID: 'nftables_addon_{ addon }'
        • サービス/タイマープレフィックス: 'ansibleguy.addons_nftables-'
    • デフォルトオプトイン:

      • 変数を自動更新するためのタイマー
      • systemdタイマー
      • '/etc/nftables.conf'への含め追加
    • デフォルトオプトアウト:

      • アドオン
        • DNS
          • DNS IPv6処理
        • IPリスト
          • IPリストのIPv6処理
      • cronジョブタイマー

情報

  • 注意: このロールは現在、Debianベースのシステムのみをサポートしています。

  • 注意: このロールの機能のほとんどは、オプトインまたはオプトアウトできます。

    利用可能なすべてのオプションについては、デフォルト設定ファイルを確認してください!

  • 警告: 提供されたすべての設定/変数が有効性チェックされるわけではありません。誤った設定はロールを壊す可能性があります!

  • 注意: 定義された変数はすべて作成されます。欠けている変数があると設定が壊れる可能性があります!

    DNSレコードが解決できない場合や、エントリが返されない場合は、フォールバック値(_IPv4: 0.0.0.0, IPv6: ::_)が設定されます。

```

プロジェクトについて

Ansible Role to provision Add-Ons for NFTables on Linux servers

インストール
ansible-galaxy install ansibleguy.addons_nftables
ライセンス
other
ダウンロード
2k
所有者
[email protected] | GPG: https://badges.ansibleguy.net/public.gpg