Advertisement
ZX_CV

add_user_SSH_config.yaml

Apr 28th, 2024
932
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.36 KB | None | 0 0
  1. add_user_SSH_config.yaml
  2.  
  3. #Menambahkan pengguna dan mengganti default port SSH serta whitelist untuk IP server SSH
  4. #---
  5. #- name: Tambah pengguna IT
  6. #  hosts: routers
  7. #  gather_facts: no
  8. #  tasks:
  9. #    - name: Tambah pengguna IT
  10. #      community.routeros.command:
  11. #        commands:
  12. #          - "/user add name=IT password=test123 group=full"
  13.  
  14. - name: Konfigurasi firewall MikroTik untuk mengizinkan SSH dari IP tertentu
  15.   hosts: routers
  16.   gather_facts: no
  17.   tasks:
  18.     - name: Tambahkan IP ke daftar alamat
  19.       community.routeros.command:
  20.         commands:
  21.          - "/ip firewall address-list add address=192.168.1.3 comment=\"IP SERVER\" list=ssh_allowed"
  22.  
  23.     - name: Tambahkan aturan firewall untuk mengizinkan SSH dari IP tertentu
  24.       community.routeros.command:
  25.         commands:
  26.          - "/ip firewall filter add chain=input protocol=tcp dst-port=2224 src-address-list=ssh_allowed comment=\"SSH\" action=accept"
  27.  
  28.     - name: Tolak koneksi SSH dari IP lainnya
  29.       community.routeros.command:
  30.         commands:
  31.          - "/ip firewall filter add chain=input protocol=tcp dst-port=2224 comment=\"SSH\" action=drop"
  32.  
  33. - name: Mengganti port SSH pada perangkat MikroTik
  34.   hosts: routers
  35.   gather_facts: no
  36.   tasks:
  37.     - name: Ubah port SSH
  38.       community.routeros.command:
  39.         commands:
  40.          - "/ip service set ssh port=2224"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement