Motion and reverse proxy mode.

Apache HTTP Server can be configured in both a forward and reverse proxy (also known as gateway) mode. An ordinary forward proxy is an intermediate server that sits between the client and the origin server. In order to get content from the origin server, the client sends a request to the proxy naming the origin server as the target and the proxy then requests the content from the origin server and returns it to the client. The client must be specially configured to use the forward proxy to access other sites. Reverse Proxy example:

ProxyPass "/foo" ""
ProxyPassReverse "/foo" ""

ProxyPass /camera
ProxyPassReverse /camera

Continue reading “Motion and reverse proxy mode.”

Retrieve mail and save attachment with fetchmail, procmail and uudeview.

Retrieve mail from user called user01 of server:

root:~> cat .fetchmailrc
poll "" proto IMAP user "user01" password "password" is user01 keep sslproto ''
mda '/usr/bin/procmail -d %T'
set logfile /home/user01/fetchmail.log

To save an attachment from an e- mail use procmail andUUDeview is a program that helps you transmit and receive binary files over the Internet, using electronic mail or newsgroups The UUDeview package includes both an encoder and a decoder. The decoder automatically detects the type of encoding used, offering MIME’s Base64 and BinHex as well as the popular uuencoding and the less frequently used xxencoding methods.

root:~> cat .procmailrc

# Now the actual unpacking part
# forward to uudeview and unpack
| uudeview -i +a +o -p /share/Shared/attachment/ -

And then run fetchmail command 😉

XRDP on SUSE12 issue – solved

I have installed XRDP on SLES12 but the systemd does not start this service as xrdp.service service file is missing. I know that it could be started by typing: /etc/xrdp/ start but I want it to be started after the reboot.

Create a systemd service file:

sles15:~ # vim /usr/lib/systemd/system/xrdp.service

Description=xrdp daemon

ExecStart=/etc/xrdp/ start
ExecStop=/etc/xrdp/ stop


and then a symlink:

sles15:~ # ln -s /usr/lib/systemd/system/xrdp.service /etc/systemd/system/xrdp.service

now turn the XRDP service on, for start at next boot.

sles15:~ # systemctl enable xrdp
sles15:~ # systemctl is-enabled xrdp

So, the XRDP will be started after the reboot 😉 And now another problem occurred, we connected to XRDP on SUSE12 and got a black screen 😛
To fix this issue you need to switch to icewm and at lest get a screen 😉 Just edit /etc/xrdp/ and pretend the list of Session with “icewm”.

sles15:~ # vim /etc/xrdp/
#SESSIONS="gnome-session blackbox fluxbox startxfce4 startkde xterm"

I am a bit surprised that a package like XRDP made it into SLES in such a broken state. Well, have to wait for SP1.

Address masquerading in Postfix.

Address masquerading refers to the idea that you can hide the names of internal hosts, and make all addresses appear as if they originated from the gateway system itself. You may have internal systems that use your Postfix server as a gateway. When mail is sent from these systems and the sender addresses include the fully qualified hostname, you may want addresses to appear with the domain name only. The masquerade_domains parameter strips hostnames down to their simpler domain names.

The parameter takes a list of domains. Any address whose fully qualified hostname matches the domain portion is stripped down to just the domain name:

root# vim /etc/postfix/

masquerade_domains =

Addresses that look like and are converted to and

You can list multiple domains and subdomains. Postfix processes addresses against masquerade domain names in the order you list them. Consider a network that includes the two subdomains, and You want addresses from these domains to show the subdomain, but you want addresses from any other domain or host in the network to show the parent domain. Set masquerade_domains as follows:

masquerade_domains =

With this setting, the address matches, so that it becomes
The address matches, and becomes Finally, matches the last value,, to become

If you want to preserve a domain name that would otherwise be stripped down, you can preface the domain with an exclamation point:

masquerade_domains = !,

In this case, the domain will not be rewritten, so the address stays as it is.

You can exclude specific account names from masquerading. For example, if you want an address like to stay intact, add the account to the masquerade_exceptions parameter:

masquerade_exceptions = admin, root

And then:

root# /etc/init.d/./postfix restart

Rewriting Addresses – Postfix canonical maps.

Postfix canonical maps can be defined in 3 ways.

1. canonical_maps – rewrites the sender and recipient address
2. sender_canonical_maps – rewrites the sender address
3. recipient_canonical_maps – rewrites the recipient address

In, point the canonical_maps parameter to the canonical file and then add addresses that you would like to rewrite.
For Example:

root# vim /etc/postfix/
# Add the following to your configuration file.
canonical_maps = hash:/etc/postfix/canonical

root# vim /etc/postfix/canonical
# address that would like to rewrite new address
user1 greg

root# postmap canonical && postfix reload