Saturday, January 1, 2022

Creating an AWS EC2 Instance (Virtual Machine)

You can find the AWS Shared Responsibility Model on this link.



AWS responsibility “Security of the Cloud” - AWS is responsible for protecting the infrastructure that runs all of the services offered in the AWS Cloud. This infrastructure is composed of the hardware, software, networking, and facilities that run AWS Cloud services.


Customer responsibility “Security in the Cloud” - Customer responsibility will be determined by the AWS Cloud services that a customer selects. This determines the amount of configuration work the customer must perform as part of their security responsibilities. 


 

In the AWS Management Console, select the region where the EC2 instance will be deployed.

 

You choose the AWS Region based on the proximity of the users who will frequently access the resource and data compliance. In this case I chose Asia Pacific (Singapore): ap-southeast-1.

You can either create a new EC2 instance under Services > Compute > EC2 or type EC2 in the search bar.


Click Launch instance (orange button) > Launch instance.


There are seven steps in order to create an EC2 instance. The first step is to Choose an Amazon Machine Image (AMI).

 

There are various Linux, MacOS and Windows AMI to choose from. In this case I chose Amazon Linux  2 AMI which is Free tier eligible.

 

The second step is to choose an Instance Type which is the combination of CPU, memory, storage, etc.

 

In this case I chose t2.micro which is 1 vCPU, 1 GB memory and it's Free tier eligible.

 

You can either select Review and Launch to finish or click Next to continue with the EC2 Instance customization.

 

The third step is to configure the Instance Details. I just left it in default settings.

The fourth step is to Add Storage. I just left the default size of 8 GB and Volume Type: General Purpose SSD (gp2). Click Next.

In fifth step, you can optionally add a Tag. Tags are helpful in auditing and billing purposes.

 

In this case I added a Tag Key: Name and Value: test-ec2-apac. Click Next.

 


The sixth step is to configure a Security Group which is the virtual firewall rule set.

 

In this case I chose: Create a new security group > type Security group name: ec2-security-group.

 

Click Add Rule > select Type: SSH > select Protocol: TCP > Port Range: 22 > type Source: ::/0 (all IPv6 address) > click Review and Launch.


The seventh and last step is to Review the summary of the EC2 settings. Click Launch once finished.

A message prompt will ask to either Choose an existing key pair, Create a new key pair or Proceed without a key pair.

 

A key pair is used when accessing the EC2 instance outside the AWS cloud/public Internet.

 

 In this case I chose Create a new key pair > select Key pair type: RSA > type Key pair name: ec2-key-pair > click Download Key Pair.

Save the key pair file (.pem file) > then click Launch Instances.

Click on the EC2 instance ID (hyperlink) to view the status.

The hyperlink will redirect you to the EC2 Instance page. Notice the Instance state: Running.

 

The EC2 instance deployment will take a few seconds or minutes depending on the EC2 Instance type/settings.

 

Select the new EC2 instance to view its details.

 


Click Connect to connect to the EC2 instance within the AWS Management Console.

 

Click Connect (orange button).

 



It will launch a new web browser and open a command terminal.

Use the commands below in the Linux command prompt to run an HTTP web server and display a simple text.

sudo su

yum install -y httpd.x86_64

systemctl start httpd.service

systemctl enable httpd.service

echo "Hello World" > /var/www/html/index.html

 

To test the web server script, copy the Public IPv4 DNS to clipboard (click the page icon).

ec2-3-0-145-251.ap-southeast-1.compute.amazonaws.com

You could either use the DNS or public IP in the web browser.


To SSH the Linux EC2 Instance from outside/public Internet, you'll need to add/load the key pair created earlier.

 

Open PuTTY Key Generator > click Load.

 

 
Select All Files (at the bottom) > select the key pair: ec2-key-pair.pem > click Open.

Click OK to continue > click Save private key.

Click Yes to save the key without a passphrase to protect it.

 

Save the new private key file (.ppk).

 

Select the specific EC2 Instance > click Connect > go to SSH client tab.

 

Copy the DNS string to clipboard and paste in PuTTY SSH client.

 

 


 Go to Connection > Data > type Auto-login username: ec2-user


Go to SSH > Auth > browse the .ppk key pair file > Open

It will automatically login to the Linux EC2 command prompt.

You can either Stop, Reboot or Terminate the EC2 Instance. Just select the specific EC2 Instance > click Instance state > choose the Stop.

 

In this case I chose to Stop the instance so it will not incur cost and can be used in the future. Choose Terminate to completely delete the EC2 Instance and its data.

 

Click Stop.

Notice the Instance State changed to Stopped.



 

Saturday, December 4, 2021

Cisco CSR 1000V IOS-XE Upgrade

Here's a good link to perform an IOS-XE upgrade in a Cisco CSR 1000V. You download the .bin file to perform the IOS-XE code upgrade. The .iso and .ova are only used for the initial virtual machine deployment. The IOS-XE Gibraltar 16.12.5 is the recommended code (with a gold star) as of this writing.


My CSRv lab router runs IOS-XE 16.6.7 so I need to transfer the new .bin file in bootflash.

CSRv#show version
Cisco IOS XE Software, Version 16.06.07
Cisco IOS Software [Everest], Virtual XE Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.6.7, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2019 by Cisco Systems, Inc.
Compiled Mon 23-Sep-19 14:33 by mcpre

Cisco IOS-XE software, Copyright (c) 2005-2019 by cisco Systems, Inc.
All rights reserved.  Certain components of Cisco IOS-XE software are
licensed under the GNU General Public License ("GPL") Version 2.0.  The
software code licensed under GPL Version 2.0 is free software that comes
with ABSOLUTELY NO WARRANTY.  You can redistribute and/or modify such
GPL code under the terms of GPL Version 2.0.  For more details, see the
documentation or "License Notice" file accompanying the IOS-XE software,
or the applicable URL provided on the flyer accompanying the IOS-XE
software.


ROM: IOS-XE ROMMON

CSRv uptime is 6 days, 18 hours, 17 minutes
Uptime for this control processor is 6 days, 18 hours, 20 minutes
System returned to ROM by reload
System image file is "bootflash:packages.conf"
Last reload reason: Unknown reason

This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

License Level: ax
License Type: Default. No valid license found.
Next reload license Level: ax

cisco CSR1000V (VXE) processor (revision VXE) with 2190141K/3075K bytes of memory.
Processor board ID 9FVTXL4B123
3 Gigabit Ethernet interfaces
32768K bytes of non-volatile configuration memory.
3984872K bytes of physical memory.
7774207K bytes of virtual hard disk at bootflash:.
0K bytes of WebUI ODM Files at webui:.

Configuration register is 0x2102


CSRv#copy tftp://192.168.1.100/csr1000v-universalk9.16.12.05.SPA.bin bootflash:
Destination filename [csr1000v-universalk9.16.12.05.SPA.bin]?
Accessing tftp://192.168.1.100/csr1000v-universalk9.16.12.05.SPA.bin...
Loading csr1000v-universalk9.16.12.05.SPA.bin from 192.168.1.100 (via GigabitEthernet1): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

<OUTPUT TRUNCATED>

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 468361091 bytes]

468361091 bytes copied in 1381.498 secs (339024 bytes/sec)


CSRv#dir
Directory of bootflash:/

   11  drwx            16384  Jun 27 2021 11:11:18 +00:00  lost+found
130049  drwx             4096  Jun 27 2021 11:12:40 +00:00  .super.iso.dir
260097  drwx             4096  Jun 27 2021 11:15:53 +00:00  .installer
   12  -rw-               31  Jun 27 2021 11:18:47 +00:00  .CsrLxc_LastInstall
   13  -rw-               69  Jun 27 2021 11:18:49 +00:00  virtual-instance.conf
406401  drwx             4096  Jun 27 2021 11:15:33 +00:00  core
   15  -rw-        125829120  Jun 27 2021 11:12:40 +00:00  iosxe-remote-mgmt.16.06.07.ova
373891  -rw-        371549204  Jun 27 2021 11:13:40 +00:00  csr1000v-mono-universalk9.16.06.07.SPA.pkg
373892  -rw-         40656486  Jun 27 2021 11:14:21 +00:00  csr1000v-rpboot.16.06.07.SPA.pkg
373890  -rw-             2776  Jun 27 2021 11:14:21 +00:00  packages.conf
105665  drwx             4096  Jun 27 2021 11:15:23 +00:00  .prst_sync
316993  drwx             4096  Jun 27 2021 11:15:34 +00:00  .rollback_timer
243841  drwx             4096  Jun 27 2021 11:18:54 +00:00  virtual-instance
   16  -rw-               30  Jun 27 2021 11:18:13 +00:00  throughput_monitor_params
   17  -rw-                0  Jun 27 2021 11:18:14 +00:00  cvac.log
   18  -rw-             1766  Jun 27 2021 11:18:58 +00:00  csrlxc-cfg.log
430785  drwx             4096  Jun 27 2021 11:18:56 +00:00  onep
   14  -rw-               35  Jun 27 2021 11:19:37 +00:00  pnp-tech-time
   19  -rw-            58123  Jun 27 2021 11:19:38 +00:00  pnp-tech-discovery-summary
   20  -rw-        468361091  Aug 21 2021 03:18:39 +00:00  csr1000v-universalk9.16.12.05.SPA.bin

7897796608 bytes total (5976797184 bytes free)

It's always best practice to verify the hash of newly transferred file. Verify if the hash is the same in the Cisco download site.


CSRv#verify /md5 bootflash:csr1000v-universalk9.16.12.05.SPA.bin
..........................................................................................................................

<OUTPUT TRUNCATED>

........................................Done!
verify /md5 (bootflash:csr1000v-universalk9.16.12.05.SPA.bin) = 226c54c04dcfbb7fdad5e00dcb66c8f8

Change the boot variable and reload the router.


CSRv#show run | inc boot
boot-start-marker
boot-end-marker
diagnostic bootup level minimal

CSRv#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
CSRv(config)#boot system bootflash:csr1000v-universalk9.16.12.05.SPA.bin
CSRv(config)#end
CSRv#write memory
Building configuration...
[OK]

CSRv#show run | inc boot
boot-start-marker
boot system bootflash:csr1000v-universalk9.16.12.05.SPA.bin
boot-end-marker
diagnostic bootup level minimal

CSRv#show bootvar
BOOT variable = bootflash:csr1000v-universalk9.16.12.05.SPA.bin,12;
CONFIG_FILE variable does not exist
BOOTLDR variable does not exist
Configuration register is 0x2102

CSRv#reload
Proceed with reload? [confirm]


<OUTPUT TRUNCATED>

 

The VM bootup using the new IOS-XE in less than 5 minutes (depends on the VM specs). Verify the new IOS-XE version using the show version command.


CSRv#show version
Cisco IOS XE Software, Version 16.12.05
Cisco IOS Software [Gibraltar], Virtual XE Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.12.5, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2021 by Cisco Systems, Inc.
Compiled Fri 29-Jan-21 12:24 by mcpre


Cisco IOS-XE software, Copyright (c) 2005-2021 by cisco Systems, Inc.
All rights reserved.  Certain components of Cisco IOS-XE software are
licensed under the GNU General Public License ("GPL") Version 2.0.  The
software code licensed under GPL Version 2.0 is free software that comes
with ABSOLUTELY NO WARRANTY.  You can redistribute and/or modify such
GPL code under the terms of GPL Version 2.0.  For more details, see the
documentation or "License Notice" file accompanying the IOS-XE software,
or the applicable URL provided on the flyer accompanying the IOS-XE
software.


ROM: IOS-XE ROMMON

CSRv uptime is 2 minutes
Uptime for this control processor is 6 minutes
System returned to ROM by reload at 03:22:42 UTC Sat Aug 21 2021
System image file is "bootflash:csr1000v-universalk9.16.12.05.SPA.bin"
Last reload reason: Reload Command


This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

License Level: ax
License Type: N/A(Smart License Enabled)
Next reload license Level: ax


Smart Licensing Status: UNREGISTERED/No Licenses in Use

cisco CSR1000V (VXE) processor (revision VXE) with 2079946K/3075K bytes of memory.
Processor board ID 9FVTXL4B123
3 Gigabit Ethernet interfaces
32768K bytes of non-volatile configuration memory.
3978408K bytes of physical memory.
7774207K bytes of virtual hard disk at bootflash:.
0K bytes of WebUI ODM Files at webui:.

Configuration register is 0x2102

The new IOS-XE 16.12.5 converted the username and enable secret to a type 9 password (using scrypt). The call-home config was automatically added and made Smart Licensing mandatory starting IOS-XE 16.10.1a in CSR1000v and ISRv routers. A Public Key Infrastructure (PKI) Trustpoint and Certificate were also generated by the new code.


CSRv#show run
Building configuration...

Current configuration : 5147 bytes
!
! Last configuration change at 11:30:00 UTC Sat Aug 21 2021
!
version 16.12
service config
service timestamps debug datetime msec
service timestamps log datetime msec
! Call-home is enabled by Smart-Licensing.
service call-home
platform qfp utilization monitor load 80
no platform punt-keepalive disable-kernel-core
platform console virtual
!
hostname CSRv
!
boot-start-marker
boot system bootflash:csr1000v-universalk9.16.12.05.SPA.bin
boot-end-marker
!
!
enable secret 9 $14$irt/$vxybaz5tx788zU$nJTdFHkRG6FaEln/IoWRdNJC/kKhYOTcAefKYEp/zhk
!         
no aaa new-model

call-home

 ! If contact email address in call-home is configured as sch-smart-licensing@cisco.com

 ! the email address configured in Cisco Smart License Portal will be used as contact email address to send SCH notifications.

 contact-email-addr sch-smart-licensing@cisco.com

 profile "CiscoTAC-1"

  active

  destination transport-method http

  no destination transport-method email

!
no ip domain lookup
ip domain name lab.com
!
!
!
no login on-success log
!
subscriber templating
!
multilink bundle-name authenticated
!

crypto pki trustpoint TP-self-signed-808986070

 enrollment selfsigned

 subject-name cn=IOS-Self-Signed-Certificate-808986070

 revocation-check none

 rsakeypair TP-self-signed-808986070

!

crypto pki trustpoint SLA-TrustPoint

 enrollment pkcs12

 revocation-check crl

!

!

crypto pki certificate chain TP-self-signed-808986070

crypto pki certificate chain SLA-TrustPoint

 certificate ca 01

  30820321 30820209 A0030201 02020101 300D0609 2A864886 F70D0101 0B050030

  32310E30 0C060355 040A1305 43697363 6F312030 1E060355 04031317 43697363

<OUTPUT TRUNCATED>

  418616A9 4093E049 4D10AB75 27E86F73 932E35B5 8862FDAE 0275156F 719BB2F0

  D697DF7F 28

        quit

!
license udi pid CSR1000V sn 9FVTXL4B123
diagnostic bootup level minimal
memory free low-watermark processor 72301
!
!
spanning-tree extend system-id
!
username admin privilege 15 secret 9 $14$ipiQ$JOPYppUclEDJCE$KqpKTScOAxrx4ue3Kt3Kpp7R.Uiie8nlUPNWkYJq.WM
!
redundancy
!
crypto isakmp policy 10
 hash md5
 authentication pre-share
 group 2
crypto isakmp key fortinet address 192.168.1.160  
!
!
crypto ipsec transform-set TSET esp-des esp-md5-hmac
 mode tunnel
!
crypto map CMAP 10 ipsec-isakmp
 set peer 192.168.1.160
 set transform-set TSET
 match address FTG_CISCO_VPN
!
interface Loopback10
 ip address 10.1.1.100 255.255.255.0
 ip nat inside
!
interface GigabitEthernet1
 ip address 192.168.1.140 255.255.255.0
 ip nat outside
 negotiation auto
 no mop enabled
 no mop sysid
 crypto map CMAP
!
interface GigabitEthernet2
 no ip address
 shutdown
 negotiation auto
 no mop enabled
 no mop sysid
!
interface GigabitEthernet3
 no ip address
 shutdown
 negotiation auto
 no mop enabled
 no mop sysid
!
!
virtual-service csr_mgmt
!
ip forward-protocol nd
ip http server
ip http authentication local
ip http secure-server
ip http client source-interface GigabitEthernet1   // PART OF CALL-HOME CONFIG
!
ip nat inside source list 101 interface GigabitEthernet1 overload
ip route 0.0.0.0 0.0.0.0 192.168.1.160
ip ssh version 2
!
ip access-list extended FTG_CISCO_VPN
 10 permit ip 10.1.1.0 0.0.0.255 172.16.1.0 0.0.0.255
!
ip access-list extended 101
 10 permit ip 10.1.1.0 0.0.0.255 any
!
control-plane
!
banner login ^C
### CSR1000v LAB ROUTER ###
^C
!
line con 0
 stopbits 1
line vty 0 4
 password cisco
 logging synchronous
 login
!
ntp server pnpntpserver.lab.com
!
end


Friday, November 12, 2021

Creating AWS Free Tier Account

I studied for my second Cloud certification and took the AWS Cloud Practitioner exam (CLF-C01) exam last month. You can take the free AWS Cloud Practitioner online course using the new AWS Skill Builder portal.

There's a separate AWS CertMetrics portal where you can schedule for the exam, view your score report and download your PDF certificate and digital badge. I took the CLF-C01 online exam via Pearson OnVUE (due to COVID-19) and the cost is around $100 USD (as of this writing). You can check the AWS Certification FAQ for more info.


Below is how the AWS digital certificate (PDF) and badge looks like.


Before creating an AWS Free Tier account, you'll need a mobile phone and credit/debit card.

 

Go to Amazon AWS website > click Get Started for Free

 

Click Create a Free Account.

Type the email address (to be used for login) > type a password (twice to confirm) > type an AWS account name > click Continue.

 

A complex password with minimum of 8 characters  is recommended.

 

Select the AWS Plan > fill up the Contact Information fields > select: I have read and agree to the terms of the AWS Customer Agreement > click Continue.

 

In this case I chose the Personal since this is for my own lab.

 

Fill up the Billing Information (Credit or Debit card number) > select your Billing address > click Verify and Continue.

 

Note that AWS will not charge for usage below the Free Tier limits and will temporarily hold a $1 USD/EUR for 3-5 days as verification.

 

Select Text message (SMS) or Voice call to confirm identity > select Country or region code > type mobile number > type the captcha code > select send SMS (default).

Type the SMS code received in your mobile phone > click Continue.

Select a support plan. In this case I chose Basic support - Free > click Complete sign up.

The AWS account registration is complete. Click Go to the AWS Management Console to get started.

Select your role and interest in AWS > click Submit.

Select Root user > type email address > click Next.

 

Type the captcha code > click Submit.

The AWS Management Console will open using the default region us-east-2 (Ohio, USA).