/usr/share/secpanel/export_profiles.tcl is in secpanel 1:0.6.1-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | #!/usr/bin/tclsh
##################################################################
# SecPanel
#
# Exporting profiles related code
##################################################################
proc export {mode form} {
global sites env widget configs
# source def-files
if {$mode == "def"} {
if {[$widget(defsites) index end] > 0} {
source "$env(HOME)/.secpanel/profiles/default.profile"
set actconn [$widget(defsites) get active]
set host [lindex [split $sites($actconn) #] 0]
set userentry [lindex [split $sites($actconn) #] 1]
if {$userentry == "<ASKFORUSER>"} {
set user [askforuser]
if {$user == "#####"} {
return
}
} else {
set user $userentry
}
set title $actconn
} else {
showmessage "No conncections available, please use \"New\"" ""
return
}
}
# source spec-files
if {$mode == "spec"} {
if {[$widget(specsites) index end] > 0} {
set actconn [retprof [$widget(specsites) get active]]
source "$env(HOME)/.secpanel/profiles/$actconn.profile"
} else {
showmessage "No conncections available, please use \"New\"" ""
return
}
}
# forwardings
if {[array size lfs] > 0} {
foreach lf [array names lfs] {
if {[regsub {<TARGET-HOST>} [lindex [split $lf :] 1] $host th]} {
append lf_tag " -L [lindex [split $lf :] 0]:$th:[lindex [split $lf :] 2] "
} else {
append lf_tag " -L [lindex [split $lf :] 0]:[lindex [split $lf :] 1]:[lindex [split $lf :] 2] "
}
}
} else {
set lf_tag " "
}
set localhost [info hostname]
if {[array size rfs] > 0} {
foreach rf [array names rfs] {
if {[regsub {<LOCAL-HOST>} [lindex [split $rf :] 1] $localhost lh]} {
append rf_tag " -R [lindex [split $rf :] 0]:$lh:[lindex [split $rf :] 2] "
} else {
append rf_tag " -R [lindex [split $rf :] 0]:[lindex [split $rf :] 1]:[lindex [split $rf :] 2] "
}
}
} else {
set rf_tag " "
}
if {$user != ""} {
set user_tag "-l $user "
} else {
set user_tag " "
}
if {$port == 22 || $port == ""} {
set port_tag " "
} else {
set port_tag "-p $port "
}
if {$algo != "default" || $algo == ""} {
set algo_tag "-c $algo "
} else {
set algo_tag " "
}
if {$identity != ""} {
set ident_tag "-i $identity "
} else {
set ident_tag " "
}
if {$command != ""} {
set command_tag "$command"
} else {
set command_tag ""
}
if $compress {
# openssh
if {$configs(sshver) == "OpenSSH"} {
set compressval_tag "-o \'CompressionLevel [set compressval]\' "
} else {
set compressval_tag "-o CompressionLevel=$compressval "
}
} else {
set compressval_tag " "
}
array set bools {
"agentforward" "-a" \
"x11forward" "-x" \
"nopriv" "-P" "verbose" "-v" \
"quiet" "-q" \
"fork" "-f" \
"gateway" "-g" \
"compress" "-C"
}
# foreach f [array names $bools]
foreach f {agentforward x11forward nopriv verbose \
quiet fork gateway compress} {
if [set $f] {
set [set f]_tag "$bools($f) "
} else {
set [set f]_tag " "
}
}
# foreach f [array names $bools]
foreach f {agentforward x11forward nopriv verbose \
quiet fork gateway compress} {
if [set $f] {
set [set f]_tagssh "yes"
} else {
set [set f]_tagssh "no"
}
}
set sshvertag "-[set sshverconnect] "
set ipvertag "-[set ipverconnect] "
# openssh
if {! $x11forward} {
if {$configs(sshver) == "OpenSSH"} {
set x11forward_tag "-X "
}
}
set connstring "$configs(sshbin) $user_tag \
$agentforward_tag $x11forward_tag $sshvertag $ipvertag $port_tag $algo_tag \
$ident_tag $nopriv_tag $verbose_tag $quiet_tag \
$fork_tag $gateway_tag $compress_tag $compressval_tag \
$lf_tag $rf_tag $host $command_tag"
switch -exact $form {
"ssh" {
puts "Host $host"
puts "Compression $compress_tagssh"
puts "CompressionLevel $compressval_tag"
puts "ForwardAgent $agentforward_tagssh"
puts "ForwardX11 $x11forward_tagssh"
puts "GatewayPorts $gateway_tagssh"
puts "HostName $host"
puts "IdentityFile $ident_tag"
puts "LocalForward"
puts "Port $port_tag"
puts "Protocol $sshvertag"
puts "RemoteForward"
puts "StrictHostKeyChecking"
puts "User $user_tag"
}
"sh" {
puts "#!/bin/sh"
puts "#\n#Exported by SecPanel\n#"
puts "$connstring"
}
}
}
|