segunda-feira, dezembro 29, 2014

OpenVPN tweaks after install

[SOLVED] OpenVPN working in Subnet but can't access internet













echo "1" > /proc/sys/net/ipv4/ip_forward

/etc/sysconfig/iptables
-A POSTROUTING -s 192.168.10.0/24 -j MASQUERADE
-A POSTROUTING -s 192.168.9.0/24 -j MASQUERADE
-A POSTROUTING -s 192.168.11.0/24 -j MASQUERADE
-A POSTROUTING -s 192.168.15.0/24 -j MASQUERADE -o eth0
-A POSTROUTING -s 192.168.0.0/24  -j MASQUERADE


I need some help configuring OpenVPN on Centos 7 using firewalld.
I used iptables on Centos 6.5 and only had to add the following lines to /etc/sysconfig/iptables:
-A POSTROUTING -s "10.0.0.0/24" -o "wlan0" -j MASQUERADE 
-A FORWARD -p tcp -s 10.0.0.0/24 -d 0.0.0.0/0 -j ACCEPT 
run the command: echo 1 > /proc/sys/net/ipv4/ip_forward 
open port 443.
Use the firewall-cmd command.
Assuming you're opening the firewall up to OpenVPN on the default zone, carry out the following commands. If you are running it on a non-default zone, then add --zone= to the commands.

First, list what's currently open:
# firewall-cmd --list-services
http https ssh
Next, add the openvpn service:
# firewall-cmd --add-service openvpn
success
A quick check:
# firewall-cmd --list-services
http https openvpn ssh
The above will allow openvpn to work, which you can now test. However, it won't last over restarts. To make it permanent, add the --permanent option:
# firewall-cmd --permanent --add-service openvpn`
success
Note that this last command doesn't open the port until the next restart, so you need to use both commands.
Finally, add the masquerade:
# firewall-cmd --add-masquerade
success
And make it permanent after a restart:
# firewall-cmd --permanent --add-masquerade
success
Confirm it:
# firewall-cmd --query-masquerade
yes
Note that if your incoming OpenVPN connection is in a different zone to your Internet facing connection the masquerade should be on the latter and you'll need to use the --zone=option with the --add-masquerade commands.

quarta-feira, dezembro 24, 2014

Software :: SendEmail - Send email with this free command line email client

Software :: SendEmail - Send email with this free command line email client



sendEmail script for bash in linux



An Email Program for Sending SMTP Mail from a Command Line


About  |  Download  |  Installation  |  TLS  |  FAQ  |  Releases  |  Comments 
About SendEmail
SendEmail is a lightweight, command line SMTP email client. If you have the need to send email from a command line, this free program is perfect: simple to use and feature rich. It was designed to be used in bash scripts, batch files, Perl programs and web sites, but is quite adaptable and will likely meet your requirements. SendEmail is written in Perl and is unique in that it requires NO MODULES. It has an intuitive and flexible set of command-line options, making it very easy to learn and use.
SendEmail is licensed under the GNU GPL, either version 2 of the License or (at your option) any later version.
[Supported Platforms: Linux, BSD, OS X, Windows 98, Windows NT, Windows 2000, & Windows XP]

Download

Official Release: sendEmail-v1.56.tar.gz    (29kb Sep 29th, 2009)    Changelog    Screen Shot

Windows Download:
Free sendEmail.exe for Windows. To use simply run sendEmail.exe from a console / command line.
sendEmail-v156-notls.zip   (677kb Sep 29th, 2009)   No TLS support 
sendEmail-v156.zip   (1.4mb Sep 29th, 2009)   TLS supported 

RPM Package: sendEmail rpm

CentOS – RedHat: A “systeminfo” like script for Linux | George's little internet notebook

CentOS – RedHat: A “systeminfo” like script for Linux | George's little internet notebook

System info, centos system info by email



CentOS – RedHat: A “systeminfo” like script for Linux

Windows has a nice command called “systeminfo” which provides a collection of general information for the Operating System. I created a Bash script that does something similar.
Note 1) this is part of a larger script I am creating which will import Operating System data into a Database.
Note 2) In order to view the network connection called in one of the functions in this script, you will have to be logged in as root to run this script. Unless of course you have setup sudo to run the “lsof” command.
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
############################################
#This script is broken down into functions #
############################################
############################################
#Below all the functions are declared.
############################################
clear
function Operating_SystemVersion_info ()
{
V_Server_Name=`hostname`
V_OS_Version=`cat /etc/redhat-release`
echo "Host: $V_Server_Name  Version: $V_OS_Version";
echo "-"
}
 
function Memory_Usage()
{
Total_Memory=`free -m | grep 'Mem' | awk '{print $2}'`
Used_Memory=`free -m | grep 'Mem' | awk '{print $3}'`
Free_Memory=`free -m | awk 'FNR == 2 {print $4}'`
Swap_Size=`cat /proc/swaps | grep 'partition' | awk '{print $3}'`
Swap_Used_Space=`cat /proc/swaps | grep 'partition' | awk '{print $4}'`
Swap_info=`cat /proc/swaps | grep 'partition' | awk '{print "partition: " $1 " Priority " $5}'`
printf "MEMORY INFO\n"
printf "\t""\t""Total Memory $Total_Memory-MBs""\n"
printf "\t""\t""Used Memory $Used_Memory-MBs""\n"
printf "\t""\t""Free Memory $Free_Memory-MBs""\n"
printf "\t""\t""Used Swap $Swap_Used_Space-MBs""\n"
printf "\t""\t""Swap priority info $Swap_info""\n"
echo ""
}
 
function CPU_Load_Usage()
{
CPU_Cores=`cat /proc/cpuinfo | grep 'processor' | wc -l`
CPU_15min_Load=`uptime | awk '{print $10}'`
CPU_10min_Load=`uptime | awk '{pring $11}'`
CPU_15min_Load=`uptime | awk '{print $12}'`
}
 
function Storage_usage ()
{
printf "STORAGE INFO \n"
df -ah | awk '/%/ {print "\t""\t"$3 " " $4 " " $5 " " $6}'
echo ""
swap_size=`cat /proc/sys/vm/swappiness`
printf "\t""\t""Swap File usage: $swap_size""\t""\n"
printf "\t""\t""0 = OS is not using swap filesystem""\n"
printf "\t""\t""100 = OS is fully using swap filesystem""\n""\n"
}
 
function Top_output {
echo "RUNNING PROCESSES"
ps -auxe 2>/dev/null | awk '{print $1}' | sort | uniq -c
echo ""
}
 
function Network_Setup_Information ()
{
printf  "NET INTERFACES \n"
Links=`find /etc/sysconfig/network-scripts/ -name ifcfg-* -type f | xargs  grep 'IPADDR' | awk -F"/" '{print $5}' | awk '1;!(NR%1){print " ";}'`
echo $Links | tr ' ' '\n' > F_net_interfaces
for loop_interfaces in `cat F_net_interfaces`;
do
printf  "\t""\t""$loop_interfaces""\n";
done
echo ""
}
 
function Network_Activity_Information ()
{
touch F_port_scan
>F_port_scan
printf "NETWORK CONNECTIONS \n\n"
lsof -i -n -P | awk '/LISTEN/ {print "Service: " $1, "is listening on port: " $9}' | grep -v 127.0.0.1 | sort -u  >> F_port_scan
while read F_port_scan;
do
printf "\t""\t""$F_port_scan""\t""\n";
done < F_port_scan;
echo ""
}
function swappiness_Information ()
{
swap_size=`cat /proc/sys/vm/swappiness`
printf "\t""\t"0 = OS is not using swap filesystem"
printf "\t""\t"100 = OS is fully using swap filesystem"
printf "\t""\t""$swap_size""\t""\t"
}
Operating_SystemVersion_info;
Memory_Usage;
CPU_Load_Usage;
Storage_usage;
Top_output;
Network_Setup_Information;
Network_Activity_Information;
#---
#Checking to see if it s a virtual server or not.
printf "HYPERVISOR STATUS""\n""\n"
dmesg | grep -i '"Hypervisor detected: VMware"' >> /dev/null  2>&1
if [[ $? -eq 0 ]];
then
printf "\t""\t""This is a VMware Virtual Machine""\n"
else
printf "\t""\t""This is Physical Machine""\n"
fi
1
 
Share Button