Use the iptables and ip6tables services instead of firewalld – CentOS 7

To use the iptables and ip6tables services instead of firewalld, first disable firewalld by running the following command as root:

root# systemctl disable firewalld
root# systemctl stop firewalld

Then install the iptables-services package by entering the following command as root:

root# yum install iptables-services

The iptables-services package contains the iptables service and the ip6tables service.
Then, to start the iptables and ip6tables services, run the following commands as root:

root# systemctl start iptables
root# systemctl start ip6tables
root# systemctl enable iptables
root# systemctl enable ip6tables

An example script which blocks INPUT and FORWARD and runs /sbin/iptables-save and writes the current iptables configuration to /etc/sysconfig/iptables. Upon reboot, the iptables init script reapplies the rules saved in /etc/sysconfig/iptables by using the /sbin/iptables-restore command.

Continue reading “Use the iptables and ip6tables services instead of firewalld – CentOS 7”

How to install RHEL EPEL repository on Centos 7.x or RHEL 7.x

The following instruction assumes that you are running command as root user on a CentOS/RHEL 7.x system and you would like to use Fedora Epel repositories.

Install Extra Packages for Enterprise Linux repository configuration (recommended). Just type the following command on a CentOS 7 or RHEL 7:

root# yum install epel-release

or

Install the extra EPEL repositories from dl.fedoraproject.org :


root# cd /tmp
root# wget https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
root# ls *.rpm
root# rpm -i epel-release-7-5.noarch.rpm

Install Open VMware Tools on CentOS 7

To install CentOS 7 in a virtual machine you can use either the standard CentOS distribution CD or the boot floppy/network method. The following installation instructions are for standard distribution CD.For Minimal install and Virtualization Host environments, Open VMware Tools is not available during installation. After CentOS 7 installation, to install Open VMware Tools, using root privileges, run the command:

root# yum install open-vm-tools

Generate self-signed SSL certificate in one line

If you need a quick self-signed certificate, you can generate the key/certificate pair, then sign it, all with one openssl line:

openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout server.key -out server.crt

Output:

root~#:/tmp/ssl$ openssl req -new -newkey rsa:2048 -days 365 -nodes -x5 09 -keyout server.key -out server.crt
Generating a 2048 bit RSA private key
…………………………………………………………………….. …………………………………………………………………….. …………………….+++
…..+++
writing new private key to ‘server.key’
—–
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [AU]:IE
State or Province Name (full name) [Some-State]:Dublin
Locality Name (eg, city) []:Dublin
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Internet 4network Ltd
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:dump.4network.eu
Email Address []:
root~#:/tmp/ssl$ l
total 16
drwxr-xr-x 2 root root 4096 Jul 1 17:18 .
drwxrwxrwt 10 root root 4096 Jul 1 17:17 ..
-rw-r–r– 1 root root 1326 Jul 1 17:18 server.crt
-rw-r–r– 1 root root 1704 Jul 1 17:18 server.key
root~#:/tmp/ssl$

Installing Guest Additions on Debian

Follow these steps to install the Guest Additions on your Debian virtual machine:

1. The APT package index is essentially a database of available packages from the repositories defined in the /etc/apt/sources.list file and in the /etc/apt/sources.list.d directory. To update the local package index with the latest changes made in the repositories, type the following: apt-get update and the install the latest security updates, over time, updated versions of packages currently installed on your computer may become available from the package repositories (for example security updates). To upgrade your system, first update your package index as outlined above, and then type: apt-get upgrade
2. Install required packages: apt-get install build-essential module-assistant;
3. Configure your system for building kernel modules by running m-a prepare;
4. And run as root: sh /media/cdrom/VBoxLinuxAdditions.run and follow the instructions on screen.

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" "http://foo.example.com/bar"
ProxyPassReverse "/foo" "http://foo.example.com/bar"

ProxyPass /camera http://127.0.0.1:10000
ProxyPassReverse /camera http://127.0.0.1:10000

Continue reading “Motion and reverse proxy mode.”

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

Retrieve mail from user called user01 of smtp.some.server.ie server:

root:~> cat .fetchmailrc
poll "smtp.some.server.ie" 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
:0
*^content-Type:
{
:0c:
/var/spool/mail/user01

# Now the actual unpacking part
# forward to uudeview and unpack
:0fw
| uudeview -i +a +o -p /share/Shared/attachment/ -
}
root:~>

And then run fetchmail command 😉