86f8f47926b4f481dff12129631415498b145b82
Linux/firewalld.md
| ... | ... | @@ -35,8 +35,9 @@ firewalld を再起動/設定反映するまで反映されない。 |
| 35 | 35 | # firewall-cmd --permanent --add-service=http |
| 36 | 36 | ``` |
| 37 | 37 | |
| 38 | -## ユーザ定義サービスの追加(sshd)<br /> |
|
| 39 | -- 雛形を `/usr/lib/firewalld/services` から `/etc/firewalld/services` へコピーして編集する。(ポート変更) |
|
| 38 | +## ユーザ定義サービスの追加(sshd) |
|
| 39 | +- ポート変更。 |
|
| 40 | +- 雛形を `/usr/lib/firewalld/services` から `/etc/firewalld/services` へコピーして編集する。 |
|
| 40 | 41 | ``` |
| 41 | 42 | # cp -a /usr/lib/firewalld/services/ssh.xml /etc/firewalld/services/ssh-port.xml |
| 42 | 43 | ``` |
| ... | ... | @@ -56,6 +57,29 @@ firewalld を再起動/設定反映するまで反映されない。 |
| 56 | 57 | # firewall-cmd --reload |
| 57 | 58 | ``` |
| 58 | 59 | |
| 60 | +## ユーザ定義サービスの追加(samba) |
|
| 61 | +- VPNクライアントからの接続のみを許可。[[OpenVPN#仮想NIC|/Linux/OpenVPN#仮想nic]] |
|
| 62 | +- 雛形を `/usr/lib/firewalld/services` から `/etc/firewalld/services` へコピーして編集する。 |
|
| 63 | + ``` |
|
| 64 | + # cp -a /usr/lib/firewalld/services/samba.xml /etc/firewalld/services/samba-vpn.xml |
|
| 65 | + ``` |
|
| 66 | +- /etc/firewalld/services/samba-vpn.xml |
|
| 67 | + ```xml |
|
| 68 | + <?xml version="1.0" encoding="utf-8"?> |
|
| 69 | + <service> |
|
| 70 | + <short>Samba</short> |
|
| 71 | + <description>This option allows you to access and participate in Windows file and printer sharing networks. You need the samba package installed for this option to be useful.</description> |
|
| 72 | + <port protocol="tcp" port="445"/> |
|
| 73 | + <destination ipv4="192.168.1.0/24"/> |
|
| 74 | + </service> |
|
| 75 | + ``` |
|
| 76 | +- 既存のサービスを削除、修正したサービスを追加、反映。 |
|
| 77 | + ``` |
|
| 78 | + # firewall-cmd --permanent --delete-service=samba |
|
| 79 | + # firewall-cmd --permanent --add-service=samba-vpn |
|
| 80 | + # firewall-cmd --reload |
|
| 81 | + ``` |
|
| 82 | + |
|
| 59 | 83 | ## デフォルトゾーンで許可されているポートの確認 |
| 60 | 84 | ``` |
| 61 | 85 | # firewall-cmd --list-port |