Friday, 4 November 2016

Debian - Samba

https://www.howtoforge.com/tutorial/samba-server-ubuntu-16-04/

apt-get install -y samba samba-common python-glade2

cp -pf /etc/samba/smb.conf /etc/samba/smb.conf.bak
cat /dev/null  > /etc/samba/smb.conf

vim /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = ubuntu
security = user
map to guest = bad user
dns proxy = no

#============================ Share Definitions=====

[Anonymous]
path = /samba/anonymous
browsable =yes
writable = yes
guest ok = yes
read only = no
force user = nobody

mkdir -p /samba/anonymous
# create a directory for the anonymous share.

chmod -R 0775 /samba/anonymous
chown -R nobody:nogroup /samba/anonymous
# Set the correct permissions.

service smbd restart
#  restart Samba to apply the new configuration.
ls -la /samba/anonymous/
# cross check the content at server.
Secured Samba server:
addgroup smbgrp
useradd till -G smbgrp
smbpasswd -a till
root@server1:~# smbpasswd -a till
New SMB password:<--howtoforge
Retype new SMB password:<--howtoforge
Added user till.
root@server1:~#
mkdir -p /samba/secured
cd /samba
chmod -R 0770 secured
chown root:smbgrp secured
vim /etc/samba/smb.conf
[...]
[secured]
 path = /samba/secured
 valid users = @smbgrp
 guest ok = no
 writable = yes
 browsable = yes
service smbd restart
testparm
# cross-check the settings




How To Install Linux, nginx, MySQL, PHP (LEMP) stack

https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-14-04

1. Install the Nginx Web Server
apt-get install nginx
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'     check private IP
curl http://icanhazip.com      check public IP
http://server_domain_name_or_IP         
It should take you to Nginx's default landing page.

2. Install MySQL to Manage Site Data
apt-get install mysql-server
mysql_install_db    
#tell MySQL to generate the directory structure it needs to store its databases and information.
mysql_secure_installation
#Next, it will ask if you want to change that password. 
#If you are happy with your MySQL root password, type "N" for no and hit "ENTER". 
#Afterwards, you will be prompted to remove some test users and databases. 
#You should just hit "ENTER" through these prompts to remove the unsafe default settings.

3. Install PHP for Processing
apt-get install php5-fpm php5-mysql
Configure the PHP Processor:
vim /etc/php5/fpm/php.ini
service php5-fpm restart

4. Configure Nginx to Use our PHP Processor
vim /etc/nginx/sites-available/default
server {
    listen 80 default_server;
    listen [::]:80 default_server;   #ipv6only=on;
## 
if got configure ipv6

    root /usr/share/nginx/html;
    index index.php index.html index.htm;

    server_name server_domain_name_or_IP;

    location / {
        try_files $uri $uri/ =404;
    }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

service nginx restart

5. Create a PHP File to Test Configuration
vim /usr/share/nginx/html/info.php
<?php
phpinfo();
?>
http://server_domain_name_or_IP/info.php
# rm /usr/share/nginx/html/info.php

Tuesday, 18 October 2016

How To Forward Office 365 Email Address To External Address Without A Mailbox

To set up email forwarding in Office 365 to an external email address without creating a mailbox please follow these instructions:

Step 1. Log in to Office 365

Step 2. Go to Exchange Admin

On the left sidebar under Admin click on Exchange



Step 3. Create a New Mail User

Click on Recipients in the left sidebar
Click on Contacts
Click on the arrow next to the + and Choose Mail User

Step 4. Fill in the New User Details






































Fill in all the relevant details:
  1. First Name
  2. Last Name
  3. Alias – make this the same as the User ID
  4. External Email Address – the email address you want to forward the email to
  5. User ID – The Internal email address you want to forward from
  6. Password – Not important as it won’t be used anyway but still make sure it’s secure

Step 5. Wait – IMPORTANT!

As with any task on Office 365 you can try out your new forwarding address straight away but it may not work immediately.  Sometimes Office 365 can take some time (an hour or two) to recognise changes in the system for some tasks.

Conclusion

Although the process of forwarding an internal Office 365 address to an external email address without a mailbox is simple enough to complete when you know how to, finding the correct section in the ECP can be misleading as there isn’t a simple “Forwarding” section.

Friday, 2 September 2016

Debian – Zabbix

Debian – Zabbix:
Installing the Zabbix Server:
1. vim /etc/apt/sources.list
# Zabbix Application PPA
deb http://ppa.launchpad.net/tbfr/zabbix/ubuntu precise main
deb-src http://ppa.launchpad.net/tbfr/zabbix/ubuntu precise main
2. apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C407E17D5F76A32B
# add the PPA's key so that apt-get trusts the source
3. apt-get update
    apt-get install zabbix-server-mysql php5-mysql zabbix-frontend-php











* password = zabbix123
Configuring the Zabbix Server:
4. vim /etc/zabbix/zabbix_server.conf
DBPassword=Your.Password.Here
MySQL Configuration:
5. cd /usr/share/zabbix-server-mysql/
    gunzip *.gz
6. mysql -u root -p
    create user 'zabbix'@'localhost' identified by 'zabbix123';
    create database zabbix;
    grant all privileges on zabbix.* to 'zabbix'@'localhost';
    flush privileges;
    exit;
7. mysql -u zabbix -p zabbix < schema.sql
    # import the files that Zabbix needs to function.
    # Enter the password for the user "zabbix" that you configured when prompted
    mysql -u zabbix -p zabbix < images.sql
    mysql -u zabbix -p zabbix < data.sql
PHP Configuration:
8. vim /etc/php5/apache2/php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Kuala_Lumpur
9. cp /usr/share/doc/zabbix-frontend-php/examples/zabbix.conf.php.example /etc/zabbix/zabbix.conf.php
# copy the Zabbix-specific php file into the configuration directory
10. vim /etc/zabbix/zabbix.conf.php
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'zabbix123'
Configuring Additional Files:
11. cp /usr/share/doc/zabbix-frontend-php/examples/apache.conf /etc/apache2/conf-available/zabbix.conf
      a2enconf zabbix.conf
      service apache2 restart
12. vim /etc/default/zabbix-server
START=yes
13. service zabbix-server start
Installing and Configuring Zabbix Agent:
14. apt-get update
      apt-get install zabbix-agent
15. vim /etc/zabbix/zabbix_agentd.conf
 Server=Zabbix.Server.IP.Address
# For the agent configuration on the Zabbix server, you can use "127.0.0.1"
Hostname=Hostname_Of_Current_Machine
# Adjust the "Hostname" property to reflect the hostname of the machine being monitored.
16. service zabbix-agent restart
Logging In for the First Time:
17. Your.Zabbix.IP.Address/zabbix2










Username = admin
Password = zabbix
# default credentials
17a. After logged in, click on the "Configuration" button, and then "Hosts" in the top navigation bar.
17b. Click on the name of the server (by default, this should be "Zabbix server"). This will open the host configuration page.
17c. Adjust the Hostname to reflect the hostname of your Zabbix server (this should be the same hostname you entered in the agent configuration for the server machine).
17d. At the bottom, change the "Status" property to "Monitored". Click save.




18a. You will be dopped back to the Hosts configuration page. Re-click on the hostname again.

18b. This time, click on the "Clone" button at the bottom of the page.
18c. We will configure this to reflect the settings of the client machine. Change the hostname and the IP address to reflect the correct information from the client agent file.





















18d. In the "groups" section, select "Zabbix servers" and click the right arrow icon to remove that group. Select the "Linux servers" and click the left arrow icon to add that group setting.






18e. Click "Save" at the bottom.
19a. After a few minutes, you should be able to see both computers by going to "Monitoring" and then clicking on "Latest data".
19b. There should be information for both the server and client machines populating.

















19c. If you click on the arrows next to an item, you can see the collected information.
19d. If you click "Graph" you will see a graphical representation of the data points that have been collected.

Configure Email Alert:
20. Profile > Media > Add

















21. Administration > Media types > Email











Tuesday, 30 August 2016

XML-RPC brute force hacking attacks

This summary is not available. Please click here to view the post.

centos 6 - bandwidthd

centos 6 - bandwidthd:
1. yum install gcc cpp glibc glibc-devel gcc-c++
2. yum install libpcap libpcap-devel libpng libpng-devel gd gd-devel
3. yum install httpd mod_ssl
4. service httpd start
5. chkconfig httpd on
6. wget http://jaist.dl.sourceforge.net/project/bandwidthd/bandwidthd/bandwidthd%202.0.1/bandwidthd-2.0.1.tgz
7. tar -zxvf bandwidthd-2.0.1.tgz
8. cd bandwidthd-2.0.1
9. ./configure
10. make;make install
11. ll /usr/local/bandwidthd
12. vim /usr/local/bandwidthd/etc/bandwidthd.conf
subnet 10.200.10.0/24
dev "eth0"
output_cdf true
recover_cdf true
13. cd /var/www/html/
14. ln -s /usr/local/bandwidthd/htdocs bandwidthd
15. cd /usr/local/bandwidthd
16. ./bandwidthd
17. service httpd restart
18. vim /etc/rc.local
/usr/local/bandwidthd/bandwidthd
19. http://IP/bandwidthd

Time Configuration in Active Directory

Run the following command on the PDC emulator:  
1)      w32tm /query /source
Free-running System Clock
2)      w32tm /config /manualpeerlist:time.windows.com /syncfromflags:manual /reliable:yes /update
3)      w32tm /config /manualpeerlist:pool.ntp.org /syncfromflags:manual /reliable:yes /update
3)    w32tm /config /syncfromflags:manual /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org" /reliable:yes /update
4)      Services > Windows Time > Restart (restart W32Time service)
5)   w32tm /query /peers
7    w32tm /resync
==========================================================
Optional:
Run the following command on all other DCs (that are not PDC):  
w32tm /config /syncfromflags:domhier /update
Once done, restart W32Time service.
net stop w32time && net start w32time
 #Both the domain and non-domain joined protocols requires UDP port 123. 
==========================================================
reset the time service on the non-PDCs back to their default:
net stop w32Time
w32tm /unregister
w32tm /register
net start w32time
w32tm /resync
 

==============================================
For DMZ workgroup computers or Virtual Host machines get time from Internet:
w32tm /config /manualpeerlist:au.pool.ntp.org /syncfromflags:manual /update 
==========================================================
How can I check what time source is being used by Windows inside of a virtual machine?

Administrative command prompt > w32tm /query /source.
If you are using the Hyper-V time synchronization integration service you should see the following output:




If you see this output:




It means that there is no time synchronization going on for this virtual machine.  This is a very bad thing – as time will drift inside of the virtual machine.
==========================================================
In windows 7:

w32tm /query /status
==========================================================
Google NTP:
time.google.com
time1.google.com
time2.google.com
time3.google.com
time4.google.com

Cloudflare NTP:
time.cloudflare.com

Facebook NTP:
time.facebook.com
time1.facebook.com
time2.facebook.com
time3.facebook.com
time4.facebook.com
time5.facebook.com

Microsoft NTP server:
time.windows.com

Apple NTP server:
time.apple.com
time1.apple.com
time2.apple.com
time3.apple.com
time4.apple.com
time5.apple.com
time6.apple.com
time7.apple.com
time.euro.apple.com

NTP Pool:
pool.ntp.org
0.pool.ntp.org
1.pool.ntp.org
2.pool.ntp.org
3.pool.ntp.org
asia.pool.ntp.org
0.asia.pool.ntp.org
1.asia.pool.ntp.org
2.asia.pool.ntp.org
3.asia.pool.ntp.org