summaryrefslogtreecommitdiffstats
path: root/models/ssh_key.go
Commit message (Collapse)AuthorAgeFilesLines
* LDAP Public SSH Keys synchronization (#1844)Magnus Lindvall2018-05-241-14/+24
| | | | | | | | | | | | | | | | | | | * Add LDAP Key Synchronization feature Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Add migration: add login source id column for public_key table * Only update keys if needed * Add function to only list pubkey synchronized from ldap * Only list pub ssh keys synchronized from ldap. Do not sort strings as ExistsInSlice does it. * Only get keys belonging to current login source id * Set default login source id to 0 * Some minor cleanup. Add integration tests (updete dep testify)
* Remove useless check (#3384)Antoine GIRARD2018-01-191-4/+0
| | | In #3377, I put check inside all write key function. This one is useless no.
* Add integrations tests from git cli (#3377)Antoine GIRARD2018-01-161-0/+10
| | | | | | | | | | | * test: integration add git cli tests Extracted form for easing review process and debug #3152 * test: integration add git cli big file commit * fix: Don't rewrite key if internal server
* Writable deploy keys (closes #671) (#3225)Vlad Temian2018-01-071-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add is_writable checkbox to deploy keys interface * Add writable key option to deploy key form * Add support for writable ssh keys in the interface * Rename IsWritable to ReadOnly * Test: create read-only and read-write deploy keys via api * Add DeployKey access mode migration * Update gitea sdk via govendor * Fix deploykey migration * Add unittests for writable deploy keys * Move template text to locale * Remove implicit column update * Remove duplicate locales * Replace ReadOnly field with IsReadOnly method * Fix deploy_keys related integration test * Rename v54 migration with v55 * Fix migration hell
* Improvements for supporting UI Location (#3146)Lunny Xiao2017-12-141-10/+12
| | | | | | * improvements for supporting UI Location * improved the comment
* Refactor struct's time to remove unnecessary memory usage (#3142)Lunny Xiao2017-12-111-11/+8
| | | | | | | | | | | | | | * refactor struct's time to remove unnecessary memory usage * use AsTimePtr simple code * fix tests * fix time compare * fix template on gpg * use AddDuration instead of Add
* Delete a user's public key via admin api (closes #3014) (#3059)Vlad Temian2017-12-061-4/+1
| | | | | | | | | | | | | | | | * Delete a user's public key via admin api * Test admin ssh endpoint for creating a new ssh key * Adapt public ssh key test to also test the delete operation * Test that deleting a missing key will result in a 404 * Test that a normal user can't delete another user's ssh key * Make DeletePublicKey return err * Update swagger doc
* Disable add key button if SSH is disabled (#2873)Michael Kuhn2017-11-211-1/+1
|
* don't check minimum key size when disabled (#1754)Gibheer2017-10-261-5/+5
| | | | | | | | | | | | | | * cleanup old comments for ed25519 These comments were added when x/crypto/ed25519 could not yet handle ed25519. It does now, so it should be removed. Also the key type is now replaced with the proper constant. * move the minimum key size config before the check This moves the actual config lookup before any check is done. This avoids problems with calling to ssh-keygen which doesn't support the expected output format and returning an error, when the check is disabled.
* Replace deprecated Id method with ID (#2655)Ethan Koenig2017-10-051-3/+3
|
* Use AfterLoad instead of AfterSet on Structs (#2628)Lunny Xiao2017-10-011-22/+14
| | | | | | | | * use AfterLoad instead of AfterSet on Structs * fix the comments on AfterLoad * fix the comments on action AfterLoad
* Reduce usage of allcols on update (#2596)Lunny Xiao2017-09-251-9/+1
| | | | | | * reduce usage of allcols on update * fix bug and tests
* Fix lint errors (#2547)Ethan Koenig2017-09-191-5/+1
|
* Use created & updated instead BeforeInsert & BeforeUpdate (#2482)Lunny Xiao2017-09-131-28/+8
| | | | | | | | | | | | * use created & updated instead BeforeInsert & BeforeUpdate * fix vendor checksum * only show generated SQL when development mode * remove extra update column updated_unix * remove trace config
* Fix key usage time update if the key is used in parallel for multiple ↵Lauris BH2017-07-201-4/+9
| | | | operations (#2185)
* Setting to disable authorized_keys backup (#1856)Dan Magnus Lindvall2017-06-281-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add setting to disable authorized_keys backup when rewriting public keys Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Update default value to comply with documentation Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Use tmp-file instead of bak-file for saving manually added keys. Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Change casing Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Change casing and build bakpath with sprintf only Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Only close file once Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Do not modify calcFingerprint Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Fix casing Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Change style from disable to enable Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Change name, just SSH_BACKUP_AUTHORIZED_KEYS Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Do not check for directory existence if backup is disabled Signed-off-by: Magnus Lindvall <magnus@dnmgns.com>
* Refactor session close as xorm already does everything needed internally (#2020)Lauris BH2017-06-211-4/+4
|
* Delete Public SSH Key tmp file after calculating fingerprint (#1855)Dan Magnus Lindvall2017-06-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | * Delete public key tmp file after calculating fingerprint Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Move line Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Remove defer statement Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Readd defer statement and move remove Signed-off-by: Magnus Lindvall <magnus@dnmgns.com> * Delete space Signed-off-by: Magnus Lindvall <magnus@dnmgns.com>
* use writeTmpKeyFile in calcFingerprint (#1828)Timo Myyrä2017-05-291-10/+2
| | | this makes calcFingerprint use SSH.KeyTestpath instead of os temp dir.
* Add internal routes for ssh hook comands (#1471)Lunny Xiao2017-04-191-2/+4
| | | | | | | | | | | | | | | | * add internal routes for ssh hook comands * fix lint * add comment on why package named private not internal but the route name is internal * add comment above package private why package named private not internal but the route name is internal * remove exp time on internal access * move routes from /internal to /api/internal * add comment and defer on UpdatePublicKeyUpdated
* refactor update ssh key use time (#1466)Lunny Xiao2017-04-071-0/+14
|
* Refactor and fix incorrect comment (#1247)Ethan Koenig2017-03-151-1/+1
|
* Don't rewrite non-gitea public keys (#906)Lunny Xiao2017-03-031-4/+30
| | | | | | * don't rewrite non-gitea public keys * add comment for public key
* Use fingerprint to check instead content for public key (#911)Lunny Xiao2017-02-141-23/+42
| | | | | | * use fingerprint to check instead content for public key * add fingerprint field for ErrKeyAlreadyExist
* Cleanup log messagingGabriel Jackson2017-02-021-1/+1
| | | | | | | | | This change corrects a few logging issues: * Standardized formatting errors with '%v'. * Standardized failure warning word usage. * Corrected an instance of using the standard log library when the gitea log library should be used instead.
* refactor: Remove unnecessary type conversions (#772)Bo-Yi Wu2017-01-271-1/+1
|
* Refactor process package and introduce ProcessManager{} with tests (#75)Matthias Loibl2017-01-171-2/+2
| | | | | | | | | | * Add a process.Manager singleton with process.GetManager() * Use process.GetManager everywhere * Fix godoc comments for process module * Increment process counter id after locking the mutex
* Fix typos in models/ (#576)Ethan Koenig2017-01-051-2/+2
|
* Replace Gogs with Gitea (#520)Bwko2016-12-281-1/+1
|
* Catch os... errorsBwko2016-12-021-1/+6
|
* Lint models/ssh_key.goBwko2016-11-261-23/+32
|
* Handle ssh key import better (#224)stroucki2016-11-241-0/+2
| | | | | | | | | | | * Handle user ssh key input better ssh_key: when user submitted keys had a newline at the end, strings.Split would have created a slice with an empty last element, and the key type check would be incorrect. Perhaps a better way is to look for 'ssh-rsa' or 'ssh-dsa' at the beginning of the string, but this is simple. * ssh_key: correct indentation
* use in instead string join (#155)Lunny Xiao2016-11-121-2/+1
|
* Merge remote-tracking branch 'upstream/master' into feature/rewrite-xorm-queriesThibault Meyer2016-11-101-4/+4
|\ | | | | | | | | | | | | | | | | # Conflicts: # models/git_diff.go # models/issue.go # models/org.go # models/pull.go # models/repo.go
| * Update import paths from github.com/go-gitea to code.gitea.io (#135)Sandro Santilli2016-11-101-4/+4
| | | | | | | | | | | | | | - Update import paths from github.com/go-gitea to code.gitea.io - Fix import path for travis See https://docs.travis-ci.com/user/languages/go#Go-Import-Path
* | Rewrite XORM queriesThibault Meyer2016-11-101-9/+27
|/
* And othersSandro Santilli2016-11-071-7/+7
|
* ACCESS_MODE_* -> AccessMode*Sandro Santilli2016-11-071-3/+3
|
* Change import reference to match gitea instead of gogs (#37)Rémy Boulanouar2016-11-031-4/+4
|
* #3281 fix x.Iterate returns nothing inside session scope with SQLite3Unknwon2016-07-261-86/+15
|
* models/ssh_key: code cleaningUnknwon2016-07-261-59/+57
|
* Refactor User.Id to User.IDUnknwon2016-07-241-3/+3
|
* Remove redundant Unix timestamp method callUnknwon2016-07-231-4/+4
| | | | Unix() already uses UTC as timezone
* #2302 Replace time.Time with Unix Timestamp (int64)Unknwon2016-03-091-23/+51
|
* Post work for #2637Unknwon2016-02-271-60/+54
| | | | Improve test cases, config settings, also show SSH config settings on admin config panel.
* variable should not use ALL_CAPSGibheer2016-02-231-4/+4
|
* allow native and ssh-keygen public key checkGibheer2016-02-161-12/+133
| | | | | | | | | | | | | | | | | | | This commit adds the possibibility to use either the native golang libraries or ssh-keygen to check public keys. The check is adjusted depending on the settings, so that only supported keys are let through. This commit also brings back the blacklist feature, which was removed in 7ef9a055886574655d9f2be70c957bc16bf30500. This allows to blacklist algorythms or keys based on the key length. This works with the native and the ssh-keygen way. Because of #2179 it also includes a way to adjust the path to ssh-keygen and the working directory for ssh-keygen. With this, sysadmins should be able to adjust the settings in a way, that SELinux is okay with it. In the worst case, they can switch to the native implementation and only loose support for ed25519 keys at the moment. There are some other places which need adjustment to utilize the parameters and the native implementation, but this sets the ground work.
* Trim whitespace when adding SSH keys (fixes #2447)John Maguire2016-01-311-0/+3
|
* Add debug log when SSH key for deletion isn't foundJohn Maguire2016-01-311-0/+5
|
* #2179 use Go sub-repo ssh to verify public key contentUnknwon2016-01-151-37/+10
|