728x90
반응형

Postfix + header_checks in MySQL

 
In this tip I will describe how to implement Postfix header_checks along with MySQL . No blablabla....let's get straight to the point. For everything to work it is necessary to have MySQL installed. On Debian like distributions, type the following command to install the MySQL server: # apt-get install mysql-server-5.5 After that, follow the installation steps that will be described on the screen. Log in as ROOT in your MySQL and create the database "postfix", or any other name that is easy to identify: # mysql -u root -p CREATE DATABASE postfix; Enter the postfix database to be able to create the table inside it: use postfix;

Now create the header_checks table with the following command:

CREATE TABLE `header_checks` (
  `hc_id` int(11) NOT NULL AUTO_INCREMENT,
  `rule` varchar(255) NOT NULL,
  `action` varchar(255) NOT NULL,
  PRIMARY KEY ( `hc_id`),
  KEY `rule` (`rule`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8

Postfix preparation

I believe that you must already have Postfix installed on your server, there are already several articles dealing with its installation.

We will now create the configuration file for communicating with MySQL:

# vi /etc/postfix/header_checks.cf

Put this content inside the file we are editing:
user = YOUR_BANK_USER_postfix
password = YOUR_BANK_PASSWORD_postfix
hosts = IP_or_YOUR_Server_NAME
dbname = DATABASE_NAME_postfix
query = SELECT action FROM header_checks WHERE '%s' REGEXP rule LIMIT 0.1
Next step is to edit the configuration in the /etc/postfix/main.cf file , if you don't already have the line below, add it:
header_checks = mysql:/etc/postfix/header_checks.cf
With these steps completed, we just have to restart postfix and populate the header_checks table in MySQL, which I will show the correct syntax below.

# /etc/init.d/postfix restart

Creating check rules in MySQL

Here we don't have many secrets, what gave me more work was finding the correct syntax to write the rule, but I'll save you this hard work and pass the correct syntax the way I'm using it on my servers.

Access MYSQL:

# mysql -u root -p

use postfix;

INSERT INTO header_checks (`hc_id`, `rule`, `action`) VALUES (NULL, '^From:(.*)domain.com.br', 'DISCARD #SPAM Domain Detected');


Note that the syntax for REGEXP used by header_checks follows the following pattern:

^From:(.*)dominio.com.br

I particularly use this rule to block domains that usually send SPAMs, but we can use it, for example, to block messages with certain subjects, in this case the rule would look like this:

^Subject:(.*)PROPAGANDA

Well folks, that's it...

I hope the subject has been addressed in a clear and objective way.

Hugs.

Measure
Measure
 
 
728x90
SMALL
Posted by gromet
728x90
반응형

Windows Server Crash


728x90
SMALL
Posted by gromet
728x90
반응형

ls로 디렉토리 목록만 보는 몇가지 방법

 

find . -type d
find . -maxdepth 1 -type d
ls -l | awk '/^d/{print $NF}'
ls -F | grep /
ls -F | grep / | tr -d /
ls -d */

 

 

 

728x90
SMALL
Posted by gromet
728x90
반응형

ESXi 7.0 VMFSL 파티션 용량 문제

 

 

ESXi 7.0을 설치했는데 VMFSL 이라는 파티션이 용량을 다 차지하고 있어서
VMFS 파티션을 만들 수가 없었다.
ESXi 6에는 해당 파티션이 없었던 것으로 기억하고,
그동안에는 16GB USB 스틱에 설치를 했었기 때문에 크게 문제가 없었다.

이번에 작용 용량의 HDD에 설치하려고 하니 저런 문제를 발견하게 되었다.

기본적으로 120GB의 용량을 할당하는 것 같고 그 이하는 최대 용량을 할당하는 것 같다.

VMFSL 파티션을 줄이는 방법은
설치할 때 Shift+O 를 누르라고 5초 정도 시간을 주는데
그 때 키를 눌러서 옵션을 추가해 주면 된다고 한다.

autoPartitionOSDataSize=8192

 

라고 추가해 주면 8GB만 생성된다고 한다.

 

[참고사이트]
https://www.2cpu.co.kr/QnA/761935?&sfl=wr_subject&stx=esxi&sst=wr_hit&sod=desc&sop=and&page=6

 

#VMWARE #ESXi #ESXi7.02 #VMFSL #파티션

728x90
SMALL
Posted by gromet
728x90
반응형

기존에 주니퍼 외부 아이피의 80, 443 포트를 내부 서버로 포트포워딩 하고 있었다.

 

[edit]
root@SRX340# show security nat destination
pool 192_168_2_2_443 {
    address 192.168.2.2/32 port 443;
}
pool 192_168_2_2_80 {
    address 192.168.2.2/32 port 80;
}
rule-set nsw_destnat {
    from zone Internet;
    rule 0_Web_Server--DMZ_443 {
        match {
            source-address 0.0.0.0/0;
            destination-address 0.0.0.0/0;
            destination-port {
                443;
            }
        }
        then {
            destination-nat {
                pool {
                    192_168_2_2_443;
                }
            }
        }
    }
    rule 0_Web_Server--DMZ_80 {
        match {
            source-address 0.0.0.0/0;
            destination-address 0.0.0.0/0;
            destination-port {
                80;
            }
        }
        then {
            destination-nat {
                pool {
                    192_168_2_2_80;
                }
            }
        }
    }
}

 

이것을

80->81

443-> 444

로 변경하였다.

 

방법을 얘기하자면 변경하려고 하는 포트를 set 명령으로 추가하고 기존 포트를 delete 명령으로 삭제해 주면된다.

 



root@SRX340> edit
Entering configuration mode
The configuration has been changed but not committed

root@SRX340> configure
Entering configuration mode
The configuration has been changed but not committed

root@SRX340# edit security nat destination
root@SRX340# set rule-set nsw_destnat rule 0_Web_Server--DMZ_443 match destination-port 444

[edit security nat destination]
root@SRX340# delete rule-set nsw_destnat rule 0_Web_Server--DMZ_443 match destination-port 443

[edit security nat destination]
root@SRX340# set rule-set nsw_destnat rule 0_Web_Server--DMZ_80 match destination-port 81

[edit security nat destination]
root@SRX340# delete rule-set nsw_destnat rule 0_Web_Server--DMZ_80 match destination-port 80

[edit security nat destination]
root@SRX340# commit check
configuration check succeeds

[edit security nat destination]
root@SRX340# commit
commit complete

[edit security nat destination]
root@SRX340# exit

 

#주니퍼 #포트포워딩 #환경설정수정 #Juniper #PortForwarding #SRX340

728x90
SMALL
Posted by gromet
728x90
반응형

After upgrading to 10.2R3 and 10.3R1 or later releases, J-Web access may not work if that interface is also terminating an IPSec VPN tunnel.

 

주니퍼 관리 페이지에 접속하려고 했더니 로그인 페이지가 아니라 Pulse Client 안내 페이지가 나온다.

확인해 보니 IPSec VPN이 활성화 되어 있으면 모든 http/https 접속이 Dynamic VPN 페이지로 연결된다고 한다.

그동안 여러 대의 주니퍼를 세팅했지만 이번에 처음 봤는데, 그동안에는 VPN을 활성화하지 않아서 였던 것 같다.

 

 

Interfaces terminating an IPSec tunnel will redirect all HTTP and HTTPS requests to the Dynamic VPN domain.
Example:https:// <srx-domain-or-ip> /dynamic-vpn

 

해결 방법은 관리자 페이지 URL을 환경설정에 등록해 주면 된다.

 

 

In order to allow J-Web management on an interface which is terminating an IPSec VPN, you must configure management-url for J-Web access:

set system services web-management management-url <path>

For example, with the following configuration:
[edit system services]
lab@SRX210-poe.hk# show
web-management { 
    management-url admin; <=== Configuration added here.   
        http;   
        https { 
    system-generated-certificate; 
    }
}

J-Web management would require administrator to browse to:
http://x.x.x.x/admin
or
https://x.x.x.x/admin
(Where x.x.x.x is the interface IP address.)

 

 

URL을 admin으로 설정해 주고 접속하니 접속이 잘 된다.

 

 

 

 

[참고URL]

https://supportportal.juniper.net/s/article/Not-able-to-access-J-Web-management-on-SRX-Branch-after-upgrading-to-recent-JUNOS-10-2-and-later-releases?language=en_US 

 

Not able to access J-Web management on SRX-Branch after upgrading to recent JUNOS 10.2 and later releases.

×Sorry to interrupt This page has an error. You might just need to refresh it. [LWC component's @wire target property or method threw an error during value provisioning. Original error: [Cannot read properties of undefined (reading 'ContentDocumentId')]]

supportportal.juniper.net

 

#Juniper #SRX #SRX340 #J-Web #Management #주니퍼 #관리자페이지

 

728x90
SMALL
Posted by gromet

블로그 이미지
나는 운이 좋은 사람이다 나는 나날이 점점 더 좋아진다 내가 하는 선택과 행동은 반드시 성공으로 이어진다 내게는 인내력과 지속력이 있다 네게는 좋은것들만 모여든다
gromet

공지사항

Yesterday
Today
Total
반응형

달력

 « |  » 2025.1
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

160x600