Monday, 3 April 2017

Reset Grace Period of Windows Server 2012 RDS

Error:

the remote session was disconnected because there are no remote desktop license servers available to provide license in aws

Solution:

The solution is to delete the REG_BINARY in:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod

To delete the key you must take ownership and give admin users full control.

After a restart the server will reset the grace period to 120 days.

Friday, 10 February 2017

Install awscli on windows using cygwin

1. download https://cygwin.com/install.html and Install cygwin  with following packages python -(select this package python:python language interpreter ), curl (select all)

2. open cygwin terminal and run below command

curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
python get-pip.py

Then, we need to install awscli via pip:

pip install awscli

3. Configure aws account in awscli
$aws configure

run upload command
$aws s3 cp /cygdrive/e/file.vhd s3://bucketname

Comman error :
curl: (48) An unknown option was passed in to libcurl
solution:

install proper curl package or may be resolve by install apt-cyg

error :
-bash: python: command not found

solution:
run again cygwin setup file and select package python - python:python language interpreter  and install it

Tuesday, 24 January 2017

The requested URL returned error: 403 Forbidden

Error : 
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/xxxx/store.git/info/refs

fatal: HTTP request failed

Solution :

check git version ; may be using older version if using older version please update it

Install require packages
# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel

Download latest git source

# cd /usr/src
# wget https://git-core.googlecode.com/files/git-1.8.5.3.tar.gz
# tar xzf git-1.8.5.3.tar.gz

3. Install it

# cd git-1.8.5.3
# make prefix=/usr/src/git all
# make prefix=/usr/src/git install
# echo "export PATH=$PATH:/usr/src/git/bin" >> /etc/bashrc
# source /etc/bashrc

4. git version

# git --version
git version 1.8.5.3

Friday, 30 December 2016

How to Send Email via SMTP Server from gmail Account or other mail account

Configure SSMTP on Linux/Centos

1. install ssmtp package
   #yum install ssmtp

2. Configure SSMTP  - edit vi /etc/ssmtp/ssmtp.conf
#mailhub=mail
root=abc@gmail.com
mailhub=smtp.gmail.com:587
AuthUser=abc@gmail.com
AuthPass=xxxxxx
UseSTARTTLS=YES
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt
RewriteDomain=localhost
Hostname=localhost

save and exit.

3. Test sendmail command line
   #ssmtp xxxx@gmail.com
    type masg
    Ctrl+D       ( close and send the massage)

 4. Send mail to multiple recipients using in script
    #ssmtp abc@gmail.com, zyz@gmail.com < msg.txt

Sunday, 11 December 2016

Allow/block ports in Linux/centos/redhat iptables

If you want to open port in firewall via command line

vi /etc/sysconfig/iptables and add below line

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

save and exit.

#service iptables restart

Saturday, 9 January 2016

Mount AWS S3 bucket in linux

yum remove fuse fuse-s3fs
yum install automake fuse-devel gcc-c++ git libcurl-devel libxml2-devel make openssl-devel
cd s3fs-fuse
cd /opt/
git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse
./autogen.sh
./configure
make
make install
echo MYIDENTITY:MYCREDENTIAL > ~/.passwd-s3fs
chmod 600 ~/.passwd-s3fs
mkdir /tmp/cache
mkdir -p /s3localfolder
chmod 777 /tmp/cache /s3localfolder
s3fs -o use_cache=/tmp/cache s3bucket /s3localfolder

create script: 
vi /usr/bin/mounts3.sh
#!/bin/bash
sleep 60
s3fs -o use_cache=/tmp/cache s3bucket /s3localfolder
echo "Amazon S3 bucket connected!"
save and exit

Create systemd service for S3FS

create new file:
 /etc/systemd/system/mounts3.service

and put below data :

[Unit]
Description=Mounts Amazon S3 bucket
After=syslog.target
After=network.target

[Service]
User=root
WorkingDirectory=/usr/bin
ExecStart=/bin/bash mounts3.sh start
Type=forking
KillMode=process

# Time for the shell script to start up
TimeoutSec=120

[Install]
WantedBy=multi-user.target

save and exit

Check service :

systemctl start/stop mounts3
Enable service on system boot:

systemctl enable mounts3


Thats it.....

Thursday, 25 September 2014

(bash vulnerability) Bash software bug could be bigger threat than Heartbleed, experts warn

Secure your Linux , apple pc, servers
Try the vulnerability test (in Terminal): 

$ env x='() { :;}; echo vulnerable' bash -c 'echo hello'
if you are vulnerable, you get back:
vulnerable
hello
if get it "vulnerable" please immediate update bash shell at linux.

for Centos\RHEL linux :
yum update bash

For ubuntu :

apt-get update aptapt-get install --only-upgrade bash or
mkdir srccd srcwget http://ftp.gnu.org/gnu/bash/bash-4.3.tar.gz
#download all patchesfor i in $(seq -f "%03g" 0 25); do wget http://ftp.gnu.org/gnu/bash/bash-4.3-patches/bash43-$i; donetar zxvf bash-4.3.tar.gz cd bashcd bash-4.3#apply all patchesfor i in $(seq -f "%03g" 0 25);do patch -p0 < ../bash43-$i; done#build and install./configure && make && make install cd
cd .. cd
cd ..rm -r src
Verify patch
export VULNCHECK='() { :; }; echo You are still vulnerable'; bash
You are still vulnerable


You can see if you’re vulnerable by running the following command:
In a vulnerable environment, it’ll say:

And again check vulnerability if look like its fine.
or
$ env X="() { :;} ; echo busted" /bin/sh -c "echo hello"
hello
 or
otherwise you get:
bash: warning: x: ignoring function definition attempt
bash: error importing function definition for `x'
hello

Reset Grace Period of Windows Server 2012 RDS

Error: the remote session was disconnected because there are no remote desktop license servers available to provide license in aws Solu...