Posts

Showing posts from May, 2018

Postfix only allow whitelisted Recipient Domain

Image
In this tutorial, How to Configure " Postfix only allow whitelisted Recipient Domain ". We test environment with user data. To minimize the risk of sending to unwanted email recipients. Step 1: Add line into main.cf file as below smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recipient_domains, reject Note: Warring /etc/postfix/recipient_domains, reject , Allow receive email in recipient_domain, and REJECT All domain not in whitelisted domain. Step 2: To create recipient domain is the whitelist file mycompany.com OK mail.huuphan.com OK Note: only two domain mycompany.com and mail.huuphan.com receive mail Step 3: To generate hash file: $ sudo postmap /etc/postfix/recipient_domains Step 4: To restart postfix service $ sudo /etc/init.d/postfix restart Now to try sending an email to a another domain not in whitelist. You will find error something like that as below: NOQUEUE: reject: RCPT from …: 554 5.7.1 <[email protected]&g

Bash script arguments from a file content:Mastering Shell Scripting

Image
Introduction Learn how to change string content of a file using bash script arguments. This guide provides detailed steps and examples, from default values to custom arguments. Master shell scripting to dynamically update file content efficiently. Bash scripting is a versatile and powerful tool for automating tasks and managing system operations. One common requirement is changing specific string content in a file using arguments passed to a script. This guide will demonstrate how to achieve this with a bash script, covering both default values and custom arguments. By following this tutorial, you will enhance your scripting skills and be able to dynamically update file content efficiently. In this tutorial, how to change string content of file as arguments. I written  Bash script arguments from a file content as below: What is Bash Scripting? Bash scripting involves writing a series of commands in a text file to be executed by the Bash shell . It is widely used for automating repetiti

Bash script argument default value and takes optional input arguments

Image
Introduction Learn how to handle default values for arguments and optional input arguments in Bash scripts. This comprehensive guide covers everything from basic to advanced examples, ensuring you can write efficient and flexible scripts. Bash scripting is a powerful tool for automating tasks and managing systems. One essential aspect of writing efficient Bash scripts is handling arguments and providing default values. This ensures that your scripts can handle various scenarios without requiring mandatory inputs every time. In this article, we will explore how to handle default values for arguments and optional input arguments in Bash scripts, from basic to advanced examples. Understanding Bash Script Arguments What are Bash Script Arguments? Bash script arguments are parameters passed to a script at runtime. These arguments are used to provide input data to the script, making it dynamic and versatile. In Bash, arguments are accessed using the $ symbol followed by their position (e.g.

How to NGINX Solution for Apache ProxyPassReverse

Image
Introduction When managing web servers, it's common to encounter the need to reverse proxy through different web servers. Apache's mod_proxy module offers ProxyPass and ProxyPassReverse directives to handle these tasks. However, NGINX can be used as an alternative to Apache for reverse proxy needs due to its performance and configuration simplicity. This article explores how to use NGINX to achieve similar functionality to Apache's ProxyPassReverse. NGINX Solution for Apache ProxyPassReverse Understanding Apache’s ProxyPassReverse The ProxyPassReverse directive in Apache adjusts the URLs in the HTTP headers sent from a reverse proxy. This is essential for maintaining session consistency when the backend server redirects responses. Apache configure <VirtualHost myhost:8888>     ServerName myhost     DocumentRoot /path/to/myapp/public     ProxyPass / http://myapp:8080/     ProxyPassReverse / http://myapp:8080/ </VirtualHost> Configuring NGINX as a Re