Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T Americas Headquarters

Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T Americas Headquarters
Cisco IOS Scripting with TCL
Configuration Guide, Cisco IOS Release
12.4T
Americas Headquarters
Cisco Systems, Inc.
170 West Tasman Drive
San Jose, CA 95134-1706
USA
http://www.cisco.com
Tel: 408 526-4000
800 553-NETS (6387)
Fax: 408 527-0883
THE SPECIFICATIONS AND INFORMATION REGARDING THE PRODUCTS IN THIS MANUAL ARE SUBJECT TO CHANGE WITHOUT NOTICE. ALL STATEMENTS,
INFORMATION, AND RECOMMENDATIONS IN THIS MANUAL ARE BELIEVED TO BE ACCURATE BUT ARE PRESENTED WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED. USERS MUST TAKE FULL RESPONSIBILITY FOR THEIR APPLICATION OF ANY PRODUCTS.
THE SOFTWARE LICENSE AND LIMITED WARRANTY FOR THE ACCOMPANYING PRODUCT ARE SET FORTH IN THE INFORMATION PACKET THAT SHIPPED
WITH THE PRODUCT AND ARE INCORPORATED HEREIN BY THIS REFERENCE. IF YOU ARE UNABLE TO LOCATE THE SOFTWARE LICENSE OR LIMITED
WARRANTY, CONTACT YOUR CISCO REPRESENTATIVE FOR A COPY.
The Cisco implementation of TCP header compression is an adaptation of a program developed by the University of California, Berkeley (UCB) as part of UCB’s public domain version
of the UNIX operating system. All rights reserved. Copyright © 1981, Regents of the University of California.
NOTWITHSTANDING ANY OTHER WARRANTY HEREIN, ALL DOCUMENT FILES AND SOFTWARE OF THESE SUPPLIERS ARE PROVIDED “AS IS” WITH ALL
FAULTS. CISCO AND THE ABOVE-NAMED SUPPLIERS DISCLAIM ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THOSE OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OR ARISING FROM A COURSE OF DEALING, USAGE, OR TRADE
PRACTICE.
IN NO EVENT SHALL CISCO OR ITS SUPPLIERS BE LIABLE FOR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, OR INCIDENTAL DAMAGES, INCLUDING,
WITHOUT LIMITATION, LOST PROFITS OR LOSS OR DAMAGE TO DATA ARISING OUT OF THE USE OR INABILITY TO USE THIS MANUAL, EVEN IF CISCO OR
ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Cisco and the Cisco Logo are trademarks of Cisco Systems, Inc. and/or its affiliates in the U.S. and other countries. A listing of Cisco's trademarks can be found at www.cisco.com/go/
trademarks. Third party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any
other company. (1005R)
Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output,
network topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content
is unintentional and coincidental.
© 2011 Cisco Systems, Inc. All rights reserved.
CONTENTS
Cisco IOS Scripting with Tcl 1
Finding Feature Information 1
Prerequisites for Cisco IOS Scripting with Tcl 1
Restrictions for Cisco IOS Scripting with Tcl 1
Information About Cisco IOS Scripting with Tcl 3
Tcl Shell for Cisco IOS Software 3
Tcl Precompiler 4
SNMP MIB Object Access 4
Custom Extensions in the Tcl Shell 4
SNMP MIB Custom Extensions in the Tcl Shell 5
How to Configure Cisco IOS Scripting with Tcl 7
Enabling the Tcl Shell and Using the CLI to Enter Commands 8
Troubleshooting Tips 12
Using the Tcl Shell to Access SNMP MIB Objects 12
Troubleshooting Tips 14
Running Predefined Tcl Scripts 15
Configuration Examples for Cisco IOS Scripting with Tcl 15
Example Tcl Script Using the show interfaces Command 16
Example Tcl Script for SMTP Support 16
Example Tcl Script for SNMP MIB Access 17
Additional References 19
Feature Information for Cisco IOS Scripting with Tcl 20
Glossary 21
Signed Tcl Scripts 23
Finding Feature Information 23
Prerequisites for Signed Tcl Scripts 23
Restrictions for Signed Tcl Scripts 23
Information About Signed Tcl Scripts 24
Cisco IOS PKI 24
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
iii
Contents
RSA Key Pair 24
Certificate and Trustpoint 25
How to Configure Signed Tcl Scripts 25
Generating a Key Pair 25
Generating a Certificate 27
Signing the Tcl Scripts 28
Verifying the Signature 29
Converting the Signature into Nonbinary Data 30
Configuring the Router with a Certificate 32
Verifying the Trustpoint 35
Verifying the Signed Tcl Script 36
What to Do Next 37
Configuration Examples for Signed Tcl Script 37
Generating a Key Pair Example 38
Generating a Certificate Example 38
Signing the Tcl Scripts Example 38
Verifying the Signature Example 39
Converting the Signature with Nonbinary Data Example 39
Configuring the Router with a Certificate Example 40
Additional References 41
Feature Information for Signed Tcl Scripts 42
Glossary 43
Notices 43
OpenSSL Open SSL Project 44
License Issues 44
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
iv
Cisco IOS Scripting with Tcl
The Cisco IOS Scripting with Tcl feature provides the ability to run Tool Command Language (Tcl)
version 8.3.4 commands from the Cisco IOS command-line interface (CLI).
•
•
•
•
•
•
•
•
•
Finding Feature Information, page 1
Prerequisites for Cisco IOS Scripting with Tcl, page 1
Restrictions for Cisco IOS Scripting with Tcl, page 1
Information About Cisco IOS Scripting with Tcl, page 3
How to Configure Cisco IOS Scripting with Tcl, page 7
Configuration Examples for Cisco IOS Scripting with Tcl, page 15
Additional References, page 19
Feature Information for Cisco IOS Scripting with Tcl, page 20
Glossary, page 21
Finding Feature Information
Your software release may not support all the features documented in this module. For the latest feature
information and caveats, see the release notes for your platform and software release. To find information
about the features documented in this module, and to see a list of the releases in which each feature is
supported, see the Feature Information Table at the end of this document.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support.
To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.
Prerequisites for Cisco IOS Scripting with Tcl
•
•
Familiarity with Tcl programming and Cisco IOS commands is required.
Tcl commands can be executed from the Tcl configuration mode using the Cisco IOS CLI. Tcl
configuration mode is accessed from privileged EXEC mode. Access to privileged EXEC mode should
be managed by restricting access using the enable command password.
Restrictions for Cisco IOS Scripting with Tcl
•
If Cisco IOS configuration commands are used within the Tcl scripts, submode commands must be
entered as quoted arguments on the same line as the configuration command.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
1
Cisco IOS Scripting with Tcl
Restrictions for Cisco IOS Scripting with Tcl
•
Caution
Error messages are provided, but you must check that the Tcl script will run successfully because
errors may cause the Tcl shell to run in an infinite loop.
The use of Tcl server sockets to listen to telnet and FTP ports (23 and 21 respectively) will preempt the
normal handling of these ports in Cisco IOS software.
•
The table below lists Tcl commands and library calls that do not behave within Cisco IOS software as
documented in standard Tcl documents.
Table 1
Tcl Command Options That Behave Differently in Cisco IOS Software
Command
Keyword
Argument
Supported
Comments
after
ms
script
Partially
When the CLI
tclsh command is
used, there is no
event loop
implemented
unless Embedded
Syslog Manager
(ESM) is active on
the same router.
Commands entered
using the after Tcl
command will not
run unless forced
using the update
command. Sleep
mode (the after
command) works
only with the ms
keyword.
file
-time
atime
No
The optional -time
keyword to set the
file access time is
not supported in
Cisco IOS
software.
file
-time
mtime
No
The optional -time
keyword to set the
file modification
time is not
supported in Cisco
IOS software.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
2
Tcl Shell for Cisco IOS Software
Information About Cisco IOS Scripting with Tcl
Command
Keyword
Argument
fileevent
history
!n
load
Supported
Comments
Partially
When the CLI
tclsh command is
used, there is no
event loop
implemented
unless Embedded
Syslog Manager
(ESM) is active on
the same router.
Commands entered
using the fileevent
Tcl command will
not run unless
forced using the
update command.
Partially
The ! n shortcut
does not work in
Cisco IOS
software. Use the
history Tcl
command with the
redo n keyword.
No
When the CLI load
command is used,
an error message
stating “dynamic
loading not
available on this
system” is
displayed.
Information About Cisco IOS Scripting with Tcl
•
•
•
•
•
Tcl Shell for Cisco IOS Software, page 3
Tcl Precompiler, page 4
SNMP MIB Object Access, page 4
Custom Extensions in the Tcl Shell, page 4
SNMP MIB Custom Extensions in the Tcl Shell, page 5
Tcl Shell for Cisco IOS Software
The Cisco IOS Tcl shell was designed to allow customers to run Tcl commands directly from the Cisco
IOS CLI prompt. Cisco IOS software does contain some subsystems such as Embedded Syslog Manager
(ESM) and Interactive Voice Response (IVR) that use Tcl interpreters as part of their implementation.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
3
Tcl Precompiler
Information About Cisco IOS Scripting with Tcl
These subsystems have their own proprietary commands and keyword options that are not available in the
Tcl shell.
Several methods have been developed for creating and running Tcl scripts within Cisco IOS software. A
Tcl shell can be enabled, and Tcl commands can be entered line by line. After Tcl commands are entered,
they are sent to a Tcl interpreter. If the commands are recognized as valid Tcl commands, the commands
are executed and the results are sent to the TTY device. If a command is not a recognized Tcl command, it
is sent to the Cisco IOS CLI parser. If the command is not a Tcl or Cisco IOS command, two error
messages are displayed. A predefined Tcl script can be created outside of Cisco IOS software, transferred
to flash or disk memory, and run within Cisco IOS software. It is also possible to create a Tcl script and
precompile the code before running it under Cisco IOS software.
Multiple users on the same router can be in Tcl configuration mode at the same time without interference
because each Tcl shell session launches a separate interpreter and Tcl server process. The TTY interface
number served by each Tcl process is represented in the server process name and can be displayed using
the show process CLI command.
The Tcl shell can be used to run Cisco IOS CLI EXEC commands within a Tcl script. Using the Tcl shell to
run CLI commands allows customers to build menus to guide novice users through tasks, to automate
repetitive tasks, and to create custom output for show commands.
Tcl Precompiler
The Cisco IOS Tcl implementation offers support for loading scripts that have been precompiled by the
TclPro precompiler. Precompiled scripts allow a measure of security and consistency because they are
obfuscated.
SNMP MIB Object Access
Designed to make access to Simple Network Management Protocol (SNMP) MIB objects easier, a set of
UNIX-like SNMP commands has been created. The Tcl shell is enabled either manually or by using a Tcl
script, and the new commands can be entered to allow you to perform specified get and set actions on MIB
objects. To increase usability, the new commands have names similar to those used for UNIX SNMP
access. To access the SNMP commands go to, Using the Tcl Shell to Access SNMP MIB Objects, page
12.
Custom Extensions in the Tcl Shell
The Cisco IOS implementation of the Tcl shell contains some custom command extensions. These
extensions operate only under Tcl configuration mode. The table below displays these command
extensions.
Table 2
Cisco IOS Custom Tcl Command Extensions
Command
Description
fconfigure -remote [host port] -broadcast boolean
vrf[vrf_table_name]
Specifies the options in a channel and enables you
to associate a virtual routing and forwarding (VRF)
table name with it.
ios_config
Runs a Cisco IOS CLI configuration command.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
4
SNMP MIB Custom Extensions in the Tcl Shell
Information About Cisco IOS Scripting with Tcl
Command
Description
log_user
Toggles Tcl command output under Tcl
configuration mode.
socket -myvrf [vrf_table_name]
Opens a TCP network connection and enables you
to associate a VRF table name with it.
typeahead
Writes text to the router standard input (stdin)
buffer file.
tclquit
Leaves Tcl shell--synonym for exit.
udp_open -ipv6 port
Opens a User Datagram Protocol (UDP) socket.
udp_peek sock -buffersize buffer-size
Enables peeking into a UDP socket.
SNMP MIB Custom Extensions in the Tcl Shell
The Cisco IOS implementation of the Tcl shell contains some custom command extensions for SNMP MIB
object access. These extensions operate only under Tcl configuration mode. The table below displays these
command extensions.
Table 3
Cisco IOS Custom Tcl Command Extensions for SNMP MIB Access
Command
Description
snmp_getbulk
Retrieves a large section of a MIB table. This
command is similar to the SNMP getbulk
command. The syntax is in the following format:
snmp_getbulk community-string non-repeaters
max-repetitions oid [oid2 oid3...]
•
•
•
•
Use the community-string argument to specify
the SNMP community from which the objects
will be retrieved.
Use the non-repeaters argument to specify the
number of objects that can be retrieved with a
get-next operation.
Use the max-repetitions argument to specify
the maximum number of get-next operations to
attempt while trying to retrieve the remaining
objects.
Use the oid argument to specify the object
ID(s) to retrieve.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
5
Cisco IOS Scripting with Tcl
Information About Cisco IOS Scripting with Tcl
Command
Description
snmp_getid
Retrieves the following variables from the SNMP
entity on the router:
•
•
•
•
•
•
sysDescr.0
sysObjectID.0
sysUpTime.0
sysContact.0
sysName.0
sysLocation.0
This command is similar to the SNMP getid
command. The syntax is in the following format:
snmp_getid community-string
snmp_getnext
Retrieves a set of individual variables from the
SNMP entity on the router. This command is
similar to the SNMP getnextcommand. The syntax
is in the following format:
snmp_getnext community-string oid [oid2 oid3...]
snmp_getone
Retrieves a set of individual variables from the
SNMP entity on the router. This command is
similar to the SNMP getone command. The syntax
is in the following format:
snmp_getone community-string oid [oid2 oid3...]
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
6
Cisco IOS Scripting with Tcl
How to Configure Cisco IOS Scripting with Tcl
Command
Description
snmp_setany
Retrieves the current values of the specified
variables and then performs a set request on the
variables. This command is similar to the SNMP
setany command. The syntax is in the following
format:
snmp_setany community-string oid type val [oid2
type2 val2...]
•
Use the type argument to specify the type of
object to retrieve. The type can be one of the
following:
◦
•
-i--Integer. A 32-bit number used to
specify a numbered type within the
context of a managed object. For example,
to set the operational status of a router
interface, 1 represents up and 2 represents
down.
◦ -u--Unsigned32. A 32-bit number used to
represent decimal values in the range from
0 to 2 32 - 1 inclusive.
◦ -c--Counter32. A 32-bit number with a
minimum value of 0 and a maximum
value of 2 32 - 1. When the maximum
value is reached, the counter resets to 0
and starts again.
◦ -g--Gauge. A 32-bit number with a
minimum value of 0 and a maximum
value of 2 32 - 1. The number can
increase or decrease at will. For example,
the interface speed on a router is
measured using a gauge object type.
◦ -o--Octet string. An octet string--in hex
notation--used to represent physical
addresses.
◦ -d--Display string. An octet string--in text
notation--used to represent text strings.
◦ -ipv4--IP version 4 address.
◦ -oid--Object ID.
Use the val argument to specify the value of
object ID(s) to retrieve.
How to Configure Cisco IOS Scripting with Tcl
•
•
•
Enabling the Tcl Shell and Using the CLI to Enter Commands, page 8
Using the Tcl Shell to Access SNMP MIB Objects, page 12
Running Predefined Tcl Scripts, page 15
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
7
Enabling the Tcl Shell and Using the CLI to Enter Commands
How to Configure Cisco IOS Scripting with Tcl
Enabling the Tcl Shell and Using the CLI to Enter Commands
Perform this task to enable the interactive Tcl shell and to enter Tcl commands line by line through the
Cisco IOS CLI prompt. Optional steps include specifying a default location for encoding files and
specifying an initialization script.
SUMMARY STEPS
1. enable
2. configure terminal
3. scripting tcl encdir location-url
4. scripting tcl init init-url
5. scripting tcl low-memory bytes
6. exit
7. tclsh
8. Enter the required Tcl command language syntax.
9. ios_config “ cmd ” “ cmd-option ”
10. socket -myaddr addr -myport port -myvrf vrf-table-name host port
11. socket - server -myaddr addr -myvrf vrf-table-name port
12. fconfigure channelname - remote [host port] - broadcast boolean - vrf[vrf_table_name]
13. udp_open -ipv6 port
14. udp_peek sock -buffersize buffer-size
15. exec “ exec-cmd ”
16. exit
DETAILED STEPS
Command or Action
Step 1 enable
Purpose
Enables privileged EXEC mode.
•
Enter your password if prompted.
Example:
Router> enable
Step 2 configure terminal
(Optional) Enters global configuration mode.
•
Example:
Router# configure terminal
Perform Enabling the Tcl Shell and Using the CLI to Enter
Commands, page 8 through Enabling the Tcl Shell and Using the
CLI to Enter Commands, page 8 if you are using encoding files,
an initialization script, or both.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
8
Cisco IOS Scripting with Tcl
How to Configure Cisco IOS Scripting with Tcl
Command or Action
Step 3 scripting tcl encdir location-url
Purpose
(Optional) Specifies the default location of external encoding files used
by the Tcl encoding command.
Example:
Router(config)# scripting tcl encdir
tftp://10.18.117.23/enctcl/
Step 4 scripting tcl init init-url
(Optional) Specifies an initialization script to run when the Tcl shell is
enabled.
Example:
Router(config)# scripting tcl init
ftp://user:password@172.17.40.3/
tclscript/initfiles3.tcl
Step 5 scripting tcl low-memory bytes
Example:
Router(config)# scripting tcl lowmemory 33117513
Step 6 exit
(Optional) Specifies a low water memory mark for free memory for
Tcl-based applications. The memory threshold can be set anywhere
between 0-4294967295 bytes.
Note If minimum free RAM drops below this threshold, TCL aborts
the current script. This prevents the Tcl interpreter from
allocating too much RAM and crashing the router.
(Optional) Exits global configuration mode and returns to privileged
EXEC mode.
Example:
Router(config)# exit
Step 7 tclsh
Enables the interactive Tcl shell and enters Tcl configuration mode.
Example:
Router# tclsh
Step 8 Enter the required Tcl command language
syntax.
Commands entered in Tcl configuration mode are sent first to the
interactive Tcl interpreter. If the command is not a valid Tcl command,
it is then sent to the CLI parser.
Example:
Router(tcl)# proc get_bri {}
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
9
Cisco IOS Scripting with Tcl
How to Configure Cisco IOS Scripting with Tcl
Command or Action
Step 9 ios_config “ cmd ” “ cmd-option ”
Example:
Router(tcl)# ios_config “interface
Ethernet 2/0” “no keepalive”
Step 10 socket -myaddr addr -myport port -myvrf
vrf-table-name host port
Example:
Purpose
(Optional) Modifies the router configuration using a Tcl script by
specifying the Tcl command ios_configwith CLI commands and
options. All arguments and submode commands must be entered on the
same line as the CLI configuration command.
•
Specifies the client socket and allows a TCL interpreter to connect via
TCP over IPv4/IPv6 and opens a TCP network connection. You can
specify a port and host to connect to; there must be a server to accept
connections on this port.
•
Router(tcl)# socket -myaddr 10.4.9.34 myport 12345 -myvrf testvrf 12346
•
•
Step 11 socket - server -myaddr addr -myvrf vrftable-name port
Example:
•
•
Example:
Router(tcl)# fconfigure sock1 -vrf vrf1
-remote [list 10.4.9.37 56009] broadcast 1
-myaddr addr --domain name or numerical IP address of the
client-side network interface required for the connection. Use this
option especially if the client machine has multiple network
interfaces.
-myport port -- port number that is required for the client's
connection.
-myvrf [vrf_table_name]--specifies the vrf table name. If the vrf
table is not configured, then the command will return a
TCL_ERROR.
Specifies the server socket and allows a TCL interpreter to connect via
TCP over IPv4/IPv6 and opens a TCP network connection. If the port is
zero, Cisco IOS will allocate a free port to the server socket by using
fconfigurecommand to read the -sock0 argument.
Router(tcl)# socket -server test -myvrf
testvrf 12348
Step 12 fconfigure channelname - remote [host port] broadcast boolean - vrf[vrf_table_name]
In this example, the first argument in quotes configures an
Ethernet interface and enters interface configuration mode. The
second argument in quotes sets the keepalive option. If these two
CLI statements were entered on separate Tcl command lines, the
configuration would not work.
-myaddr addr --domain name or numerical IP address of the
client-side network interface required for the connection. Use this
option especially if the client machine has multiple network
interfaces.
-myvrf vrf --specifies the vrf table name. If the vrf table is not
configured, then the command will return a TCL_ERROR and
append “Cannot obtain VRF Table ID for VRF_table_name” to
the interpreter result.
Specifies the options in a channel.
•
•
•
In case of UDP sockets that are created using the udp_open, the
UDP socket can be mapped to a VRF using the fconfigure
command.
This command can also be used to display the properties of the
channel.
-broadcast --enables or disables the broadcasting.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
10
Cisco IOS Scripting with Tcl
How to Configure Cisco IOS Scripting with Tcl
Command or Action
Step 13 udp_open -ipv6 port
Purpose
Opens a UDP socket.
•
Example:
Router(tcl)# udp_open -ipv6 56005
Step 14 udp_peek sock -buffersize buffer-size
If a port is specified the UDP socket will be opened on that port.
Otherwise the system will choose a port and you can use the
fconfigure command to obtain the port number, if required. If ipv6argument is specified, the socket will be opened specifying the
AF_INET6 protocol family.
Enables peeking into a UDP socket.
•
-buffersize buffer-size --specifies the buffersize.
Example:
Router(tcl)# udp_peek sock0 -buffersize
100
Step 15 exec “ exec-cmd ”
(Optional) Executes Cisco IOS CLI EXEC mode commands from a Tcl
script by specifying the Tcl command exec with the CLI commands.
•
Example:
In this example, interface information for the router is displayed.
Router(tcl)# exec “show interfaces”
Step 16 exit
Exits Tcl configuration mode and returns to privileged EXEC mode.
Example:
Router(tcl)# exit
Examples
The following sample (partial) output shows information about Ethernet interface 0 on the router. The
show interfaces command has been executed from Tcl configuration mode.
Router# tclsh
Router(tcl)# exec “show interfaces”
Ethernet 0 is up, line protocol is up
Hardware is MCI Ethernet, address is 0000.0c00.750c (bia 0000.0c00.750c)
Internet address is 10.108.28.8, subnet mask is 255.255.255.0
MTU 1500 bytes, BW 10000 Kbit, DLY 100000 usec, rely 255/255, load 1/255
Encapsulation ARPA, loopback not set, keepalive set (10 sec)
ARP type: ARPA, ARP Timeout 4:00:00
Last input 0:00:00, output 0:00:00, output hang never
Last clearing of "show interface" counters 0:00:00
Output queue 0/40, 0 drops; input queue 0/75, 0 drops
Five minute input rate 0 bits/sec, 0 packets/sec
Five minute output rate 2000 bits/sec, 4 packets/sec
1127576 packets input, 447251251 bytes, 0 no buffer
Received 354125 broadcasts, 0 runts, 0 giants, 57186* throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
5332142 packets output, 496316039 bytes, 0 underruns
0 output errors, 432 collisions, 0 interface resets, 0 restarts
.
.
.
•
Troubleshooting Tips, page 12
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
11
Using the Tcl Shell to Access SNMP MIB Objects
Troubleshooting Tips
Troubleshooting Tips
Use the Tcl puts command in a Tcl script to trace command execution.
Using the Tcl Shell to Access SNMP MIB Objects
Perform this task to enable the interactive Tcl shell and enter Tcl commands to perform actions on MIB
objects.
The SNMP community configuration must exist in the running configuration of the router.
SUMMARY STEPS
1. enable
2. configure terminal
3. scripting tcl encdir location-url
4. scripting tcl init init-url
5. exit
6. tclsh
7. Enter the required Tcl command language syntax.
8. snmp_getbulk community-string non-repeaters max-repetitions oid [oid2 oid3...]
9. snmp_getid community-string
10. snmp_getnext community-string oid [oid2 oid3...]
11. snmp_getone community-string oid [oid2 oid3...]
12. snmp_setany community-string oid type val [oid2 type2 val2...]
13. exit
DETAILED STEPS
Command or Action
Step 1 enable
Purpose
Enables privileged EXEC mode.
•
Enter your password if prompted.
Example:
Router> enable
Step 2 configure terminal
(Optional) Enters global configuration mode.
•
Example:
Router# configure terminal
Perform Using the Tcl Shell to Access SNMP MIB Objects,
page 12 through Using the Tcl Shell to Access SNMP MIB
Objects, page 12 Perform Step 2 through Step 5 if you are using
encoding files, an initialization script, or both.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
12
Cisco IOS Scripting with Tcl
Troubleshooting Tips
Command or Action
Purpose
Step 3 scripting tcl encdir location-url
(Optional) Specifies the default location of external encoding files
used by the Tcl encoding command.
Example:
Router(config)# scripting tcl encdir
tftp://10.18.117.23/enctcl/
Step 4 scripting tcl init init-url
(Optional) Specifies an initialization script to run when the Tcl shell
is enabled.
Example:
Router(config)# scripting tcl init ftp://
user:password@172.17.40.3/tclscript/
initfiles3.tcl
Step 5 exit
(Optional) Exits global configuration mode and returns to privileged
EXEC mode.
Example:
Router(config)# exit
Step 6 tclsh
Enables the interactive Tcl shell and enters Tcl configuration mode.
Example:
Router# tclsh
Step 7 Enter the required Tcl command language syntax. Commands entered in Tcl configuration mode are sent first to the
interactive Tcl interpreter. If the command is not a valid Tcl
command, it is sent to the CLI parser.
Example:
Router(tcl)# proc get_bri {}
Step 8 snmp_getbulk community-string non-repeaters
max-repetitions oid [oid2 oid3...]
(Optional) Retrieves a large section of a MIB table.
•
Example:
•
Router(tcl)# snmp_getbulk public 1 3
1.3.6.1.2.1.1.1 1.3.6.1.2.1.10.18.8.1.1
•
•
Use the community-string argument to specify the SNMP
community from which the objects will be retrieved.
Use the non-repeaters argument to specify the number of objects
that can be retrieved with a get-next operation.
Use the max-repetitions argument to specify the maximum
number of get-next operations to attempt while trying to retrieve
the remaining objects.
Use the oid argument to specify the object ID(s) to retrieve.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
13
Cisco IOS Scripting with Tcl
Troubleshooting Tips
Command or Action
Step 9 snmp_getid community-string
Example:
Purpose
(Optional) Retrieves the following variables from the SNMP entity
on the router: sysDesrc.0, sysObjectID.0, sysUpTime.0, sysContact.0,
sysName.0, and sysLocation.0.
•
Router(tcl)# snmp_getid private
Step 10 snmp_getnext community-string oid [oid2
oid3...]
(Optional) Retrieves a set of individual variables from a MIB table.
•
•
Example:
Use the community-string argument to specify the SNMP
community from which the objects will be retrieved.
Use the community-string argument to specify the SNMP
community from which the objects will be retrieved.
Use the oid argument to specify the object ID(s) to retrieve.
Router(tcl)# snmp_getnext public
1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.2.0
Step 11 snmp_getone community-string oid [oid2 oid3...] (Optional) Retrieves a set of individual variables from a MIB table.
•
Example:
•
Use the community-string argument to specify the SNMP
community from which the objects will be retrieved.
Use the oid argument to specify the object ID(s) to retrieve.
Router(tcl)# snmp_getone public
1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.2.0
Step 12 snmp_setany community-string oid type val
[oid2 type2 val2...]
(Optional) Retrieves current values of specified variables from a MIB
table and then performs a set request on the variables.
•
Example:
Router(tcl)# snmp_setany private
1.3.6.1.2.1.1.5.0 -d TCL-SNMP_TEST
•
•
•
Step 13 exit
Use the community-string argument to specify the SNMP
community from which the values of objects will be retrieved
and then set.
Use the oid argument to specify the object ID(s) to retrieve and
set.
Use the type argument to specify the type of object to retrieve
and set.
Use the val argument to specify the value of the object to be
retrieved and then set.
Exits Tcl configuration mode and returns to privileged EXEC mode.
Example:
Router(tcl)# exit
•
Troubleshooting Tips, page 14
Troubleshooting Tips
Use the Tcl puts command in a Tcl script to trace command execution.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
14
Running Predefined Tcl Scripts
Configuration Examples for Cisco IOS Scripting with Tcl
Running Predefined Tcl Scripts
Perform this optional task to run a predefined Tcl script in Cisco IOS software.
Before performing this task, you must create a Tcl script that can run on Cisco IOS software. The Tcl script
may be transferred to internal flash memory using any file system that the Cisco IOS file system (IFS)
supports, including TFTP, FTP, and rcp. The Tcl script may also be sourced from a remote location.
SUMMARY STEPS
1.
2.
3.
4.
enable
tclsh
Enter the Tcl source command with the filename and path.
exit
DETAILED STEPS
Command or Action
Purpose
Step 1 enable
Enables privileged EXEC mode.
•
Enter your password if prompted.
Example:
Router> enable
Step 2 tclsh
Enables the interactive Tcl shell and enters Tcl configuration mode.
Example:
Router# tclsh
Step 3 Enter the Tcl source command with the filename
and path.
Commands entered in Tcl configuration mode are sent first to the
interactive Tcl interpreter. If the command is not a valid Tcl
command, it is then sent to the CLI parser.
Example:
Router(tcl)# source slot0:test.tcl
Step 4 exit
Exits Tcl configuration mode and returns to privileged EXEC mode.
Example:
Router(tcl)# exit
Configuration Examples for Cisco IOS Scripting with Tcl
•
•
Example Tcl Script Using the show interfaces Command, page 16
Example Tcl Script for SMTP Support, page 16
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
15
Example Tcl Script Using the show interfaces Command
Configuration Examples for Cisco IOS Scripting with Tcl
•
Example Tcl Script for SNMP MIB Access, page 17
Example Tcl Script Using the show interfaces Command
Using the Tcl regular expression engine, scripts can filter specific information from show commands and
present it in a custom format. The following is an example of filtering the show interfaces command
output and creating a comma-separated list of BRI interfaces on the router:
tclsh
proc get_bri {} {
set check ""
set int_out [exec "show interfaces"]
foreach int [regexp -all -line -inline "(^BRI\[0-9]/\[0-9])" $int_out] {
if {![string equal $check $int]} {
if {[info exists bri_out]} {
append bri_out "," $int
} else {
set bri_out $int
}
set check $int
}
}
return $bri_out
}
Example Tcl Script for SMTP Support
The following Tcl script is useful for sending e-mail messages from a router.
##
## Place required comments here!!!
##
package provide sendmail 2.0
# Sendmail procedure for Support
namespace eval ::sendmail {
namespace export initialize configure sendmessage sendfile
array set ::sendmail::sendmail {
smtphost
mailhub
from
""
friendly
""
}
proc configure {} {}
proc initialize {smtphost from friendly} {
variable sendmail
if {[string length $smtphost]} then {
set sendmail(smtphost) $smtphost
}
if {[string length $from]} then {
set sendmail(from) $from
}
if {[string length $friendly]} then {
set sendmail(friendly) $friendly
}
}
proc sendmessage {toList subject body {tcl_trace 0}} {
variable sendmail
set smtphost $sendmail(smtphost)
set from $sendmail(from)
set friendly $sendmail(friendly)
if {$trace} then {
puts stdout "Connecting to $smtphost:25"
}
set sockid [socket $smtphost 25]
## DEBUG
set status [catch {
puts $sockid "HELO $smtphost"
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
16
Example Tcl Script for SNMP MIB Access
Configuration Examples for Cisco IOS Scripting with Tcl
flush $sockid
set result [gets $sockid]
if {$trace} then {
puts stdout "HELO $smtphost\n\t$result"
}
puts $sockid "MAIL From:<$from>"
flush $sockid
set result [gets $sockid]
if {$trace} then {
puts stdout "MAIL From:<$from>\n\t$result"
}
foreach to $toList {
puts $sockid "RCPT To:<$to>"
flush $sockid
}
set result [gets $sockid]
if {$trace} then {
puts stdout "RCPT To:<$to>\n\t$result"
}
puts $sockid "DATA "
flush $sockid
set result [gets $sockid]
if {$trace} then {
puts stdout "DATA \n\t$result"
}
puts $sockid "From: $friendly <$from>"
foreach to $toList {
puts $sockid "To:<$to>"
}
puts $sockid "Subject: $subject"
puts $sockid "\n"
foreach line [split $body "\n"] {
puts $sockid " $line"
}
puts $sockid "."
puts $sockid "QUIT"
flush $sockid
set result [gets $sockid]
if {$trace} then {
puts stdout "QUIT\n\t$result"
}
} result]
catch {close $sockid }
if {$status} then {
return -code error $result
}
return
}
proc sendfile {toList filename subject {tcl_trace 0}} {
set fd [open $filename r]
sendmessage $toList $subject [read $fd] $trace
return
}
}
Example Tcl Script for SNMP MIB Access
Using the Tcl shell, Tcl commands can perform actions on MIBs. The following example shows how to set
up the community access strings to permit access to SNMP. Public access is read-only, but private access is
read-write. The following example shows how to retrieve a large section of a table at once using the
snmp_getbulk Tcl command extension.
Two arguments, non-repeatersand max-repetitions, must be set when an snmp_getbulk command is
issued. The non-repeaters argument specifies that the first N objects are to be retrieved with a simple
snmp_getnext operation. The max-repetitions argument specifies that up to M snmp_getnext operations
are to be attempted to retrieve the remaining objects.
In this example, three bindings--sysUpTime (1.3.6.1.2.1.1.2.0), ifDescr (1.3.6.1.2.1.2.2.1.2), and ifType
(1.3.6.1.2.1.2.2.1.3)--are used. The total number of variable bindings requested is given by the formula N +
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
17
Cisco IOS Scripting with Tcl
Configuration Examples for Cisco IOS Scripting with Tcl
(M * R), where N is the number of non-repeaters (in this example 1), M is the max-repetitions (in this
example 5), and R is the number of request objects (in this case 2, ifDescr and ifType). Using the formula,
1 + (5 * 2) equals 11; and this is the total number of variable bindings that can be retrieved by this
snmp_getbulk request command.
Sample results for the individual variables include a retrieved value of sysUpTime.0 being 1336090, where
the unit is in milliseconds. The retrieved value of ifDescr.1 (the first interface description) is
FastEthernet0/0, and the retrieved value of ifType.1 (the first interface type) is 6, which corresponds to the
ethernetCsmacd type.
snmp-server community public RO
snmp-server community private RW
tclsh
snmp_getbulk public 1 5 1.3.6.1.2.1.1.2.0 1.3.6.1.2.1.2.2.1.2
{<obj oid='sysUpTime.0' val='1336090'/>}
{<obj oid='ifDescr.1' val='FastEthernet0/0'/>}
{<obj oid='ifType.1' val='6'/>}
{<obj oid='ifDescr.2' val='FastEthernet1/0'/>}
{<obj oid='ifType.2' val='6'/>}
{<obj oid='ifDescr.3' val='Ethernet2/0'/>}
{<obj oid='ifType.3' val='6'/>}
{<obj oid='ifDescr.4' val='Ethernet2/1'/>}
{<obj oid='ifType.4' val='6'/>}
{<obj oid='ifDescr.5' val='Ethernet2/2'/>}
{<obj oid='ifType.5' val='6'/>}
1.3.6.1.2.1.2.2.1.3
The following example shows how to retrieve the sysDescr.0, sysObjectID.0, sysUpTime.0, sysContact.0,
sysName.0, and sysLocation.0 variables--in this example shown as system.1.0, system.2.0, system.3.0,
system.4.0, system.5.0, and system.6.0--from the SNMP entity on the router using the snmp_getid Tcl
command extension.
tclsh
snmp_getid public
{<obj oid='system.1.0' val='Cisco Internetwork Operating System Software
Cisco IOS(tm) 7200 Software (C7200-IK9S-M), Experimental Version 12.3(20030507:225511)
[geotpi2itd1 124]
Copyright (c) 1986-2003 by Cisco Systems, Inc.
Compiled Wed 21-May-03 16:16 by engineer'/>}
{<obj oid='system.2.0' val='products.223'/>}
{<obj oid='sysUpTime.0' val='6664317'/>}
{<obj oid='system.4.0' val='1-800-553-2447 - phone the TAC'/>}
{<obj oid='system.5.0' val='c7200.myCompany.com'/>}
{<obj oid='system.6.0' val='Bldg 24, San Jose, CA'/>}
The following example shows how to retrieve a set of individual variables from the SNMP entity on the
router using the snmp_getnext Tcl command extension:
snmp_getnext public 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.2.0
{<obj oid='system.2.0' val='products.223'/>}
{<obj oid='sysUpTime.0' val='6683320'/>}
The following example shows how to retrieve a set of individual variables from the SNMP entity on the
router using the snmp_getone Tcl command extension:
snmp_getone public 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.2.0
{<obj oid='system.1.0' val='Cisco Internetwork Operating System Software
Cisco IOS(tm) 7200 Software (C7200-IK9S-M), Experimental Version 12.3(20030507:225511)
[geotpi2itd1 124]
Copyright (c) 1986-2003 by Cisco Systems, Inc.
Compiled Wed 21-May-03 16:16 by engineer'/>}
{<obj oid='system.2.0' val='products.223'/>}
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
18
Cisco IOS Scripting with Tcl
Additional References
The following example shows how to change something in the configuration of the router using the
snmp_setany Tcl command extension. In this example, the hostname of the router is changed to
TCLSNMP-HOST.
tclsh
snmp_setany private 1.3.6.1.2.1.1.5.0 -d TCLSNMP-HOST
{<obj oid='system.5.0' val='TCLSNMP-HOST'/>}
Additional References
The following sections provide references related to the Cisco IOS Scripting with Tcl feature.
Related Documents
Related Topic
Document Title
Embedded Syslog Manager
Embedded Syslog Manager module
Network Management commands (including Tcl
and logging commands): complete command
syntax, defaults, command mode, command
history, usage guidelines, and examples
Cisco IOS Network Management Command
Reference
Standards
Standards
Title
No new or modified standards are supported by this -feature, and support for existing standards has not
been modified by this feature.
MIBs
MIBs
MIBs Link
No new or modified MIBs are supported by this
feature, and support for existing MIBs has not been
modified by this feature.
To locate and download MIBs for selected
platforms, Cisco IOS releases, and feature sets, use
Cisco MIB Locator found at the following URL:
http://www.cisco.com/go/mibs
RFCs
RFCs
Title
No new or modified RFCs are supported by this
feature, and support for existing RFCs has not been
modified by this feature.
--
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
19
Cisco IOS Scripting with Tcl
Feature Information for Cisco IOS Scripting with Tcl
Technical Assistance
Description
Link
The Cisco Support website provides extensive
http://www.cisco.com/cisco/web/support/
online resources, including documentation and tools index.html
for troubleshooting and resolving technical issues
with Cisco products and technologies.
To receive security and technical information about
your products, you can subscribe to various
services, such as the Product Alert Tool (accessed
from Field Notices), the Cisco Technical Services
Newsletter, and Really Simple Syndication (RSS)
Feeds.
Access to most tools on the Cisco Support website
requires a Cisco.com user ID and password.
Feature Information for Cisco IOS Scripting with Tcl
The following table provides release information about the feature or features described in this module.
This table lists only the software release that introduced support for a given feature in a given software
release train. Unless noted otherwise, subsequent releases of that software release train also support that
feature.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support.
To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.
Table 4
Feature Information for Cisco IOS Scripting with Tcl
Feature Name
Releases
Feature Information
Cisco IOS Scripting with Tcl
12.3(2)T 12.3(7)T 12.2(25)S
12.2(33)SXH 12.2(33)SRC
12.2(33)SB Cisco IOS XE
3.1.0SG
The Cisco IOS Scripting with Tcl
feature provides the ability to run
Tcl version 8.3.4 commands from
the Cisco IOS command-line
interface.
The following commands were
introduced or modified: scripting
tcl encdir, scripting tcl init,
scripting tcl low-memory,
tclquit, tclsh.
Tcl SNMP MIB Access
12.3(7)T 12.2(25)S 12.2(33)SXH The Tcl SNMP MIB Access
12.2(33)SRC 12.2(33)SB Cisco
feature introduces a set of UNIXIOS XE 3.1.0SG
like SNMP commands to make
access to Simple Network
Management Protocol (SNMP)
MIB objects easier.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
20
Cisco IOS Scripting with Tcl
Glossary
Feature Name
Releases
Feature Information
TCL UDP and VRF support
15.1(1)T
The Tcl UDP and VRF feature
provides support for UDP sockets
in IOS Tcl.
The following commands were
introduced or modified:
fconfigure, socket, udp_open,
udp_peek.
Glossary
ESM --Embedded Syslog Manager.
IVR --Interactive Voice Response.
MIB --Management Information Base.
SNMP --Simple Network Management Protocol.
Tcl --Tool Command Language.
Note
See Internetworking Terms and Acronyms for terms not included in this glossary.
Cisco and the Cisco Logo are trademarks of Cisco Systems, Inc. and/or its affiliates in the U.S. and other
countries. A listing of Cisco's trademarks can be found at www.cisco.com/go/trademarks. Third party
trademarks mentioned are the property of their respective owners. The use of the word partner does not
imply a partnership relationship between Cisco and any other company. (1005R)
Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be
actual addresses and phone numbers. Any examples, command display output, network topology diagrams,
and other figures included in the document are shown for illustrative purposes only. Any use of actual IP
addresses or phone numbers in illustrative content is unintentional and coincidental.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
21
Example Tcl Script for SNMP MIB Access
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
22
Signed Tcl Scripts
The Signed Tcl Scripts feature allows you to create a certificate to generate a digital signature and sign a
Tool Command Language (Tcl) script with that digital signature. This feature also allows you to work
with existing scripts and certificates. The digital signature is verified for authentication and then run with
trusted access to the Tcl interpreter. If the script does not contain the digital signature, the script may run
in a limited mode for untrusted scripts, or may not run at all.
•
•
•
•
•
•
•
•
•
•
Finding Feature Information, page 23
Prerequisites for Signed Tcl Scripts, page 23
Restrictions for Signed Tcl Scripts, page 23
Information About Signed Tcl Scripts, page 24
How to Configure Signed Tcl Scripts, page 25
Configuration Examples for Signed Tcl Script, page 37
Additional References, page 41
Feature Information for Signed Tcl Scripts, page 42
Glossary, page 43
Notices, page 43
Finding Feature Information
Your software release may not support all the features documented in this module. For the latest feature
information and caveats, see the release notes for your platform and software release. To find information
about the features documented in this module, and to see a list of the releases in which each feature is
supported, see the Feature Information Table at the end of this document.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support.
To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.
Prerequisites for Signed Tcl Scripts
For this feature to work, the Cisco IOS public key infrastructure (PKI) configuration trustpoint commands
must be enabled.
For further details, see the Prerequisites for Signed Tcl Scripts, page 23.
Restrictions for Signed Tcl Scripts
For this feature to work, you must be running the following:
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
23
Cisco IOS PKI
Information About Signed Tcl Scripts
•
•
•
Cisco IOS Crypto image
OpenSSL Version 0.9.7a or above
Expect
Information About Signed Tcl Scripts
The Signed Tcl Scripts feature introduces security for the Tcl scripts. This feature allows you to create a
certificate to generate a digital signature and sign a Tcl script with that digital signature. This certificate
examines the Tcl scripts prior to running them. The script is checked for a digital signature from Cisco. In
addition, third parties may also sign a script with a digital signature. You may wish to sign your own
internally developed Tcl scripts or you could use a script developed by a third party. If the script contains
the correct digital signature, it is believed to be authentic and runs with full access to the Tcl interpreter. If
the script does not contain the digital signature, the script may be run in a limited mode, known as Safe Tcl
mode, or may not run at all.
To create and use signed Tcl scripts, you should understand the following concepts:
•
•
•
Cisco IOS PKI, page 24
RSA Key Pair, page 24
Certificate and Trustpoint, page 25
Cisco IOS PKI
Cisco IOS PKI provides certificate management to support security protocols such as IP security (IPsec),
secure shell (SSH), and secure socket layer (SSL). A PKI is composed of the following entities:
•
•
•
•
•
Peers communicating on a secure network
At least one certification authority (CA) that grants and maintains certificates
Digital certificates, which contain information such as the certificate validity period, peer identity
information, encryption keys that are used for secure communication, and the signature of the issuing
CA
An optional registration authority (RA) to offload the CA by processing enrollment requests
A distribution mechanism (such as Lightweight Directory Access Protocol [LDAP] or HTTP) for
certificate revocation lists (CRLs)
PKI provides you with a scalable, secure mechanism for distributing, managing, and revoking encryption
and identity information in a secured data network. Every routing device participating in the secured
communication is enrolled in the PKI in a process where the routing device generates a Rivest, Shamir, and
Adelman (RSA) key pair (one private key and one public key) and has its identity validated by a trusted
routing device (also known as a CA or trustpoint).
After each routing device enrolls in a PKI, every peer (also known as an end host) in a PKI is granted a
digital certificate that has been issued by a CA. When peers must negotiate a secured communication
session, they exchange digital certificates. Based on the information in the certificate, a peer can validate
the identity of another peer and establish an encrypted session with the public keys contained in the
certificate.
RSA Key Pair
An RSA key pair consists of a public key and a private key. When setting up your PKI, you must include
the public key in the certificate enrollment request. After the certificate has been granted, the public key is
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
24
Certificate and Trustpoint
How to Configure Signed Tcl Scripts
included in the certificate so that peers can use it to encrypt data that is sent to the router. The private key is
kept on the router and used both to decrypt the data sent by peers and to digitally sign transactions when
negotiating with peers.
RSA key pairs contain a key modulus value. The modulus determines the size of the RSA key. The larger
the modulus, the more secure the RSA key. However, keys with large modulus values take longer to
generate, and encryption and decryption operations take longer with larger keys.
Certificate and Trustpoint
A certification authority (CA), also known as a trustpoint, manages certificate requests and issues
certificates to participating network devices. These services (managing certificate requests and issuing
certificates) provide centralized key management for the participating devices and are explicitly trusted by
the receiver to validate identities and to create digital certificates. Before any PKI operations can begin, the
CA generates its own public key pair and creates a self-signed CA certificate; thereafter, the CA can sign
certificate requests and begin peer enrollment for the PKI.
You can use a CA provided by a third-party CA vendor, or you can use an internal CA, which is the Cisco
IOS Certificate Server.
How to Configure Signed Tcl Scripts
•
•
•
•
•
•
•
•
•
Generating a Key Pair, page 25
Generating a Certificate, page 27
Signing the Tcl Scripts, page 28
Verifying the Signature, page 29
Converting the Signature into Nonbinary Data, page 30
Configuring the Router with a Certificate, page 32
Verifying the Trustpoint, page 35
Verifying the Signed Tcl Script, page 36
What to Do Next, page 37
Generating a Key Pair
The key pair consists of a private key and a public key. The private key is intended to be kept private,
accessible only to the creator. The public key is generated from the private key and is intended to be known
to the public.
To generate a key pair, use the openssl genrsa command and then the openssl rsa command.
SUMMARY STEPS
1. openssl genrsa -out private-key-file bit-length
2. ls -l
3. openssl rsa -in private-key-file -pubout -out public-key-file
4. ls -l
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
25
Signed Tcl Scripts
How to Configure Signed Tcl Scripts
DETAILED STEPS
Step 1
openssl genrsa -out private-key-file bit-length
This command generates a private key that is bit-length bits long and writes the key to the private-key-filefile.
Host%
openssl genrsa -out privkey.pem 2048
Example:
Generating RSA private key, 2048 bit long modulus
.........+++
...............................................................................+++
e is 65537 (0x10001)
Step 2
ls -l
This command displays detailed information about each file in the current directory, including the permissions,
owners, size, and when last modified.
Example:
Host% ls -l
total 8
-rw-r--r--
1 janedoe eng12
1679 Jun 12 14:55 privkey.pem
The privkey.pem file contains the private key generated using the openssl genrsa command.
Step 3
openssl rsa -in private-key-file -pubout -out public-key-file
This command generates a public key based on the specified private key in the private-key-file file and writes the
public key to the public-key-filefile.
Example:
Host% openssl rsa -in privkey.pem -pubout -out pubkey.pem
writing RSA key
Step 4
ls -l
This command displays detailed information about each file in the current directory, including the permissions,
owners, size, and when last modified.
Example:
Host% ls -l
total 16
-rw-r--r--rw-r--r--
1 janedoe eng12
1 janedoe eng12
1679 Jun 12 14:55 privkey.pem
451 Jun 12 14:57 pubkey.pem
The pubkey.pem file contains the public key generated from the private key using the openssl rsa command.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
26
Generating a Certificate
How to Configure Signed Tcl Scripts
Generating a Certificate
Perform this task to generate a certificate. To generate an X.509 certificate, use the openssl req command.
SUMMARY STEPS
1. openssl req -new -x509 -key private-key-file -out certificate-file -days expiration-days
2. ls -l
DETAILED STEPS
Step 1
openssl req -new -x509 -key private-key-file -out certificate-file -days expiration-days
This command creates an X.509 certificate, with full access to a private key that is stored in the private-key-file file,
and stores the certificate in the certificate-filefile. The certificate is configured to expire in expiration-days days.
To complete the command, enter the following Distinguished Name (DN) information when prompted:
•
•
•
•
•
•
Country name
State or province name
Organization name
Organizational unit name
Common name
Email address
At each prompt, text enclosed in square brackets indicates the default value that will be used if you do not enter a
value before you press Enter.
This example shows how to create an X.509 certificate that has full access to the private key in the privkey.pem file.
The certificate is written to the cert.pem file and will expire 1095 days after the creation date.
Example:
Host% openssl req -new -x509 -key privkey.pem -out cert.pem -days 1095
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) [GB]:US
State or Province Name (full name) [Berkshire]:California
Locality Name (eg, city) [Newbury]:San Jose
Organization Name (eg, company) [My Company Ltd]:Cisco Systems, Inc.
Organizational Unit Name (eg, section) []:DEPT_ACCT
Common Name (eg, your name or your server's hostname) []:Jane
Email Address []:janedoe@company.com
Step 2
ls -l
This command displays detailed information about each file in the current directory, including the permissions,
owners, size, and when last modified.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
27
Signing the Tcl Scripts
How to Configure Signed Tcl Scripts
Example:
Host% ls -l
total 24
-rw-r--r--rw-r--r--rw-r--r--
1 janedoe eng12
1 janedoe eng12
1 janedoe eng12
1659 Jun 12 15:01 cert.pem
1679 Jun 12 14:55 privkey.pem
451 Jun 12 14:57 pubkey.pem
The cert.pem file contains the X.509 certificate created using the openssl req command.
Signing the Tcl Scripts
Perform this task to sign the Tcl scripts. You will need to sign the Tcl file and output in OpenSSL
document in pkcs7 (PKCS#7) format.
To sign the Tcl file, use the openssl smime command with the -sign keyword.
SUMMARY STEPS
1. openssl smime -sign -in tcl-file -out signed-tcl-file -signer certificate-file -inkey private-key-file outform DER -binary
2. ls -l
DETAILED STEPS
Step 1
openssl smime -sign -in tcl-file -out signed-tcl-file -signer certificate-file -inkey private-key-file -outform DER binary
This command signs the Tcl filename tcl-file using the certificate stored in certificate-file and the private key stored in
private-key-file file and then writes the signed Tcl file in DER PKCS#7 format to the signed-tcl-filefile.
Example:
Host% openssl smime -sign -in hello -out hello.pk7 -signer cert.pem -inkey privkey.pem -outform
DER -binary
Step 2
ls -l
This command displays detailed information about each file in the current directory, including the permissions,
owners, size, and when last modified.
Example:
Host% ls -l
total 40
-rw-r--r--rw-r--r--rw-r--r--rw-r--r--rw-r--r--
1
1
1
1
1
janedoe
janedoe
janedoe
janedoe
janedoe
eng12
eng12
eng12
eng12
eng12
1659
115
1876
1679
451
Jun
Jun
Jun
Jun
Jun
12
13
13
12
12
15:01
10:16
10:16
14:55
14:57
cert.pem
hello
hello.pk7
privkey.pem
pubkey.pem
The hello.pk7 file contains the signed Tcl file created by the openssl smime command from the unsigned Tcl file
named hello and using the X.509 certificate in the cert.pem file.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
28
Verifying the Signature
How to Configure Signed Tcl Scripts
Verifying the Signature
Perform this task to verify that the signature matches the data, use the openssl smime command with the verify keyword. The original Tcl content must be provided in the input file, because the file does not have
the original content.
SUMMARY STEPS
1. openssl smime -verify -in signed-tcl-file -CAfile certificate-file -inform DER -content tcl-file
2. ls -l
DETAILED STEPS
Step 1
openssl smime -verify -in signed-tcl-file -CAfile certificate-file -inform DER -content tcl-file
This command verifies the signed Tcl file stored in DER PKCS#7 format in signed-tcl-file using the trusted
Certificate Authority (CA) certificates in certificate-file and then writes the detached content to the file tcl-file.
The following example shows how to verify the signature with the input file hello.pk7:
Example:
Host% openssl smime -verify -in hello.pk7 -CAfile cert.pem -inform DER -content hello
puts hello
puts "argc = $argc"
puts "argv = $argv"
puts "argv0 = $argv0"
puts "tcl_interactive = $tcl_interactive"
Verification successful
Note The SSL command page describes -in filename as the input message to be encrypted or signed or the MIME
message to be decrypted or verified. For more information, go to http://www.openssl.org/ .
Step 2
ls -l
This command displays detailed information about each file in the current directory, including the permissions,
owners, size, and when last modified.
Example:
Host% ls -l
total 40
-rw-r--r--rw-r--r--rw-r--r--rw-r--r--rw-r--r--
1
1
1
1
1
janedoe
janedoe
janedoe
janedoe
janedoe
eng12
eng12
eng12
eng12
eng12
1659
115
1876
1679
451
Jun
Jun
Jun
Jun
Jun
13
13
13
12
12
10:18
10:17
10:16
14:55
14:57
cert.pem
hello
hello.pk7
privkey.pem
pubkey.pem
The hello file contains the content detached from the signed Tcl file hello.pk7 by running the openssl smime
command with the -verify keyword. If the verification was successful, the signer’s certificates are written to the X.509
certificate in the cert.pem file.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
29
Converting the Signature into Nonbinary Data
How to Configure Signed Tcl Scripts
Converting the Signature into Nonbinary Data
Perform this task to convert the signature from binary to nonbinary data.
SUMMARY STEPS
1. xxd -ps signed-tcl-file > nonbinary-signature-file
2. Create a script that displays #Cisco Tcl Signature V1.0 in the first line andinserts a comment character
(#) at the beginning of each line of the input file and writes each line to a file whose name is formed by
appending the text string “_sig” to the name of the input file.
3. Run the script, supplying the name of the file containing the nonbinary signature file (nonbinarysignature-file) as the input argument.
4. ls -l
5. cat signed-tcl-file commented-nonbinary-signature-file > signed-tcl-script
6. cat signed-tcl-script
DETAILED STEPS
Step 1
xxd -ps signed-tcl-file > nonbinary-signature-file
This command converts the signature in signed-tcl-file from binary to nonbinary data and stores it as a hexadecimal
dump in the file nonbinary-signature-file.
Example:
Host% xxd -ps hello.pk7 > hello.hex
Step 2
Create a script that displays #Cisco Tcl Signature V1.0 in the first line andinserts a comment character (#) at the
beginning of each line of the input file and writes each line to a file whose name is formed by appending the text
string “_sig” to the name of the input file.
In this example the cat command is used to display the contents of the script file named my_append.
Example:
Host% cat my_append
#!/usr/bin/env expect
set my_first {#Cisco Tcl Signature V1.0}
set newline {}
set my_file [lindex $argv 0]
set my_new_file ${my_file}_sig
set my_new_handle [open $my_new_file w]
set my_handle [open $my_file r]
puts $my_new_handle $newline
puts $my_new_handle $my_first
foreach line [split [read $my_handle] "\n"]
set new_line {#}
append new_line $line
puts $my_new_handle $new_line
}
{
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
30
Signed Tcl Scripts
How to Configure Signed Tcl Scripts
close $my_new_handle
close $my_handle
Step 3
Run the script, supplying the name of the file containing the nonbinary signature file (nonbinary-signature-file) as the
input argument.
In this example, the my_append script is run with the nonbinary signature file hello.hex specified as input. The output
file will be named hello.hex_sig.
Example:
Host% my_append hello.hex
Step 4
ls -l
This command displays detailed information about each file in the current directory, including the permissions,
owners, size, and when last modified.
Example:
Host% ls -l
total 80
-rw-r--r--rw-r--r--rw-r--r--rw-r--r--rw-r--r--rwxr--r--rw-r--r--rw-r--r--
Step 5
1
1
1
1
1
1
1
1
janedoe
janedoe
janedoe
janedoe
janedoe
janedoe
janedoe
janedoe
eng12
eng12
eng12
eng12
eng12
eng12
eng12
eng12
1659
115
3815
3907
1876
444
1679
451
Jun
Jun
Jun
Jun
Jun
Jun
Jun
Jun
13
13
13
13
13
13
12
12
10:18
10:17
10:20
10:22
10:16
10:22
14:55
14:57
cert.pem
hello
hello.hex
hello.hex_sig
hello.pk7
my_append
privkey.pem
pubkey.pem
The hello.hex file contains nonbinary data (stored as a hexadecimal dump) converted from the binary signature in the
signed Tcl file hello.pk7. The my_append file contains the script that inserts a comment character at the beginning of
each line of the input file. The hello.hex_sig file is the file created by running the my_append script on the nonbinary
signature file.
cat signed-tcl-file commented-nonbinary-signature-file > signed-tcl-script
This command appends the contents of the nonbinary signature file (commented-nonbinary-signature-file) to the
signed Tcl file stored in DER PKCS#7 format (in the signed-tcl-file file). The concatenated output is written to the file
signed-tcl-script.
Example:
Host% cat hello hello.hex_sig > hello.tcl
Step 6
cat signed-tcl-script
This command displays the contents of the file signed-tcl-script, which is the concatenation of content detached from
the signed Tcl file and the nonbinary signature file.
Example:
Host% cat hello.tcl
puts hello
puts "argc = $argc"
puts "argv = $argv"
puts "argv0 = $argv0"
puts "tcl_interactive = $tcl_interactive"
#Cisco Tcl Signature V1.0
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
31
Configuring the Router with a Certificate
How to Configure Signed Tcl Scripts
#3082075006092a864886f70d010702a08207413082073d020101310b3009
#06052b0e03021a0500300b06092a864886f70d010701a08204a13082049d
#30820385a003020102020100300d06092a864886f70d0101040500308195
#310b3009060355040613025553311330110603550408130a43616c69666f
#726e69613111300f0603550407130853616e204a6f7365311c301a060355
#040a1313436973636f2053797374656d732c20496e632e310e300c060355
#040b13054e53535447310d300b060355040313044a6f686e3121301f0609
#2a864886f70d01090116126a6c6175746d616e40636973636f2e636f6d30
#1e170d3037303631323232303134335a170d313030363131323230313433
#5a308195310b3009060355040613025553311330110603550408130a4361
#6c69666f726e69613111300f0603550407130853616e204a6f7365311c30
#1a060355040a1313436973636f2053797374656d732c20496e632e310e30
#0c060355040b13054e53535447310d300b060355040313044a6f686e3121
#301f06092a864886f70d01090116126a6c6175746d616e40636973636f2e
#636f6d30820122300d06092a864886f70d01010105000382010f00308201
#0a0282010100a751eb5ec1f3009738c88a55987c07b759c36f3386342283
#67ea20a89d9483ae85e0c63eeded8ab3eb7a08006689f09136f172183665
#c971099ba54e77ab47706069bbefaaab8c50184396350e4cc870c4c3f477
#88c55c52e2cf411f05b59f0eaec0678ff5cc238fdce2263a9fc6b6c244b8
#ffaead865c19c3d3172674a13b24c8f2c01dd8b1bd491c13e84e29171b85
#f28155d81ac8c69bb25ca23c2921d85fbf745c106e7aff93c72316cbc654
#4a34ea88174a8ba7777fa60662974e1fbac85a0f0aeac925dba6e5e850b8
#7caffce2fe8bb04b61b62f532b5893c081522d538005df81670b931b0ad0
#e1e76ae648f598a9442d5d0976e67c8d55889299147d0203010001a381f5
#3081f2301d0603551d0e04160414bc34132be952ff8b9e1af3b93140a255
#e54a667c3081c20603551d230481ba3081b78014bc34132be952ff8b9e1a
#f3b93140a255e54a667ca1819ba48198308195310b300906035504061302
#5553311330110603550408130a43616c69666f726e69613111300f060355
#0407130853616e204a6f7365311c301a060355040a1313436973636f2053
#797374656d732c20496e632e310e300c060355040b13054e53535447310d
#300b060355040313044a6f686e3121301f06092a864886f70d0109011612
#6a6c6175746d616e40636973636f2e636f6d820100300c0603551d130405
#30030101ff300d06092a864886f70d010104050003820101000c83c1b074
#6720929c9514af6d5df96f0a95639f047c40a607c83d8362507c58fa7f84
#aa699ec5e5bef61b2308297a0662c653ff446acfbb6f5cb2dd162d939338
#a5e4d78a5c45021e5d4dbabb8784efbf50cab0f5125d164487b31f5cf933
#a9f68f82cd111cbab1739d7f372ec460a7946882874b0a0f22dd53acbd62
#a944a15e52e54a24341b3b8a820f23a5bc7ea7b2278bb56838b8a4051926
#af9c167274ff8449003a4e012bcf4f4b3e280f85209249a390d14df47435
#35efabce720ea3d56803a84a2163db4478ae19d7d987ef6971c8312e280a
#aac0217d4fe620c6582a48faa8ea5e3726a99012e1d55f8d61b066381f77
#4158d144a43fb536c77d6a318202773082027302010130819b308195310b
#3009060355040613025553311330110603550408130a43616c69666f726e
#69613111300f0603550407130853616e204a6f7365311c301a060355040a
#1313436973636f2053797374656d732c20496e632e310e300c060355040b
#13054e53535447310d300b060355040313044a6f686e3121301f06092a86
#4886f70d01090116126a6c6175746d616e40636973636f2e636f6d020100
#300906052b0e03021a0500a081b1301806092a864886f70d010903310b06
#092a864886f70d010701301c06092a864886f70d010905310f170d303730
#3631333137313634385a302306092a864886f70d01090431160414372cb3
#72dc607990577fd0426104a42ee4158d2b305206092a864886f70d01090f
#31453043300a06082a864886f70d0307300e06082a864886f70d03020202
#0080300d06082a864886f70d0302020140300706052b0e030207300d0608
#2a864886f70d0302020128300d06092a864886f70d010101050004820100
#72db6898742f449b26d3ac18f43a1e7178834fb05ad13951bf042e127eea
#944b72b96f3b8ecf7eb52f3d0e383bf63651750223efe69eae04287c9dae
#b1f31209444108b31d34e46654c6c3cc10b5baba887825c224ec6f376d49
#00ff7ab2d9f88402dab9a2c2ab6aa3ecceeaf5a594bdc7d3a822c55e7daa
#aa0c2b067e06967f22a20e406fe21d9013ecc6bd9cd6d402c2749f8bea61
#9f8f87acfbc9e10d6ce91502e34629adca6ee855419afafe6a8233333e14
#ad4c107901d1f2bca4d7ffaadddbc54192a25da662f8b8509782c76977b8
#94879453fbb00486ccc55f88db50fcc149bae066916b350089cde51a6483
#2ec14019611720fc5bbe2400f24225fc
Configuring the Router with a Certificate
Perform this task to configure the router with a certificate.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
32
Signed Tcl Scripts
How to Configure Signed Tcl Scripts
You must already have a Cisco IOS Crypto image; otherwise you cannot configure a certificate.
SUMMARY STEPS
1. enable
2. configure terminal
3. crypto pki trustpoint name
4. enrollment terminal
5. exit
6. crypto pki authenticate name
7. At the prompt, enter the base-encoded CA certificate.
8. scripting tcl secure-mode
9. scripting tcl trustpoint name name
10. scripting tcl trustpoint untrusted {execute | safe-execute | terminate}
11. exit
12. tclsafe
DETAILED STEPS
Step 1
enable
Enables privileged EXEC mode. Enter your password if prompted.
Example:
Router> enable
Step 2
configure terminal
Enters global configuration mode.
Example:
Router# configure terminal
Step 3
crypto pki trustpoint name
Declares the router is to use the Certificate Authority (CA) mytrust and enters ca-trustpoint configuration mode.
Example:
Router(config)# crypto pki trustpoint mytrust
Step 4
enrollment terminal
Specifies manual cut-and-paste certificate enrollment. When this command is enabled, the router displays the
certificate request on the console terminal, allowing you to enter the issued certificate on the terminal.
Example:
Router(ca-trustpoint)# enrollment terminal
Step 5
exit
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
33
Signed Tcl Scripts
How to Configure Signed Tcl Scripts
Exits ca-trustpoint configuration mode and returns to global configuration mode.
Example:
Router(ca-trustpoint)# exit
Step 6
crypto pki authenticate name
Retrieves the CA certificate and authenticates it. Check the certificate fingerprint if prompted.
Note Because the CA signs its own certificate, you should manually authenticate the public key of the CA by
contacting the CA administrator when you perform this command.
Example:
Router(config)# crypto pki authenticate mytrust
Step 7
At the prompt, enter the base-encoded CA certificate.
Example:
Enter the base 64 encoded CA certificate.
End with a blank line or the word "quit" on a line by itself
MIIEuDCCA6CgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBnjELMAkGA1UEBhMCVVMx
EzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRwwGgYDVQQK
ExNDaXNjbyBTeXN0ZW1zLCBJbmMuMQ4wDAYDVQQLEwVOU1NURzEWMBQGA1UEAxMN
Sm9obiBMYXV0bWFubjEhMB8GCSqGSIb3DQEJARYSamxhdXRtYW5AY2lzY28uY29t
MB4XDTA2MTExNzE3NTgwMVoXDTA5MTExNjE3NTgwMVowgZ4xCzAJBgNVBAYTAlVT
MRMwEQYDVQQIEwpDYWxpZm9ybmlhMREwDwYDVQQHEwhTYW4gSm9zZTEcMBoGA1UE
ChMTQ2lzY28gU3lzdGVtcywgSW5jLjEOMAwGA1UECxMFTlNTVEcxFjAUBgNVBAMT
DUpvaG4gTGF1dG1hbm4xITAfBgkqhkiG9w0BCQEWEmpsYXV0bWFuQGNpc2NvLmNv
bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALxtqTMCirMb+CdyWLuH
oWAM8CEJDwQggL7MWBhoi3TSMd/ww2XBB9biBtdlH6jHsjCiOwAR5OorakwfPyf7
mvRJ2PqJALs+Vn93VBKIG6rZUl4+wdOx686BVddIZvEJQPbROiYTzfazWV70aLMV
bd7/B7vF1SG1YK9y1tX9p9nZyZ0x47OAXetwOaGinvlG7VNuTXaASBLUjCRZsIlz
SBrXXedBzZ6+BuoWm1FK45EYSlag5Rt9RGXXMBqzx91iyhrJ3zDDmkExa45yKJET
mAgDVMcpeteJtif47UDZJK30g4MbMyx/c8WGhmJ54qRL9BZEPmDxMQkNP10l8MAl
Q8sCAwEAAaOB/jCB+zAdBgNVHQ4EFgQU9/ToDvbMR3JfJ4xEa4X47oNFq5kwgcsG
A1UdIwSBwzCBwIAU9/ToDvbMR3JfJ4xEa4X47oNFq5mhgaSkgaEwgZ4xCzAJBgNV
BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMREwDwYDVQQHEwhTYW4gSm9zZTEc
MBoGA1UEChMTQ2lzY28gU3lzdGVtcywgSW5jLjEOMAwGA1UECxMFTlNTVEcxFjAU
BgNVBAMTDUpvaG4gTGF1dG1hbm4xITAfBgkqhkiG9w0BCQEWEmpsYXV0bWFuQGNp
c2NvLmNvbYIBADAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBtEs/4
MQeN9pT+XPCPg2ObQU8y2AadI+I34YK+fDHsFOh68hZhpszTN2VpNEvkFXpADhgr
7DkNGtwTCla481v70iNFViQVL+inNrZwWMxoTnUNCK7Hc5kHkXt6cj0mvsefVUzx
Xl70mauhESRVlmYWrJxSsrEILerZYsuv5HbFdand+/rErmP2HVyfdntLnKdSzmXJ
5lwE/Et2QtYNGor0OBlLesowfslR3LhHi4wn+5is7mALgNw/NuTiUr1zH18OeB4m
wcpBIJsLaJu6ZUJQl7IqdswSa3fHd5qq0/k8P9z0YAYrf3+MFQr4ibvsYvHlO087
o2Js1gW4qz34pqNh
Certificate has the following attributes:
Fingerprint MD5: 1E327DBB 330936EB 2FB8EACB 4FD1133E
Fingerprint SHA1: EE7FF9F4 05148842 B9D50FAC D76FDC9C E0703246
% Do you accept this certificate? [yes/no]: yes
Trustpoint CA certificate accepted.
% Certificate successfully imported
Step 8
scripting tcl secure-mode
Enables signature verification of the interactive Tcl scripts.
Router(config)# scripting tcl secure-mode
Step 9
scripting tcl trustpoint name name
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
34
Verifying the Trustpoint
How to Configure Signed Tcl Scripts
Associates an existing configured trustpoint name with a certificate to verify Tcl scripts.
Router(config)# scripting tcl trustpoint name mytrust
Step 10
scripting tcl trustpoint untrusted {execute | safe-execute | terminate}
(Optional) Allows the interactive Tcl scripts to run regardless of the scripts failing in the signature check or in
untrusted mode using one of the three keywords: execute, safe-execute, or terminate.
•
execute --Executes Tcl scripts even if the signature verification fails. If the execute keyword is configured,
signature verification is not at all performed.
Note Use of this keyword is usually not recommended because the signature verification is not at all performed.
The execute keyword is provided for internal testing purposes and to provide flexibility. For example, in a situation
where a certificate has expired but the other configurations are valid and you want to work with the existing
configuration, then you can use the execute keyword to work around the expired certificate.
•
•
safe-execute --Allows the script to run in safe mode. You can use the tclsafe command and also enter the
interactive Tcl shell safe mode to explore the safe mode Tcl commands that are available. In order to get a better
understanding of what is available in this limited safe mode, use the tclsafe Exec command to explore the
options.
terminate --Stops any script from running and reverts to default behavior. The default policy is to terminate.
When the last trustpoint name is removed, the untrusted action is also removed. The untrusted action cannot be
entered until at least one trustpoint name is configured for Tcl.
The following example shows how to execute the Tcl script in safe mode using the safe-execute keyword when the
signature verification fails.
Router(config)# scripting tcl trustpoint untrusted safe-execute
Step 11
exit
Exits global configuration mode and returns to privileged EXEC mode.
Router(config)# exit
Step 12
tclsafe
(Optional) Enables the interactive Tcl shell untrusted safe mode. This allows you to manually run Tcl commands from
the Cisco IOS command-line interface (CLI) in untrusted safe mode.
Router# tclsafe
Example:
Verifying the Trustpoint
To display the trustpoints that are configured in the router, use the show crypto pki trustpoints command.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
35
Verifying the Signed Tcl Script
How to Configure Signed Tcl Scripts
SUMMARY STEPS
1. enable
2. show crypto pki trustpoints
DETAILED STEPS
Step 1
enable
This command enables privileged EXEC mode.
Example:
Router> enable
Step 2
show crypto pki trustpoints
This command displays the trustpoints that are configured in the router.
Example:
Router# show
crypto pki trustpoints
Trustpoint mytrust:
Subject Name:
ea=janedoe@cisco.com
cn=Jane
ou=DEPT_ACCT
o=Cisco
l=San Jose
st=California
c=US
Serial Number: 00
Certificate configured.
Verifying the Signed Tcl Script
To verify that the Signed Tcl Script is properly running, use the debug crypto pki transactions command
and the tclshcommand.
SUMMARY STEPS
1. enable
2. debug crypto pki transactions
3. tclsh flash:signed-tcl-file
DETAILED STEPS
Step 1
enable
This command enables privileged EXEC mode.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
36
What to Do Next
Configuration Examples for Signed Tcl Script
Example:
Router> enable
Step 2
debug crypto pki transactions
This command display debugging messages for the trace of interaction (message type) between the CA and the router.
Example:
Router# debug crypto pki transactions
Crypto PKI Trans debugging is on
Step 3
tclsh flash:signed-tcl-file
This command executes the Tcl script in Tcl shell.
Note The file should be a signed Tcl file.
Example:
Router# tclsh flash:hello.tcl
hello
argc = 0
argv =
argv0 = flash:hello.tcl
tcl_interactive = 0
Router#
*Apr 21 04:46:18.563: CRYPTO_PKI:
*Apr 21 04:46:18.563: The PKCS #7
*Apr 21 04:46:18.563: CRYPTO_PKI:
*Apr 21 04:46:18.563: CRYPTO_PKI:
locked trustpoint mytrust, refcount is 1
message has 0 verified signers.
Success on PKCS7 verify!
unlocked trustpoint mytrust, refcount is 0
What to Do Next
•
To get an overview of Crypto, go to “Part 5: Implementing and Managing a PKI” section of the Cisco
IOS Security Configuration Guide, Release 12.4T.
Configuration Examples for Signed Tcl Script
•
•
•
•
•
•
Generating a Key Pair Example, page 38
Generating a Certificate Example, page 38
Signing the Tcl Scripts Example, page 38
Verifying the Signature Example, page 39
Converting the Signature with Nonbinary Data Example, page 39
Configuring the Router with a Certificate Example, page 40
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
37
Generating a Key Pair Example
Configuration Examples for Signed Tcl Script
Generating a Key Pair Example
The following example shows how to generate the key pair--a private key and a public key:
Generate a Private Key: Example
Host% openssl genrsa -out privkey.pem 2048
Generating RSA private key, 2048 bit long modulus
.........+++
...............................................................................+++
e is 65537 (0x10001)
Host% ls -l
total 8
-rw-r--r-1 janedoe eng12
1679 Jun 12 14:55 privkey.pem
Host%
Generate a Public Key from the Private Key
Host% openssl rsa -in privkey.pem -pubout -out pubkey.pem
writing RSA key
Host% ls -l
total 16
-rw-r--r-1 janedoe eng12
1679 Jun 12 14:55 privkey.pem
-rw-r--r-1 janedoe eng12
451 Jun 12 14:57 pubkey.pem
Generating a Certificate Example
The following example shows how to generate a certificate:
Host% openssl req -new -x509 -key privkey.pem -out cert.pem -days 1095
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) [GB]:US
State or Province Name (full name) [Berkshire]:California
Locality Name (eg, city) [Newbury]:San Jose
Organization Name (eg, company) [My Company Ltd]:Cisco Systems, Inc.
Organizational Unit Name (eg, section) []:DEPT_ACCT
Common Name (eg, your name or your server's hostname) []:Jane
Email Address []:janedoe@company.com
Host% ls -l
total 24
-rw-r--r-1 janedoe eng12
1659 Jun 12 15:01 cert.pem
-rw-r--r-1 janedoe eng12
1679 Jun 12 14:55 privkey.pem
-rw-r--r-1 janedoe eng12
451 Jun 12 14:57 pubkey.pem
Signing the Tcl Scripts Example
The following example shows how to sign the Tcl scripts:
Host% openssl smime -sign -in hello -out hello.pk7 -signer cert.pem -inkey privkey.pem outform DER -binary
Host% ls -l
total 40
-rw-r--r-1 janedoe eng12
1659 Jun 12 15:01 cert.pem
-rw-r--r-1 janedoe eng12
115 Jun 13 10:16 hello
-rw-r--r-1 janedoe eng12
1876 Jun 13 10:16 hello.pk7
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
38
Verifying the Signature Example
Configuration Examples for Signed Tcl Script
-rw-r--r--rw-r--r--
1 janedoe eng12
1 janedoe eng12
1679 Jun 12 14:55 privkey.pem
451 Jun 12 14:57 pubkey.pem
Verifying the Signature Example
The following example shows how to verify the signature:
Host% openssl smime -verify -in hello.pk7 -CAfile cert.pem -inform DER -content hello
puts hello
puts "argc = $argc"
puts "argv = $argv"
puts "argv0 = $argv0"
puts "tcl_interactive = $tcl_interactive"
Verification successful
Converting the Signature with Nonbinary Data Example
The following example shows how to convert the Tcl signature with nonbinary data:
#Cisco Tcl Signature V1.0
Then append the signature file to the end of the file.
Host% xxd -ps hello.pk7 > hello.hex
Host% cat my_append
#!/usr/bin/env expect
set my_first {#Cisco Tcl Signature V1.0}
set newline {}
set my_file [lindex $argv 0]
set my_new_file ${my_file}_sig
set my_new_handle [open $my_new_file w]
set my_handle [open $my_file r]
puts $my_new_handle $newline
puts $my_new_handle $my_first
foreach line [split [read $my_handle] "\n"]
set new_line {#}
append new_line $line
puts $my_new_handle $new_line
}
{
close $my_new_handle
close $my_handle
Host% my_append hello.hex
Host% ls -l
total 80
-rw-r--r-1 janedoe eng12
1659 Jun 12 15:01 cert.pem
-rw-r--r-1 janedoe eng12
115 Jun 13 10:16 hello
-rw-r--r-1 janedoe eng12
3815 Jun 13 10:20 hello.hex
-rw-r--r-1 janedoe eng12
3907 Jun 13 10:22 hello.hex_sig
-rw-r--r-1 janedoe eng12
1876 Jun 13 10:16 hello.pk7
-rwxr--r-1 janedoe eng12
444 Jun 13 10:22 my_append
-rw-r--r-1 janedoe eng12
1679 Jun 12 14:55 privkey.pem
-rw-r--r-1 janedoe eng12
451 Jun 12 14:57 pubkey.pem
Host% cat hello hello.hex_sig > hello.tcl
Host% cat hello.tcl
puts hello
puts "argc = $argc"
puts "argv = $argv"
puts "argv0 = $argv0"
puts "tcl_interactive = $tcl_interactive"
#Cisco Tcl Signature V1.0
#3082075006092a864886f70d010702a08207413082073d020101310b3009
#06052b0e03021a0500300b06092a864886f70d010701a08204a13082049d
#30820385a003020102020100300d06092a864886f70d0101040500308195
#310b3009060355040613025553311330110603550408130a43616c69666f
#726e69613111300f0603550407130853616e204a6f7365311c301a060355
#040a1313436973636f2053797374656d732c20496e632e310e300c060355
#040b13054e53535447310d300b060355040313044a6f686e3121301f0609
#2a864886f70d01090116126a6c6175746d616e40636973636f2e636f6d30
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
39
Configuring the Router with a Certificate Example
Configuration Examples for Signed Tcl Script
#1e170d3037303631323232303134335a170d313030363131323230313433
#5a308195310b3009060355040613025553311330110603550408130a4361
#6c69666f726e69613111300f0603550407130853616e204a6f7365311c30
#1a060355040a1313436973636f2053797374656d732c20496e632e310e30
#0c060355040b13054e53535447310d300b060355040313044a6f686e3121
#301f06092a864886f70d01090116126a6c6175746d616e40636973636f2e
#636f6d30820122300d06092a864886f70d01010105000382010f00308201
#0a0282010100a751eb5ec1f3009738c88a55987c07b759c36f3386342283
#67ea20a89d9483ae85e0c63eeded8ab3eb7a08006689f09136f172183665
#c971099ba54e77ab47706069bbefaaab8c50184396350e4cc870c4c3f477
#88c55c52e2cf411f05b59f0eaec0678ff5cc238fdce2263a9fc6b6c244b8
#ffaead865c19c3d3172674a13b24c8f2c01dd8b1bd491c13e84e29171b85
#f28155d81ac8c69bb25ca23c2921d85fbf745c106e7aff93c72316cbc654
#4a34ea88174a8ba7777fa60662974e1fbac85a0f0aeac925dba6e5e850b8
#7caffce2fe8bb04b61b62f532b5893c081522d538005df81670b931b0ad0
#e1e76ae648f598a9442d5d0976e67c8d55889299147d0203010001a381f5
#3081f2301d0603551d0e04160414bc34132be952ff8b9e1af3b93140a255
#e54a667c3081c20603551d230481ba3081b78014bc34132be952ff8b9e1a
#f3b93140a255e54a667ca1819ba48198308195310b300906035504061302
#5553311330110603550408130a43616c69666f726e69613111300f060355
#0407130853616e204a6f7365311c301a060355040a1313436973636f2053
#797374656d732c20496e632e310e300c060355040b13054e53535447310d
#300b060355040313044a6f686e3121301f06092a864886f70d0109011612
#6a6c6175746d616e40636973636f2e636f6d820100300c0603551d130405
#30030101ff300d06092a864886f70d010104050003820101000c83c1b074
#6720929c9514af6d5df96f0a95639f047c40a607c83d8362507c58fa7f84
#aa699ec5e5bef61b2308297a0662c653ff446acfbb6f5cb2dd162d939338
#a5e4d78a5c45021e5d4dbabb8784efbf50cab0f5125d164487b31f5cf933
#a9f68f82cd111cbab1739d7f372ec460a7946882874b0a0f22dd53acbd62
#a944a15e52e54a24341b3b8a820f23a5bc7ea7b2278bb56838b8a4051926
#af9c167274ff8449003a4e012bcf4f4b3e280f85209249a390d14df47435
#35efabce720ea3d56803a84a2163db4478ae19d7d987ef6971c8312e280a
#aac0217d4fe620c6582a48faa8ea5e3726a99012e1d55f8d61b066381f77
#4158d144a43fb536c77d6a318202773082027302010130819b308195310b
#3009060355040613025553311330110603550408130a43616c69666f726e
#69613111300f0603550407130853616e204a6f7365311c301a060355040a
#1313436973636f2053797374656d732c20496e632e310e300c060355040b
#13054e53535447310d300b060355040313044a6f686e3121301f06092a86
#4886f70d01090116126a6c6175746d616e40636973636f2e636f6d020100
#300906052b0e03021a0500a081b1301806092a864886f70d010903310b06
#092a864886f70d010701301c06092a864886f70d010905310f170d303730
#3631333137313634385a302306092a864886f70d01090431160414372cb3
#72dc607990577fd0426104a42ee4158d2b305206092a864886f70d01090f
#31453043300a06082a864886f70d0307300e06082a864886f70d03020202
#0080300d06082a864886f70d0302020140300706052b0e030207300d0608
#2a864886f70d0302020128300d06092a864886f70d010101050004820100
#72db6898742f449b26d3ac18f43a1e7178834fb05ad13951bf042e127eea
#944b72b96f3b8ecf7eb52f3d0e383bf63651750223efe69eae04287c9dae
#b1f31209444108b31d34e46654c6c3cc10b5baba887825c224ec6f376d49
#00ff7ab2d9f88402dab9a2c2ab6aa3ecceeaf5a594bdc7d3a822c55e7daa
#aa0c2b067e06967f22a20e406fe21d9013ecc6bd9cd6d402c2749f8bea61
#9f8f87acfbc9e10d6ce91502e34629adca6ee855419afafe6a8233333e14
#ad4c107901d1f2bca4d7ffaadddbc54192a25da662f8b8509782c76977b8
#94879453fbb00486ccc55f88db50fcc149bae066916b350089cde51a6483
#2ec14019611720fc5bbe2400f24225fc
Configuring the Router with a Certificate Example
The following example shows how to configure the router with a certificate:
crypto pki trustpoint mytrust
enrollment terminal
!
!
crypto pki authentication mytrust
crypto pki certificate chain mytrust
certificate ca 00
308204B8 308203A0 A0030201 02020100
819E310B 30090603 55040613 02555331
726E6961 3111300F 06035504 07130853
13134369 73636F20 53797374 656D732C
300D0609
13301106
616E204A
20496E63
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
40
2A864886
03550408
6F736531
2E310E30
F70D0101
130A4361
1C301A06
0C060355
04050030
6C69666F
0355040A
040B1305
Signed Tcl Scripts
Additional References
4E535354 47311630 14060355 0403130D
1F06092A 864886F7 0D010901 16126A6C
301E170D 30363131 31373137 35383031
30819E31 0B300906 03550406 13025553
6F726E69 61311130 0F060355 04071308
0A131343 6973636F 20537973 74656D73
054E5353 54473116 30140603 55040313
301F0609 2A864886 F70D0109 0116126A
6D308201 22300D06 092A8648 86F70D01
0100BC6D A933028A B31BF827 7258BB87
74D231DF F0C365C1 07D6E206 D7651FA8
9AF449D8 FA8900BB 3E567F77 5412881B
0940F6D1 3A2613CD F6B3595E F468B315
D9D9C99D 31E3B380 5DEB7039 A1A29EF9
481AD75D E741CD9E BE06EA16 9B514AE3
62CA1AC9 DF30C39A 41316B8E 72289113
ADF48383 1B332C7F 73C58686 6279E2A4
43CB0203 010001A3 81FE3081 FB301D06
5F278C44 6B85F8EE 8345AB99 3081CB06
F6CC4772 5F278C44 6B85F8EE 8345AB99
04061302 55533113 30110603 55040813
03550407 13085361 6E204A6F 7365311C
79737465 6D732C20 496E632E 310E300C
06035504 03130D4A 6F686E20 4C617574
01090116 126A6C61 75746D61 6E406369
13040530 030101FF 300D0609 2A864886
31078DF6 94FE5CF0 8F83639B 414F32D8
61A6CCD3 37656934 4BE4157A 400E182B
24152FE8 A736B670 58CC684E 750D08AE
5E5EF499 ABA11124 55966616 AC9C52B2
C4AE63F6 1D5C9F76 7B4B9CA7 52CE65C9
CA307EC9 51DCB847 8B8C27FB 98ACEE60
C1CA4120 9B0B689B BA654250 97B22A76
2B7F7F8C 150AF889 BBEC62F1 E53B4F3B
quit
archive
log config
scripting tcl trustpoint name mytrust
scripting tcl secure-mode
!
!
end
4A6F686E
6175746D
5A170D30
31133011
53616E20
2C20496E
0D4A6F68
6C617574
01010500
A1600CF0
C7B230A2
AAD9525E
6DDEFF07
46ED536E
91184A56
98080354
4BF41644
03551D0E
03551D23
A181A4A4
0A43616C
301A0603
06035504
6D616E6E
73636F2E
F70D0101
069D23E2
EC390D1A
C7739907
B1082DEA
E65C04FC
0B80DC3F
CC126B77
A3626CD6
204C6175
616E4063
39313131
06035504
4A6F7365
632E310E
6E204C61
6D616E40
0382010F
21090F04
3B0011E4
3EC1D3B1
BBC5D521
4D768048
A0E51B7D
C7297AD7
3E60F131
04160414
0481C330
81A13081
69666F72
55040A13
0B13054E
3121301F
636F6D82
04050003
37E182BE
DC130A56
917B7A72
D962CBAF
4B7642D6
36E4E252
C7779AAA
05B8AB3D
746D616E
6973636F
36313735
08130A43
311C301A
300C0603
75746D61
63697363
00308201
2080BECC
EA2B6A4C
EBCE8155
B560AF72
12D48C24
4465D730
89B627F8
090D3F5D
F7F4E80E
81C08014
9E310B30
6E696131
13436973
53535447
06092A86
0100300C
82010100
7C31EC14
B8F35BFB
3D26BEC7
E476C575
0D1A8AF4
BD731F5F
D3F93C3F
F8A6A361
6E312130
2E636F6D
3830315A
616C6966
06035504
55040B13
6E6E3121
6F2E636F
0A028201
5818688B
1F3F27FB
D74866F1
D6D5FDA7
59B08973
1AB3C7DD
ED40D924
25F0C025
F6CC4772
F7F4E80E
09060355
11300F06
636F2053
31163014
4886F70D
0603551D
6D12CFF8
E87AF216
D2234556
9F554CF1
A9DDFBFA
38194B7A
0E781E26
DCF46006
Additional References
The following sections provide references related to the Signed Tcl Scripts feature.
Related Documents
Related Topic
Document Title
Cisco IOS PKI Overview: Understanding and
Planning a PKI
Cisco IOS Security Configuration Guide, Release
12.4
Implementing and Managing a PKI
PKI commands: complete command syntax,
command mode, command history, defaults, usage
guidelines, and examples.
Cisco IOS Security Command Reference, Release
12.4
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
41
Signed Tcl Scripts
Feature Information for Signed Tcl Scripts
Standards
Standard
Title
None
--
MIBs
MIB
MIBs Link
None
To locate and download MIBs for selected
platforms, Cisco IOS releases, and feature sets, use
Cisco MIB Locator found at the following URL:
http://www.cisco.com/go/mibs
RFCs
RFC
Title
None
--
Technical Assistance
Description
Link
The Cisco Support website provides extensive
http://www.cisco.com/techsupport
online resources, including documentation and tools
for troubleshooting and resolving technical issues
with Cisco products and technologies.
To receive security and technical information about
your products, you can subscribe to various
services, such as the Product Alert Tool (accessed
from Field Notices), the Cisco Technical Services
Newsletter, and Really Simple Syndication (RSS)
Feeds.
Access to most tools on the Cisco Support website
requires a Cisco.com user ID and password.
Feature Information for Signed Tcl Scripts
The following table provides release information about the feature or features described in this module.
This table lists only the software release that introduced support for a given feature in a given software
release train. Unless noted otherwise, subsequent releases of that software release train also support that
feature.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support.
To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
42
Signed Tcl Scripts
Glossary
Table 5
Feature Information for Signed Tcl Scripts
Feature Name
Releases
Feature Information
Signed Tcl Scripts
12.4(15)T
The Signed Tcl Scripts feature
allows you to create a certificate
to generate a digital signature and
sign a Tcl script with that digital
signature.
The following commands were
introduced by this feature:
scripting tcl secure-mode,
scripting tcl trustpoint name,
scripting tcl trustpoint
untrusted,and tclsafe.
Glossary
CA--certification authority. Service responsible for managing certificate requests and issuing certificates to
participating IPsec network devices. This service provides centralized key management for the participating
devices and is explicitly trusted by the receiver to validate identities and to create digital certificates.
certificates--Electronic documents that bind a user's or device's name to its public key. Certificates are
commonly used to validate a digital signature.
CRL--certificate revocation list. Electronic document that contains a list of revoked certificates. The CRL
is created and digitally signed by the CA that originally issued the certificates. The CRL contains dates for
when the certificate was issued and when it expires. A new CRL is issued when the current CRL expires.
IPsec--IP security
peer certificate--Certificate presented by a peer, which contains the peer's public key and is signed by the
trustpoint CA.
PKI--public key infrastructure. System that manages encryption keys and identity information for
components of a network that participate in secured communications.
RA--registration authority. Server that acts as a proxy for the CA so that CA functions can continue when
the CA is offline. Although the RA is often part of the CA server, the RA could also be an additional
application, requiring an additional device to run it.
RSA keys--Public key cryptographic system developed by Ron Rivest, Adi Shamir, and Leonard Adleman.
An RSA key pair (a public and a private key) is required before you can obtain a certificate for your router.
SHA1--Secure Hash Algorithm 1
SSH--secure shell
SSL--secure socket layer
Notices
The following notices pertain to this software license.
•
OpenSSL Open SSL Project, page 44
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
43
OpenSSL Open SSL Project
License Issues
OpenSSL Open SSL Project
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit ( http://
www.openssl.org/ ).
This product includes cryptographic software written by Eric Young (eay@cryptsoft.com).
This product includes software written by Tim Hudson (tjh@cryptsoft.com).
•
License Issues, page 44
License Issues
The OpenSSL toolkit stays under a dual license, i.e. both the conditions of the OpenSSL License and the
original SSLeay license apply to the toolkit. See below for the actual license texts. Actually both licenses
are BSD-style Open Source licenses. In case of any license issues related to OpenSSL please contact
openssl-core@openssl.org.
OpenSSL License:
Copyright © 1998-2007 The OpenSSL Project. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
1 Redistributions of source code must retain the copyright notice, this list of conditions and the following
disclaimer.
2 Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and
the following disclaimer in the documentation and/or other materials provided with the distribution.
3 All advertising materials mentioning features or use of this software must display the following
acknowledgment: “This product includes software developed by the OpenSSL Project for use in the
OpenSSL Toolkit ( http://www.openssl.org/ )”.
4 The names “OpenSSL Toolkit” and “OpenSSL Project” must not be used to endorse or promote
products derived from this software without prior written permission. For written permission, please
contact openssl-core@openssl.org.
5 Products derived from this software may not be called “OpenSSL” nor may “OpenSSL” appear in their
names without prior written permission of the OpenSSL Project.
6 Redistributions of any form whatsoever must retain the following acknowledgment:
“This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit ( http://
www.openssl.org/ )”.
THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT “AS IS”' AND ANY EXPRESSED OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This product includes cryptographic software written by Eric Young (eay@cryptsoft.com). This product
includes software written by Tim Hudson (tjh@cryptsoft.com).
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
44
Signed Tcl Scripts
Original SSLeay License:
Copyright © 1995-1998 Eric Young (eay@cryptsoft.com). All rights reserved.
This package is an SSL implementation written by Eric Young (eay@cryptsoft.com).
The implementation was written so as to conform with Netscapes SSL.
This library is free for commercial and non-commercial use as long as the following conditions are adhered
to. The following conditions apply to all code found in this distribution, be it the RC4, RSA, lhash, DES,
etc., code; not just the SSL code. The SSL documentation included with this distribution is covered by the
same copyright terms except that the holder is Tim Hudson (tjh@cryptsoft.com).
Copyright remains Eric Young’s, and as such any Copyright notices in the code are not to be removed. If
this package is used in a product, Eric Young should be given attribution as the author of the parts of the
library used. This can be in the form of a textual message at program startup or in documentation (online or
textual) provided with the package.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
1 Redistributions of source code must retain the copyright notice, this list of conditions and the following
disclaimer.
2 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution.
3 All advertising materials mentioning features or use of this software must display the following
acknowledgement:
“This product includes cryptographic software written by Eric Young (eay@cryptsoft.com)”.
The word ‘cryptographic’ can be left out if the routines from the library being used are not cryptographyrelated.
1 If you include any Windows specific code (or a derivative thereof) from the apps directory (application
code) you must include an acknowledgement: “This product includes software written by Tim Hudson
(tjh@cryptsoft.com)”.
THIS SOFTWARE IS PROVIDED BY ERIC YOUNG “AS IS” AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The license and distribution terms for any publicly available version or derivative of this code cannot be
changed. i.e. this code cannot simply be copied and put under another distribution license [including the
GNU Public License].
Cisco and the Cisco Logo are trademarks of Cisco Systems, Inc. and/or its affiliates in the U.S. and other
countries. A listing of Cisco's trademarks can be found at www.cisco.com/go/trademarks. Third party
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
45
Signed Tcl Scripts
trademarks mentioned are the property of their respective owners. The use of the word partner does not
imply a partnership relationship between Cisco and any other company. (1005R)
Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be
actual addresses and phone numbers. Any examples, command display output, network topology diagrams,
and other figures included in the document are shown for illustrative purposes only. Any use of actual IP
addresses or phone numbers in illustrative content is unintentional and coincidental.
Cisco IOS Scripting with TCL Configuration Guide, Cisco IOS Release 12.4T
46
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising