public id is now shown on the sessions page since authorized keys are

used which is safer.
This commit is contained in:
Erik Brakkee 2024-08-06 22:50:24 +02:00
parent 7af575119d
commit 68804761bf
5 changed files with 13 additions and 19 deletions

View File

@ -80,7 +80,6 @@ func main() {
state := models.State{}
agent := models.Agent{
PublicId: "id",
GeneratedId: "100",
StartTime: time.Now().In(japan),
AgentInfo: comms.AgentInfo{
Username: "ci",
@ -94,7 +93,6 @@ func main() {
state.Agents = append(state.Agents, agent)
client := models.Client{
PublicId: "c1",
AgentId: "100",
ClientId: 3,
StartTime: time.Now().In(japan),
SessionType: "sftp",

View File

@ -7,7 +7,6 @@ import (
type Agent struct {
PublicId string
GeneratedId string
StartTime time.Time
AgentInfo comms.AgentInfo

View File

@ -6,7 +6,6 @@ import (
type Client struct {
PublicId string
AgentId string
ClientId int
StartTime time.Time
SessionType string

View File

@ -34,7 +34,6 @@ func NewAgent(commChannel comms.CommChannel, publicId string, agentInfo comms.Ag
return &AgentConnection{
Agent: models.Agent{
PublicId: publicId,
GeneratedId: strconv.Itoa(agentIdGenerator.IncrementAndGet()),
StartTime: time.Now(),
AgentInfo: agentInfo,
},
@ -42,12 +41,11 @@ func NewAgent(commChannel comms.CommChannel, publicId string, agentInfo comms.Ag
}
}
func NewClient(publicId string, agentId string, clientConn iowrappers2.ReadWriteAddrCloser,
func NewClient(publicId string, clientConn iowrappers2.ReadWriteAddrCloser,
agentConn net.Conn) *ClientConnection {
return &ClientConnection{
Client: models.Client{
PublicId: publicId,
AgentId: agentId,
ClientId: clientIdGenerator.IncrementAndGet(),
StartTime: time.Now(),
},
@ -200,7 +198,7 @@ func (admin *Admin) addClient(publicId string, clientConn iowrappers2.ReadWriteA
log.Println("Sending connection information to agent")
client := NewClient(publicId, agent.GeneratedId, clientConn, agentConn)
client := NewClient(publicId, clientConn, agentConn)
// Before using this connection for SSH we use it to send client metadata to the
// agent

View File

@ -34,7 +34,7 @@ templ State(state *models.State, location *time.Location) {
<table class="table">
<thead>
<tr>
<th>#</th>
<th>rendez-vous id</th>
<th>start time</th>
<th>expiry time</th>
<th>username</th>
@ -45,7 +45,7 @@ templ State(state *models.State, location *time.Location) {
</thead>
for _, agent := range state.Agents {
<tr>
<td>{agent.GeneratedId}</td>
<td>{agent.PublicId}</td>
<td>{agent.StartTime.In(location).Format(time.DateTime)}</td>
<td>{agent.ExpiryTime.In(location).Format(time.DateTime)}</td>
<td>{agent.AgentInfo.Username}</td>
@ -67,18 +67,18 @@ templ State(state *models.State, location *time.Location) {
<table class="table">
<thead>
<tr>
<th>agent#</th>
<th>id</th>
<th>start time</th>
<th>session type</th>
<th>rendez-vous id</th>
</tr>
</thead>
for _, client := range state.Clients {
<tr>
<td>{client.AgentId}</td>
<td>{strconv.Itoa(client.ClientId)}</td>
<td>{client.StartTime.In(location).Format(time.DateTime)}</td>
<td>{client.SessionType}</td>
<td>{client.PublicId}</td>
</tr>
}
</table>