Автор Тема: [РЕШЕНО] блокировка 25 порта  (Прочитано 8852 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн cubespace

  • Начинающий
  • *
  • Сообщений: 16
  • Рейтинг: 0
  • Пол: Мужской
    • Просмотр профиля
  • Откуда: страна ОС
блокировка 25 порта
« Ответ #15 : 11 ноября 2011, 12:28:35 »
Єто вывод при таком варианте:

int_if="igb1"
int_net="192.168.1.0/24"
int_ip="192.168.1.1"
table mail { 192.168.1.101, 192.168.1.3 }
pass quick on $int_if proto tcp from <mail> to $int_ip port 25
block quick on $int_if proto tcp from $int_net to $int_ip port 25


# pfctl -vsr
scrub in all fragment reassemble
  [ Evaluations: 781836    Packets: 410369    Bytes: 108826781   States: 0     ]
  [ Inserted: uid 0 pid 51638 ]
pass out all flags S/SA keep state
  [ Evaluations: 66739     Packets: 212053    Bytes: 139922248   States: 12603 ]
  [ Inserted: uid 0 pid 51638 ]
pass in all flags S/SA keep state
  [ Evaluations: 66739     Packets: 41430     Bytes: 27190522    States: 4497  ]
  [ Inserted: uid 0 pid 51638 ]
pass in on igb1 inet from any to ! 192.168.1.1 flags S/SA keep state (source-track rule, max-src-conn 2000) queue std
  [ Evaluations: 37079     Packets: 95892     Bytes: 63162606    States: 4605  ]
  [ Inserted: uid 0 pid 51638 ]
pass in on igb1 inet from <limited> to ! 192.168.1.1 flags S/SA keep state (source-track rule, max-src-conn 600) queue limited
  [ Evaluations: 22106     Packets: 88095     Bytes: 55410712    States: 4708  ]
  [ Inserted: uid 0 pid 51638 ]
pass in on igb1 inet from 192.168.1.3 to <modems> flags S/SA keep state queue admin
  [ Evaluations: 22768     Packets: 0         Bytes: 0           States: 0     ]
  [ Inserted: uid 0 pid 51638 ]
pass quick on igb1 inet proto tcp from <mail> to 192.168.1.1 port = smtp flags S/SA keep state
  [ Evaluations: 52430     Packets: 0         Bytes: 0           States: 0     ]
  [ Inserted: uid 0 pid 51638 ]
block drop quick on igb1 inet proto tcp from 192.168.1.0/24 to 192.168.1.1 port = smtp
  [ Evaluations: 15773     Packets: 0         Bytes: 0           States: 0     ]
  [ Inserted: uid 0 pid 51638 ]
block drop log on igb0 from <badhosts> to any
  [ Evaluations: 66746     Packets: 0         Bytes: 0           States: 0     ]
  [ Inserted: uid 0 pid 51638 ]


Оффлайн myst

  • Постоялец
  • ***
  • Сообщений: 372
  • Рейтинг: 8
  • Пол: Мужской
    • mistiq.master@gmail.com
    • mistiq.master
    • Просмотр профиля
  • Откуда: Владивосток
блокировка 25 порта
« Ответ #16 : 11 ноября 2011, 12:31:39 »
Говорю же, у вас срабатывают правила выше. Поставьте мои два правила сразу после нормализации и ната.
scrub.
٩(●̮̮̃•̃)۶

Оффлайн cubespace

  • Начинающий
  • *
  • Сообщений: 16
  • Рейтинг: 0
  • Пол: Мужской
    • Просмотр профиля
  • Откуда: страна ОС
блокировка 25 порта
« Ответ #17 : 11 ноября 2011, 12:36:05 »
Не помогает!

Вот так делал:

nat on $ext_if from $internal_net to any -> ($ext_if:0)
nat on $ext_if2 from $internal_net to any -> {$ext_if2:0}
nat on $ua9_if from $internal_net to any -> {$ua9_if:0}
nat on $ua9_if from <realnet> to any -> {$ua9_if:0}

pass quick on $int_if proto tcp from <mail> to $int_ip port 25
block quick on $int_if proto tcp from $int_net to $int_ip port 25

rdr on $ext_if proto tcp from any to $ext_ip port 27015 -> 192.168.1.101 port 27015
rdr on $ext_if proto udp from any to $ext_ip port 27015 -> 192.168.1.101 port 27015

и вот что получилось:

Enabling pf/etc/pf.conf:87: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:88: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:89: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:90: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:91: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:92: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:93: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:94: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:95: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:96: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:97: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:98: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:99: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:100: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:101: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:102: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:103: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:104: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:105: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:106: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:107: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:108: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:110: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:111: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:112: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:113: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:114: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:115: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:116: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:117: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:118: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:119: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:120: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:121: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:122: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:124: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:125: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:126: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:127: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:128: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:129: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:130: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:132: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:133: Rules must be in order: options, normalization, queueing, translation, filtering
pfctl: Syntax error in config file: pf rules not loaded


Оффлайн FessAectan

  • Модератор
  • Старожил
  • *****
  • Сообщений: 972
  • Рейтинг: 25
  • Пол: Мужской
  • На пути к просветлению
    • fessae@jabber.ru
    • fessae
    • Просмотр профиля
    • https://vistep.ru/
  • Откуда: vistep.ru
блокировка 25 порта
« Ответ #18 : 11 ноября 2011, 12:52:25 »
pass in on $int_if from any to !192.168.1.1 keep state (max-src-conn 2000) queue std
pass in on $int_if from <limited> to !192.168.1.1 flags S/SA  keep state (max-src-conn 600) queue limited
pass in on $int_if from 192.168.1.3 to <modems> queue admin
Это не нужно, достаточно одной строки
pass all

ps
лучше, все таки, использовать
block all в начале,а затем разрешать то что нужно
Мы переоцениваем себя завтрашнего, поэтому и страдаем прокрастинацией.

Оффлайн FessAectan

  • Модератор
  • Старожил
  • *****
  • Сообщений: 972
  • Рейтинг: 25
  • Пол: Мужской
  • На пути к просветлению
    • fessae@jabber.ru
    • fessae
    • Просмотр профиля
    • https://vistep.ru/
  • Откуда: vistep.ru
блокировка 25 порта
« Ответ #19 : 11 ноября 2011, 12:59:55 »
Тоже самое!

И я тут извиняюсь, в предедущем неправильно в казал :
192.168.1.103
нет в списке:
table <mail> { 192.168.1.101, 192.168.1.3, ХХ.ХХ.ХХ.189 )
но выход на 25 порт из 192.168.1.103, открыт ( :dash:

Так это же очевидно из вашего конфига.
Его нет в списке - ему разрешен доступ.
Если нужно запретить для всей локалки то пишите как-то так
block on $int_if proto tcp from $int_if:network to $int_ip port 25


pass quick on $int_if proto tcp from <mail> to $int_ip port 25
отсюда квик уберите
Мы переоцениваем себя завтрашнего, поэтому и страдаем прокрастинацией.

Оффлайн cubespace

  • Начинающий
  • *
  • Сообщений: 16
  • Рейтинг: 0
  • Пол: Мужской
    • Просмотр профиля
  • Откуда: страна ОС
блокировка 25 порта
« Ответ #20 : 11 ноября 2011, 13:08:10 »
Цель єтого списка была в том чтобы всем доступ закрыт, а только тем кто в списке разрешен

у меня 3 подсети:
192.168.1.0
192.168.2.0
192.168.3.0

и перечислять всех кому нельзя, из 3 под сетей, глупо будет 

Оффлайн FessAectan

  • Модератор
  • Старожил
  • *****
  • Сообщений: 972
  • Рейтинг: 25
  • Пол: Мужской
  • На пути к просветлению
    • fessae@jabber.ru
    • fessae
    • Просмотр профиля
    • https://vistep.ru/
  • Откуда: vistep.ru
блокировка 25 порта
« Ответ #21 : 11 ноября 2011, 13:12:44 »
Псоледний кусок правил я бы так переписал
pass all
block log  on $int_if inet proto tcp from $int_if:network to any port 25
pass on $int_if inet proto tcp from <mail> to port 25
block log on $ext_if from <badhosts> to any
Только из таблицы mail уберите реальный адрес, а для этого ip отдельное правило на другом интерфейсе!
Ну и соответственно в mail те кому можно из локальной сети
Мы переоцениваем себя завтрашнего, поэтому и страдаем прокрастинацией.

Оффлайн myst

  • Постоялец
  • ***
  • Сообщений: 372
  • Рейтинг: 8
  • Пол: Мужской
    • mistiq.master@gmail.com
    • mistiq.master
    • Просмотр профиля
  • Откуда: Владивосток
блокировка 25 порта
« Ответ #22 : 11 ноября 2011, 13:26:27 »
отсюда квик уберите
Квик то зачем убирать.
Квик никогда не помешает если надо что-то побырому запретить/разрешить и не хочется долго курить прохождение пакетов.
٩(●̮̮̃•̃)۶

Оффлайн myst

  • Постоялец
  • ***
  • Сообщений: 372
  • Рейтинг: 8
  • Пол: Мужской
    • mistiq.master@gmail.com
    • mistiq.master
    • Просмотр профиля
  • Откуда: Владивосток
блокировка 25 порта
« Ответ #23 : 11 ноября 2011, 13:27:30 »
Не помогает!

Вот так делал:

nat on $ext_if from $internal_net to any -> ($ext_if:0)
nat on $ext_if2 from $internal_net to any -> {$ext_if2:0}
nat on $ua9_if from $internal_net to any -> {$ua9_if:0}
nat on $ua9_if from <realnet> to any -> {$ua9_if:0}

pass quick on $int_if proto tcp from <mail> to $int_ip port 25
block quick on $int_if proto tcp from $int_net to $int_ip port 25

rdr on $ext_if proto tcp from any to $ext_ip port 27015 -> 192.168.1.101 port 27015
rdr on $ext_if proto udp from any to $ext_ip port 27015 -> 192.168.1.101 port 27015

и вот что получилось:

Enabling pf/etc/pf.conf:87: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:88: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:89: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:90: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:91: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:92: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:93: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:94: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:95: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:96: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:97: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:98: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:99: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:100: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:101: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:102: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:103: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:104: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:105: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:106: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:107: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:108: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:110: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:111: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:112: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:113: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:114: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:115: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:116: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:117: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:118: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:119: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:120: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:121: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:122: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:124: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:125: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:126: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:127: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:128: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:129: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:130: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:132: Rules must be in order: options, normalization, queueing, translation, filtering
/etc/pf.conf:133: Rules must be in order: options, normalization, queueing, translation, filtering
pfctl: Syntax error in config file: pf rules not loaded


Конечно это получилсь. Я же сказал ПОСЛЕ правил ната.
редирект это тоже нат.
٩(●̮̮̃•̃)۶

Оффлайн FessAectan

  • Модератор
  • Старожил
  • *****
  • Сообщений: 972
  • Рейтинг: 25
  • Пол: Мужской
  • На пути к просветлению
    • fessae@jabber.ru
    • fessae
    • Просмотр профиля
    • https://vistep.ru/
  • Откуда: vistep.ru
блокировка 25 порта
« Ответ #24 : 11 ноября 2011, 13:32:58 »
отсюда квик уберите
Квик то зачем убирать.
Квик никогда не помешает если надо что-то побырому запретить/разрешить и не хочется долго курить прохождение пакетов.

согласен, невнимательно на правила смотрел.
Мы переоцениваем себя завтрашнего, поэтому и страдаем прокрастинацией.

Оффлайн FessAectan

  • Модератор
  • Старожил
  • *****
  • Сообщений: 972
  • Рейтинг: 25
  • Пол: Мужской
  • На пути к просветлению
    • fessae@jabber.ru
    • fessae
    • Просмотр профиля
    • https://vistep.ru/
  • Откуда: vistep.ru
блокировка 25 порта
« Ответ #25 : 12 ноября 2011, 08:03:01 »
Проблема решена, автор или модераторы, исправьте тему.

Спасибо! Решено!
автор у нас отписался...
Мы переоцениваем себя завтрашнего, поэтому и страдаем прокрастинацией.