Permalink
Browse files

vpapi changes, include provider name in url path

  • Loading branch information...
hypatia2 committed Oct 25, 2015
1 parent 425436e commit 0c320489209fa0130b8d015bdf78205233fd4c79
Showing with 23 additions and 13 deletions.
  1. +5 −4 API.md
  2. +2 −2 build.tcl
  3. +4 −2 fruho/add_securitykiss.tcl
  4. BIN fruho/images/16/logo_hideipvpn.png
  5. +12 −5 fruho/main.tcl
9 API.md
@@ -13,16 +13,17 @@ GET /welcome
## VPAPI - VPN Provider API
This is the API defined and used by the Fruho program to import VPN configurations and plan definitions from third party VPN services. This also applies to Fruho as an interim VPN service so it must be implemented on bootstrap hosts along with FBAPI
This is the API defined and used by the Fruho program to import VPN configurations and plan definitions from third party VPN services. This also applies to Fruho as an interim VPN service so it must be implemented on bootstrap hosts along with FBAPI.
It is also used in case when VPN provider does not provide VPAPI endpoint - Fruho client needs to connect to bootstrap nodes and retrieve configuration via nuncio robot.
All calls must be HTTPS with username and password passed via Basic Authentication
GET /vpapi/config
GET /vpapi/<provider>/config
Result: config.ovpn with inline CA and optionally KEY and CERT
GET /vpapi/plans
GET /vpapi/<provider>/plans
Result: JSON plan description with server list
POST /vpapi/cert
POST /vpapi/<provider>/cert
Input: CSR or PUBKEY posted in body request
Result: signed CRT
@@ -229,8 +229,8 @@ prepare-lib sklib 0.0.0
build-fruho linux [this-arch]
#build-fruhod linux [this-arch]
#build-deb-rpm [this-arch]
build-fruhod linux [this-arch]
build-deb-rpm [this-arch]
#release hypatia2
@@ -7,8 +7,8 @@ namespace eval ::securitykiss {
variable dispname SecurityKISS
variable host www.securitykiss.com
variable port 10443
variable path_config /vpapi/config
variable path_plans /vpapi/plans
variable path_config /vpapi/securitykiss/config
variable path_plans /vpapi/securitykiss/plans
# input entries - resettable/modifiable variables
@@ -114,6 +114,8 @@ proc ::securitykiss::ImportClicked {tab} {
$pconf.importline.msg configure -text $msg
return
}
# save in the model to be able later refresh the plans via vpapi
dict set ::model::Profiles $profileid vpapi_username $username
dict set ::model::Profiles $profileid vpapi_password $password
dict set ::model::Profiles $profileid vpapi_host $host
Binary file not shown.
@@ -847,6 +847,7 @@ proc vpapi-config-direct {profilename host port urlpath username password} {
# this is replacement for the old sign-cert call
# it is a request to sign CSR - for now used only in case of FAAS
proc vpapi-cert-direct {profilename host port urlpath username password} {
try {
set profileid [name2id $profilename]
@@ -941,12 +942,17 @@ proc faas-config-monitor {} {
puts stderr [log faas-config-monitor running]
tickernow t1 10000 #3
range t $t1 {
if {[get-faas-config] == 200} {
set faas_result [get-faas-config]
puts stderr [log "faas_result=$faas_result"]
if {$faas_result == 200} {
gui-update
# this return terminates range but does not return from coroutine
return
}
}
puts stderr [log All faas-config-monitor attempts failed]
if {$faas_result != 200} {
puts stderr [log All faas-config-monitor attempts failed]
}
} on error {e1 e2} {
log "$e1 $e2"
} finally {
@@ -964,23 +970,23 @@ proc get-faas-config {} {
set port 10443
if {![is-cert-received fruho]} {
set result [vpapi-cert-direct Fruho bootstrap $port /vpapi/cert?[this-pcv] $username $password]
set result [vpapi-cert-direct Fruho bootstrap $port /vpapi/fruho/cert?[this-pcv] $username $password]
if {$result != 200} {
puts stderr [log "ERROR: vpapi-cert-direct Fruho failed with status $result"]
return $result
}
puts stderr [log vpapi-cert-direct Fruho SUCCESS]
}
if {![is-config-received fruho]} {
set result [vpapi-config-direct Fruho bootstrap $port /vpapi/config?[this-pcv] $username $password]
set result [vpapi-config-direct Fruho bootstrap $port /vpapi/fruho/config?[this-pcv] $username $password]
if {$result != 200} {
puts stderr [log "ERROR: vpapi-config-direct Fruho failed with status $result"]
return $result
}
puts stderr [log vpapi-config-direct Fruho SUCCESS]
}
if {![dict exists $::model::Profiles fruho plans]} {
set result [vpapi-plans-direct Fruho bootstrap $port /vpapi/plans?[this-pcv] $username $password]
set result [vpapi-plans-direct Fruho bootstrap $port /vpapi/fruho/plans?[this-pcv] $username $password]
if {$result != 200} {
puts stderr [log "ERROR: vpapi-plans-direct Fruho failed with status $result"]
return $result
@@ -2387,6 +2393,7 @@ proc vpapi-port {profileid} {
return [dict-pop $::model::Profiles $profileid vpapi_port 10443]
}
proc vpapi-path-plans {profileid} {
# watch out: default value of url path plans - it's pointing nowhere now
return [dict-pop $::model::Profiles $profileid vpapi_path_plans /vpapi/plans]
}

0 comments on commit 0c32048

Please sign in to comment.