Skip to content

Commit

Permalink
Merge branch 'develop' into feature/localVC/support-multiple-SSH-keys
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonEntholzer authored Oct 30, 2024
2 parents 4d521ef + 998d6c0 commit d5ca308
Show file tree
Hide file tree
Showing 239 changed files with 4,067 additions and 2,101 deletions.
4 changes: 4 additions & 0 deletions docs/admin/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ This section describes some additional steps that are of interest for production
For information on how to set up extension services to activate additional functionality in your Artemis instance, see
:ref:`their respective documentation <extensions_setup>`.

We recommend using the `Artemis Ansible Collection <https://github.com/ls1intum/artemis-ansible-collection>`_ for
setting up Artemis in production. The collection provides a set of Ansible roles that automate the setup of Artemis,
including the required external system with sane configuration defaults.

.. toctree::
:includehidden:
:maxdepth: 2
Expand Down
52 changes: 24 additions & 28 deletions docs/admin/setup/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,45 +126,41 @@ For Artemis to find the key set `artemis.version-control.ssh-host-key-path` to t
Adapting Nginx to Enable SSH Routing
""""""""""""""""""""""""""""""""""""

To enable SSH routing through Nginx, you can set up an SSH proxy. However, Nginx by itself does
not support SSH, but you can use Nginx to reverse proxy an SSH service (e.g., using sslh to multiplex SSH and HTTPS).
To enable SSH routing through Nginx, you can set up an SSH proxy.

Configure sslh to listen on port 443 (to handle both HTTPS and SSH), by editing the sslh configuration
file (e.g., /etc/default/sslh):

.. code-block:: text
RUN=yes
DAEMON=/usr/sbin/sslh
DAEMON_OPTS="--user sslh --listen 0.0.0.0:443 --ssh 127.0.0.1:22 --ssl 127.0.0.1:8443"
Configure Nginx to proxy HTTPS traffic, by adapting the configuration file to listen on port 8443 for HTTPS:
Configure Nginx to proxy HTTPS traffic on port 443 and SSH traffic on port 7921.

.. code-block:: nginx
server {
listen 8443 ssl;
server_name yourdomain.com;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
http {
server {
listen 443 ssl;
server_name yourdomain.com;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
stream {
server {
listen 7921;
proxy_pass 127.0.0.1:7921;
}
}
Restart sslh and Nginx:
Restart Nginx:

.. code-block:: bash
sudo systemctl restart sslh
sudo systemctl restart nginx
By following these steps, you ensure that your key pairs are properly generated and distributed across all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
/**
* Enum to define the different reasons why the confidence is above/below 1 in the {@link CompetencyProgress}.
* A confidence != 1 leads to a higher/lower mastery, which is displayed to the student together with the reason.
* Also see {@link CompetencyProgress#setConfidenceReason}.
* Also see {@link de.tum.cit.aet.artemis.atlas.service.competency.CompetencyProgressService#setConfidenceReason}.
*/
public enum CompetencyProgressConfidenceReason {
NO_REASON, RECENT_SCORES_LOWER, RECENT_SCORES_HIGHER, MORE_EASY_POINTS, MORE_HARD_POINTS, QUICKLY_SOLVED_EXERCISES
NO_REASON, RECENT_SCORES_LOWER, RECENT_SCORES_HIGHER, MORE_EASY_POINTS, MORE_HARD_POINTS, QUICKLY_SOLVED_EXERCISES, MORE_LOW_WEIGHTED_EXERCISES, MORE_HIGH_WEIGHTED_EXERCISES
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.Optional;
import java.util.Set;

import de.tum.cit.aet.artemis.atlas.domain.competency.CourseCompetency;
import de.tum.cit.aet.artemis.atlas.domain.competency.CompetencyLearningObjectLink;
import de.tum.cit.aet.artemis.core.domain.User;

public interface LearningObject {
Expand All @@ -19,7 +19,7 @@ public interface LearningObject {

Long getId();

Set<CourseCompetency> getCompetencies();
Set<? extends CompetencyLearningObjectLink> getCompetencyLinks();

boolean isVisibleToStudents();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package de.tum.cit.aet.artemis.atlas.domain.competency;

import java.io.Serial;
import java.io.Serializable;
import java.util.Objects;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Embeddable;
import jakarta.persistence.EmbeddedId;
import jakarta.persistence.Entity;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.MapsId;
import jakarta.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.fasterxml.jackson.annotation.JsonIgnore;

import de.tum.cit.aet.artemis.exercise.domain.Exercise;

@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Table(name = "competency_exercise")
public class CompetencyExerciseLink extends CompetencyLearningObjectLink {

@EmbeddedId
@JsonIgnore
protected CompetencyExerciseId id = new CompetencyExerciseId();

@ManyToOne(optional = false, cascade = CascadeType.PERSIST)
@MapsId("exerciseId")
private Exercise exercise;

public CompetencyExerciseLink(CourseCompetency competency, Exercise exercise, double weight) {
super(competency, weight);
this.exercise = exercise;
}

public CompetencyExerciseLink() {
// Empty constructor for Spring
}

public Exercise getExercise() {
return exercise;
}

public void setExercise(Exercise exercise) {
this.exercise = exercise;
}

public CompetencyExerciseId getId() {
return id;
}

@Override
public String toString() {
return "CompetencyExerciseLink{" + "exercise=" + exercise + ", id=" + id + ", competency=" + competency + ", weight=" + weight + '}';
}

@Embeddable
public static class CompetencyExerciseId implements Serializable {

@Serial
private static final long serialVersionUID = 1L;

private long exerciseId;

private long competencyId;

public CompetencyExerciseId() {
// Empty constructor for Spring
}

public CompetencyExerciseId(long exerciseId, long competencyId) {
this.exerciseId = exerciseId;
this.competencyId = competencyId;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof CompetencyExerciseId that)) {
return false;
}
return exerciseId == that.exerciseId && competencyId == that.competencyId;
}

@Override
public int hashCode() {
return Objects.hash(exerciseId, competencyId);
}

@Override
public String toString() {
return "CompetencyExerciseId{" + "exerciseId=" + exerciseId + ", competencyId=" + competencyId + '}';
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package de.tum.cit.aet.artemis.atlas.domain.competency;

import java.io.Serializable;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.MappedSuperclass;
import jakarta.persistence.MapsId;

@MappedSuperclass
public abstract class CompetencyLearningObjectLink implements Serializable {

@ManyToOne(optional = false, cascade = CascadeType.PERSIST)
@MapsId("competencyId")
protected CourseCompetency competency;

@Column(name = "link_weight")
protected double weight;

public CompetencyLearningObjectLink(CourseCompetency competency, double weight) {
this.competency = competency;
this.weight = weight;
}

public CompetencyLearningObjectLink() {
// Empty constructor for Spring
}

public CourseCompetency getCompetency() {
return competency;
}

public void setCompetency(CourseCompetency competency) {
this.competency = competency;
}

public double getWeight() {
return weight;
}

public void setWeight(double weight) {
this.weight = weight;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package de.tum.cit.aet.artemis.atlas.domain.competency;

import java.io.Serial;
import java.io.Serializable;
import java.util.Objects;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Embeddable;
import jakarta.persistence.EmbeddedId;
import jakarta.persistence.Entity;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.MapsId;
import jakarta.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.fasterxml.jackson.annotation.JsonIgnore;

import de.tum.cit.aet.artemis.lecture.domain.LectureUnit;

@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Table(name = "competency_lecture_unit")
public class CompetencyLectureUnitLink extends CompetencyLearningObjectLink {

@EmbeddedId
@JsonIgnore
protected CompetencyLectureUnitId id = new CompetencyLectureUnitId();

@ManyToOne(optional = false, cascade = CascadeType.PERSIST)
@MapsId("lectureUnitId")
private LectureUnit lectureUnit;

public CompetencyLectureUnitLink(CourseCompetency competency, LectureUnit lectureUnit, double weight) {
super(competency, weight);
this.lectureUnit = lectureUnit;
}

public CompetencyLectureUnitLink() {
// Empty constructor for Spring
}

public LectureUnit getLectureUnit() {
return lectureUnit;
}

public void setLectureUnit(LectureUnit lectureUnit) {
this.lectureUnit = lectureUnit;
}

public CompetencyLectureUnitId getId() {
return id;
}

@Override
public String toString() {
return "CompetencyLectureUnitLink{" + "lectureUnit=" + lectureUnit + ", id=" + id + ", competency=" + competency + ", weight=" + weight + '}';
}

@Embeddable
public static class CompetencyLectureUnitId implements Serializable {

@Serial
private static final long serialVersionUID = 1L;

private long lectureUnitId;

private long competencyId;

public CompetencyLectureUnitId() {
// Empty constructor for Spring
}

public CompetencyLectureUnitId(long lectureUnitId, long competencyId) {
this.lectureUnitId = lectureUnitId;
this.competencyId = competencyId;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof CompetencyLectureUnitId that)) {
return false;
}
return lectureUnitId == that.lectureUnitId && competencyId == that.competencyId;
}

@Override
public int hashCode() {
return Objects.hash(lectureUnitId, competencyId);
}

@Override
public String toString() {
return "CompetencyLectureUnitId{" + "lectureUnitId=" + lectureUnitId + ", competencyId=" + competencyId + '}';
}
}
}
Loading

0 comments on commit d5ca308

Please sign in to comment.