Jump to content

Set hostname for C2.


Peque

Recommended Posts

Hi Forum. 
for gaining more knowledge - I'm playing around with kubernetes - and trying to move my setup to k8s. 

Almost anything on the cloud is working as intended - I have a issue on the C2 server. 
When creating the deployment on Kubernetes it's only possible to set the hostname and not the FQDN. Is there any way to change this ? Only option is after the Server is deployed, but then the hostname are shown as the c2 and not the FQDN. 

After adding the static IP in the pineapple's /etc/hosts - so that the c2 resolves to the FQDN - But C2  still sets only hostname - and not hostname -f 

Is it possible to handle this issue in another way?

 

Link to comment
Share on other sites

1 hour ago, Peque said:

When creating the deployment on Kubernetes it's only possible to set the hostname and not the FQDN.

Are you referring to "hostname" and "FQDN" from the Kubernetes perspective or the Cloud C2 perspective?

1 hour ago, Peque said:

Only option is after the Server is deployed

What server? The server instance where Cloud C2 should run, or the C2 server itself?

1 hour ago, Peque said:

After adding the static IP in the pineapple's /etc/hosts - so that the c2 resolves to the FQDN

It seems as if information is missing/held back to get the full picture of the scenario. Why is it necessary to mess with the Pineapple's hosts file? Is all of it running in a local environment without DNS capabilities?

1 hour ago, Peque said:

But C2  still sets only hostname - and not hostname -f 

Not sure what you mean, C2 doesn't set anything by itself when it comes to hostname (or anything else either). "hostname -f" isn't a thing when it comes to C2 setup, it has to be in the format "-hostname <IP-address of C2 server>" or "-hostname <dns name>", so, what hostname parameter are you referring to?

Link to comment
Share on other sites

First of all -Thanks for replying 

Well, I'm still newbie trying to gain more knowledge. So sorry if I'm missing some critical information on what I mean with kubernetes/C2 Cloud server.
This little setup is just a TuringPi2 as a little cluster for learning more. 

20 hours ago, dark_pyrro said:

Are you referring to "hostname" and "FQDN" from the Kubernetes perspective or the Cloud C2 perspective?

C2 Cloud Perspective - I'm trying to set it for a C2 cloud perspektive. Creating the kubernetes from the docker-compose file from this https://github.com/LindezaGrey/hak5c2

converting with kompose - gives the 3 attached files.  - which i load into my kubernetes, but the hak5c2-deployment.yaml I could set the hostname for the instance

hak5c2-deployment.yamlc2db-persistentvolumeclaim.yamlhak5c2-service.yaml

So perhaps its just a small change - but it'll seems to I can't see it at the moment

With my first login to the C2 kubernetes, I'm adding a line to my hostfile on my pineapple - the ip of the C2 as a FQDN  - such as 

192.168.200.15	c2.example.org	c2

So now my C2 it self resolves the FQDN - so it'll should 

20 hours ago, dark_pyrro said:

What server? The server instance where Cloud C2 should run, or the C2 server itself?

The C2 itself - After the C2 server is deployed on kubernetes, it'll only set a hostname for the C2-instance - called c2 - I can add the domain name as example.org to C2 Server /etc/hosts so it'll now resolve the FQDN - but still any created devices have this line in trhe beginning of the device.config. 

Creating the device.config files 

From my old C2 cloud - reating a device.config - shows the FQDN in the device.config:                                c2.example.org 8080
From my new Kubernetes C2 - creating a device.config - it'll only show hostname - and not the FQDN :     c2 8080

 


c2*8080B _�

instad of 


c2.example.org*8080B _�

as it shows from the Old C2 Server running as a VM - in the encrypted file for the devices. 

20 hours ago, dark_pyrro said:

It seems as if information is missing/held back to get the full picture of the scenario. Why is it necessary to mess with the Pineapple's hosts file? Is all of it running in a local environment without DNS capabilities?

This is the only way - I can resolve c2 - as the device.config file showing I should, This was created for making sure The devices can coonnect to  C2.example.org and verifying that the ports etc are open. 

21 hours ago, dark_pyrro said:

Not sure what you mean, C2 doesn't set anything by itself when it comes to hostname (or anything else either). "hostname -f" isn't a thing when it comes to C2 setup, it has to be in the format "-hostname <IP-address of C2 server>" or "-hostname <dns name>", so, what hostname parameter are you referring to?

Well - and perhaps here my knowledge comes to an end and what I'm doing are confused. But when I logging to the c2 server in a browser it's with the FQDN(internal DNS on PFsense)
The last steps on getting the right FQDN to the C2 server itself - so I can create the device files correctly 
(and have tried to changed the path in the device.config - but that'll not work either. 

So hopefully I've explained it a little bit further 

P

Link to comment
Share on other sites

Well, in the "hak5c2-deployment.yaml" file you posted, the "hostname" parameter is set to "c2", then I guess it will be used when deployed.

Reading the texts on the GitHub you linked kinda backs that up as I see it ("You can pass all parameters you would normally pass to the application to the container by adding them as an environment variable (except the hostname which is set by the docker "hostname" command)")

So, if you want something else than "c2" to be used as hostname, I guess you need to specify exactly what you want to be used and nothing else.

Did you try to run it with Docker alone (not jumping straight on the Kubernetes train)?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...