gjanders / SplunkVersionControl

Version Control application for Splunk
Apache License 2.0
28 stars 10 forks source link

Unable to Connect to Github Repository #18

Open rakeshjetti9 opened 3 years ago

rakeshjetti9 commented 3 years ago

I'm not able push the objects into my remote git repository. I have configured SSH on my github account as well as on the splunk server machine.

I'm able to clone the repository via the git bash. Below are the configurations:

image

I'm getting the below error while saving the configurations on the splunk: image

Gitusername: samules8 Splunk Username: marlonsamuels Windows System Username: Jackson

Need more info on the below points: image

gjanders commented 3 years ago

Is this in Windows or Linux?

gjanders commented 3 years ago

And assuming it is windows is Splunk running as the system user? And if so is the SSH key in the system user directory, something like : C:\windows\system32\config\systemprofile.ssh

chandanch commented 3 years ago

This is on Windows system. Yes splunk is running as the sytem user. Below are the files under C:\windows\system32\config

image

gjanders commented 3 years ago

Is there a hidden directory with .ssh in there under c:\windows\system32\config\systemprofile.ssh ? If not than when the system user attempts to run the git clone it does not have access to the required SSH keys.

On my test server I put the id.rsa (or your key file name) under: c:\windows\system32\config\systemprofile.ssh

With appropriate permissions, if you can get a command window running as the system user you can also test it that way...

rakeshjetti9 commented 3 years ago

Windows

Thanks & Regards, Rakesh Jetti, +919505446851

On Sat, Feb 20, 2021, 2:28 AM gjanders notifications@github.com wrote:

Is this in Windows or Linux?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gjanders/SplunkVersionControl/issues/18#issuecomment-782346443, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR7CA3LJG3KC4P5Q42GO5WTS73GHJANCNFSM4X4QIMMA .

rakeshjetti9 commented 3 years ago

Hii,

As per the documentation available in Splunk base we have followed the below steps.

  1. We have crated a GitHub repository.
  2. We have generated SSH key for windows server with the help of below link (https://www.atlassian.com/git/tutorials/git-ssh) and add to shh agent to our key.
  3. We have added SSH key to GitHub account under SSH keys.
  4. We have cloned the git repository by using SSH key into our windows server and it is successfully cloned.
  5. After that we have open the DataInputs from splunk web and Selected the splunkversion control backup option and gave the below parameters.

Name : splunk_backup srcURL : https://localhost:8089 srcUsername : Splunk Enterprise username srcPassword : Splunk Enterprise user password gitTempDir : local System path where git repository cloned gitRepoURL : Git repository SSH URL

6.After clicking Next button, we are getting the below error

Encountered the following error while trying to save: Failed to validate the git repo URL, stdout of 'b''', stderr of 'b'git@github.com: Permission denied (publickey).\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n''

image

        So, can you please let us know the above steps and parameters are valid are not to establish the connection, also below .ssh folder created  under C:\Users\rakeshjetti9\.ssh

image

So, please help us to fix this.

gjanders commented 3 years ago

So your key is under C:\Users\rakeshjetti9.ssh But Splunk runs as the system user?

Perhaps try copying the SSH key to directory: C:\windows\system32\config\systemprofile.ssh

So in the above directory which you may need to create, add the SSH key.

You can also test by opening a command prompt and using git clone but you must open the command prompt as the system user, not your current user...

Also, this tends to be easier on Linux if you have any Linux machines...(or docker images running splunk/linux)

rakeshjetti9 commented 3 years ago

Hi Thanks for your help. As you said we have copied all the files from C:\Users\rakeshjetti9.ssh* to C:\windows\system32\config\systemprofile.ssh*

After that we are able save the created input successfully but all the apps are coming to local directory where given under gitTemDir but not able to find in GitHub repo.

Please help us ,Is anything we have missed.

Do we need to give any git commands under Data Inputs(Splunk Version Control Backup)?

gjanders commented 3 years ago

Check the splunk version control backup log. It will be in your _internal index or the logs directory.

You might need to set an email address and name for git, I added that into the new version of the app.

Let me know if the logs aren't clear

rakeshjetti9 commented 3 years ago

Hii,

We have done setup git_name and git_email. After that we seen the logs that shows waring like this,

i="splun_na" git checkout master or git pull failed, stdout is 'b''' stderrout is 'b"error: pathspec 'master' did not match any file(s) known to git\nThere is no tracking information for the current branch.\nPlease specify which branch you want to merge with.\nSee git-pull(1) for details.\n\n git pull \n\nIf you wish to set tracking information for this branch you can do so with:\n\n git branch --set-upstream-to=/ master\n\n"'. Wiping git directory

gjanders commented 3 years ago

I found on Windows you might have to remove the temporary directory manually.

Did you initialise the git repository? I e. It contains 1 or more files?

rakeshjetti9 commented 3 years ago

I removed temporary directory.

I initialized the git repository and it contains 2 files.

gjanders commented 3 years ago

Ok same error?

Do you have a master branch in the git repo?

rakeshjetti9 commented 3 years ago

No Error, but still we are unable to find any Splunk app folders under git repo.(for backup)

image

But Splunk app folders getting into local backup folder.

image

How can take backup into git?

gjanders commented 3 years ago

What does the splunkversioncontrol_backup.log say?

rakeshjetti9 commented 3 years ago

Hi ,

Can you please find the attached file for log Details

If it is possible, can you please connect with us for 10 mins so that we will complete this implementation.

On Thu, Feb 25, 2021 at 7:46 AM gjanders notifications@github.com wrote:

What does the splunkversioncontrol_backup.log say?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gjanders/SplunkVersionControl/issues/18#issuecomment-785525445, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR7CA3IRFEVA5XT342LIVTLTAWXJVANCNFSM4X4QIMMA .

-- Thanks & Regards, Rakesh Jetti, +91 9505446851.

gjanders commented 3 years ago

I cannot see any files attached, I'm currently on leave and have very little time to investigate the issues on my open source projects